1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Question about an alternate unit upgrade path mod

Discussion in 'Civ5 - Creation & Customization' started by turner2914, Oct 2, 2014.

  1. turner2914

    turner2914 Chieftain

    Joined:
    Oct 2, 2014
    Messages:
    4
    Location:
    Canada
    I'm working on a mod right now and it is my first. It's a mod that changes the upgrade path for the crossbowman to artillery instead since I feel that it's a more beneficial ranged unit. I have ran into trouble when trying to change from gatling gun to artillery in the upgrade path. Would anyone be able to help me out? I've attached the unfinished mod for anyone to look at the .xml
     

    Attached Files:

  2. reddishrecue

    reddishrecue Deity

    Joined:
    Nov 16, 2009
    Messages:
    5,220
    Gender:
    Male
    You could alter the upgrade paths by letting gatling guns continue where canons left off.
     
  3. Browd

    Browd Dilettante Administrator

    Joined:
    Aug 5, 2012
    Messages:
    11,638
    Gender:
    Male
    Location:
    Washington, DC
    Moderator Action: Moved to the Creation & Customization forum.
     
  4. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,449
    Location:
    Illinois, USA
    See this:
    whoward69's what ModBuddy setting for what file types tutorial

    1. You haven't given your mod any actions to perform with the XML file, so nothing is going to happen.
    2. You have a wrong type of designation here:
    Code:
    <GameData>
    	<Units>
    		<Update>
    			<Where Unit="UNIT_CROSSBOWMAN"/>
    			<Set ObsoleteTech="TECH_DYNAMITE"/>
    		</Update>
    	</Units>
    
    	<Unit_ClassUpgrades>
    [COLOR="Red"]		<Update>
    			<Where UnitType="UNIT_GATLINGGUN"/>
    			<Set UnitType="UNIT_ARTILLERY"/>
    		</Update>[/COLOR]
    	</Unit_ClassUpgrades>
    </GameData
    The way the <Unit_ClassUpgrades> table works is that for each <Row> within it, you specify a unit that will be upgraded at some point in the game via the <UnitType>column, and the CLASS of unit it will upgrade to via the <UnitClassType> column. So if I want to alter the Crossbowmen to Artillery instead of Gatling Guns, I need:
    Code:
    	<Unit_ClassUpgrades>
    		<Update>
    			<Where UnitType="UNIT_CROSSBOWMAN"/>
    			<Set UnitClassType="UNITCLASS_ARTILLERY"/>
    		</Update>
    	</Unit_ClassUpgrades>
    Remember also that to keep everything balanced you would also need to have an update specifying UNIT_CHINESE_CHUKONU and UNIT_ENGLISH_LONGBOWMAN in the <Where UnitType="UNIT_X"/>. Also, these three units have a <GoodyHutUpgradeUnitClass>UNITCLASS_GATLINGGUN</GoodyHutUpgradeUnitClass> column stated for them within the <Units> table, so you would need to decide if you wanted to alter that as well. And you would need to make an <Update> under <Units> to include the change for <ObsoleteTech> for the UNIT_CHINESE_CHUKONU and UNIT_ENGLISH_LONGBOWMAN. If I wanted to do all of this, I would actuyally do it like this:
    Code:
    <GameData>
    	<Units>
    [COLOR="Green"]		<Update>
    			<Where Class="UNITCLASS_CROSSBOWMAN"/>
    			<Set ObsoleteTech="TECH_DYNAMITE" GoodyHutUpgradeUnitClass="UNITCLASS_ARTILLERY" />
    		</Update>[/COLOR]
    	</Units>
    
    	<Unit_ClassUpgrades>
    [COLOR="Red"][B]		<Update>
    			<Where UnitClassType="UNITCLASS_GATLINGGUN"/>
    			<Set UnitClassType="UNITCLASS_ARTILLERY"/>
    		</Update>[/B][/COLOR]
    	</Unit_ClassUpgrades>
    </GameData>
    1. The Dark Green lines for the <Units> update tells the game that everywhere within the <Units> table that it sees a unit belonging to the Crossbowman Class of units, change the info for that unit to ObsoleteTech="TECH_DYNAMITE" and GoodyHutUpgradeUnitClass="UNITCLASS_ARTILLERY".
    2. The Bolded Red lines for the <Unit_ClassUpgrades> update tells the game that everywhere within the <Unit_ClassUpgrades> table that it sees a <Row> that will upgrade a unit to the UNITCLASS_GATLINGGUN Class of units, change the info for that unit to UNITCLASS_ARTILLERY.
     
  5. turner2914

    turner2914 Chieftain

    Joined:
    Oct 2, 2014
    Messages:
    4
    Location:
    Canada
    Holy cow, thank you! I read over some material while trying to write it but it wasn't as helpful as your explanation! Thanks a bunch, I didn't realize this was so much like programming even though it's an .xml file.

    So I just got out of class and plopped this down in the xml file and go ingame to test it. Unfortunately it doesn't change the upgrade path, is there still anything I need to add?
     
  6. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,449
    Location:
    Illinois, USA
    How did you make the changes? Through ModBuddy with a redo of the "Build" & "Build Solution", or did you directly edit the XML file in the mod that is in the ~CIV5/MODS folder. Also, I am not sure if the changes will work if you try it on a saved game. Some (most ?) things you need to start an entirely new game to be sure they're getting registered correctly.

    I just tested it in a new game and it properly upgrades the Crossbowman to an Artillery unit, and shows that upgrade path in the civilopedia.
     
  7. turner2914

    turner2914 Chieftain

    Joined:
    Oct 2, 2014
    Messages:
    4
    Location:
    Canada
    I think I just edited the XML, I'll try through modbuddy right now and report back with results.

    So I just used modbuddy to enter the text and built the mod but every time I start a new game it seems like the mod had absolutely no effect! How should the directory for the mod look? should it be C:/.../MODS/Crossbowman/XML/.xml or is the folder unnecessary?
     
  8. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,449
    Location:
    Illinois, USA
    Did you add an "action" for the XML file, as the linked tutorial (top of post #4) shows how to do? If you haven't given the XML file an "action" to perform then no amount of changing the text within the XML file is going to make any difference.

    The file structure for the mod you had in your 1st post is fine. It is also fine if everything in the mod is directly in the "top" folder of the mod (ie, in the case of the mod you added in post #1, the Crossbowmen to Artillery Upgrade folder).
     
  9. turner2914

    turner2914 Chieftain

    Joined:
    Oct 2, 2014
    Messages:
    4
    Location:
    Canada
    Sorry, I did forget to add the action, it works like a charm now, thank you for your help! I've given you a special thanks in the modinfo.
     

Share This Page