How to actually override upgradable unit?

Discussion in 'CivBE - Modding Help & Mod Creation' started by ray111, Jul 10, 2015.

  1. ray111

    ray111 Chieftain

    Joined:
    Mar 4, 2014
    Messages:
    79
    Am I missing something or is it not possible?

    I mean, sure, I can override a soldier, who shows up and works just fine in game, but that soldier isn't upgradable (at 1/6/11 affinity) at all..

    Now I've tried to define <Unit_ClassUpgrades> that (if I don't understand it wrong) chooses <UnitClassType> for upgrades for my <UnitType>
    Spoiler :
    <Unit_ClassUpgrades>
    <Row>
    <UnitType>UNIT_PLACEHOLDER</UnitType>
    <Unit_ClassUpgrades>UNITCLASS_MARINE</Unit_ClassUpgrades>
    </Row>
    </Unit_ClassUpgrades>

    But that doesn't seem to do ANYTHING in the game.

    Next I've tried to even define all the upgrades (or rather - copied marine's upgrades and changed line
    Spoiler :
    <UnitType>UNIT_MARINE</UnitType> to <UnitType>UNIT_PLACEHOLDER</UnitType>
    , but that not only didn't work, but apparently messed up whole override and I ended up with standard BE Soldier instead of my custom one.

    Could anyone throw some knowledge my way? Or is this not even possible? I'm guessing I'm missing some key knowledge here. Back in civ5 this was not even a primitive issue, but now with almost every unit having a tree of up to 7 upgrades...

    I think the main issue here is that in civ5, units were upgrading into a different CLASS whatsoever, but now in civBE they stay the same CLASS and upgrade only UnitType based on your affinity level and give it some promotions to make them stronger. I understood from my testing that once I override class, it's all over and it can't use the upgrades of it's former class. But I'm completely out of ideas why not even making custom upgrades doesn't work and rather messes up ALL the things and BE ends up ignoring whole xml file.
     
  2. HandyVac

    HandyVac Gentleman

    Joined:
    Apr 24, 2014
    Messages:
    270
    Gender:
    Male
    Location:
    The shire where the oxen cross the river. UK.
    That's how it worked in civ5, but the whole unit upgrading system has changed in BE. As you say, units don't change class when upgraded in BE, and I don't think that table even exists any more.

    Instead, the <UnitUpgrades> table defines at which affinity levels a unit gets upgraded, and the <UnitPerks> table defines what stats and abilities get added to it's existing stats and abilities. You can see the defines for the vanilla unit's upgrades in CivBEUnitUpgrades.xml and CivBEUnitPerks.xml

    Remember that <Type> is the unique column in the <UnitUpgrades> table. You can have any number of upgrades that apply to UnitType="UNIT_MARINE", but each upgrade must have a unique value for Type or it will cause an error.
    e.g.
    Spoiler :

    Code:
    <UnitUpgrades>
      <Row>
        [B]<Type>UNITUPGRADE_PLACEHOLDER_1</Type> [/B]    
        <Description>TXT_KEY_UNIT_MARINE02</Description> 
        [B]<UnitType>UNIT_PLACEHOLDER</UnitType> [/B]
        <UpgradeTier>1</UpgradeTier>
        <AnyAffinityLevel>1</AnyAffinityLevel>    
        <ExtraProductionCost>50</ExtraProductionCost>
        <FreePerk>UNITPERK_MARINE_1</FreePerk> 
        <IconAtlas>UNIT_UPGRADE_ATLAS_1</IconAtlas> 
        <PortraitIndex>4</PortraitIndex>
      </Row>
    </UnitUpgrades>
    
     
  3. ray111

    ray111 Chieftain

    Joined:
    Mar 4, 2014
    Messages:
    79
    Since BE refuses to make custom rows in <UnitUpgrades> table (ignoring whole xml if you try, for no apparent reason -> modifying original game's xml disables upgrades for ALL units)
    Spoiler :
    rows like these (orange text are the only changes) are wrong for some reason.. and since there are no tutorials for BE modding at all right now, it's kinda harsh:
    <Row>
    <Type>UNITUPGRADE_PLACEHOLDER_1</Type>
    <Description>TXT_KEY_UNIT_MARINE02</Description>
    <UnitType>UNIT_PLACEHOLDER</UnitType>
    <UpgradeTier>1</UpgradeTier>
    <AnyAffinityLevel>1</AnyAffinityLevel>
    <ExtraProductionCost>50</ExtraProductionCost>
    <FreePerk>UNITPERK_MARINE_1</FreePerk>
    <IconAtlas>UNIT_UPGRADE_ATLAS_1</IconAtlas>
    <PortraitIndex>4</PortraitIndex>
    </Row>
    , I think the only way to make an upgradable unit replacement is by adding some lua function that will revert that unique unit type back to the vanilla unit type when you reach the Affinity threshold for that unit's first upgrade. Unfortunately that's beyond my capabilities for now..

    That would also most likely also limit the Sponsor's unique unit possibility to the base unit types (Soldier, Ranger, Rover,..), as their upgrades are only base unit types (same class) with modified stats and added promotions.
     
  4. ray111

    ray111 Chieftain

    Joined:
    Mar 4, 2014
    Messages:
    79
    yeah I did exactly that, but the Unit Upgrades window ended up EMPTY for some reason. I don't know about any other files that would need to be modified though, when I looked for that, literally the only xml they were even mentioned in was that refference in <Decription> - which are just names in language we picked.

    I'm starting to suspect some really trivial error.. but I'm at it for 2 days already and I've modified that mod xml so many times... I hope I'm not missing one little character somewhere.. but I've done these UnitUpgrades into a separate xml from the rest, so that much should be fine.. gonna try removing that Unit_ClassUpgrades edit, but I doubt that's doing anything at all.
     
  5. HandyVac

    HandyVac Gentleman

    Joined:
    Apr 24, 2014
    Messages:
    270
    Gender:
    Male
    Location:
    The shire where the oxen cross the river. UK.
    You might also want to check out Advanced Explorer on the steam workshop, since that mod adds custom upgrades to a unit which is not normally upgradeable.

    Should give you a good, working example to copy from.
     
  6. ray111

    ray111 Chieftain

    Joined:
    Mar 4, 2014
    Messages:
    79
    Yeah that looks allright, but the joke is, it's done exactly the same way I did it too, just that he adds new models (well, recolors) of that unit as well. He's doing the UnitUpgrades insertions exactly the same as me, so who knows why it doesn't work for me.. probably because I'm missing those 847 lines of lua magic. Hard to tell.
    It would be mighty nice of him if he ever released some kind of template with instructions how to make a custom unit, rather than us deciphering the lua to find clues.

    I can't even tell how much is needed for modifying/overriding existing unit and how much he had to write because he was doing upgrades for explorer from scratch.
     
  7. Gorbles

    Gorbles Load Balanced

    Joined:
    Nov 24, 2014
    Messages:
    6,754
    Location:
    UK
    Sorry, I visit this subforum far less than I should. I'll have a look at my old mod setup; I haven't been able to work on it for some months.

    Odds are Rising Tide will break things as well, so I'm going to re-release around then as well.
     

Share This Page