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

Idiot trying to figure this out for the first time.

Discussion in 'Civ5 - SDK / LUA' started by Peng Qi, Mar 29, 2015.

  1. Peng Qi

    Peng Qi Emperor

    Joined:
    Aug 19, 2007
    Messages:
    1,431
    Location:
    Irrelevant.
    So I've been bumping around here looking things up, reading some tutorials, and typing out some XML but...I'm a total noob. Zero experience. Have no idea what I'm doing.

    I've written out some things that...I thought were supposed to do things when loaded up but apparently don't. On the bright side I can upload my mod that doesn't do anything to the Workshop and load it into the game OK! Now I have to figure out why it doesn't do anything...

    So I have two files in my Solution, which I've named what I want them to do. I'm not sure if this is a problem; should my changes be in the named files I intend them to modify? Or can I just plunk them down anywhere as I'm doing?

    Second, I have one file that's supposed to eliminate the WW1 bomber, swap the techs needed for the Battleship and Submarine and needed for WW1 Infantry and Artillery, and move the Destroyer to Replaceable Parts. It is also supposed to update the obsolescence tech for Riflemen, Cannons, and Frigates to match. Here's the code:
    Code:
    <GameData>
      <!-- TODO: Insert table creation example here. -->
     
      <!-- TODO: Insert table data example here.-->
      
      <!-- Enter your Game Data here. -->
    	<Units>
    		<Update>
    			<Delete Class="UNITCLASS_WWI_BOMBER"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_REFRIGERATION"/>
    			<Where Class="UNITCLASS_BATTLESHIP"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_ELECTRONICS"/>
    			<Where Class="UNITCLASS_SUBMARINE"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
    			<Where Class="UNITCLASS_DESTROYER"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_DYNAMITE"/>
    			<Where Class="UNITCLASS_GREAT_WAR_INFANTRY"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
    			<Where Class="UNITCLASS_ARTILLERY"/>
    		</Update>
    		<Update>
    			<Set ObsoleteTech="TECH_DYNAMITE"/>
    			<Where Class="UNITCLASS_RIFLEMEN"/>
    		</Update>
    		<Update>
    			<Set ObsoleteTech="TECH_REPLACEABLE_PARTS"/>
    			<Where Class="UNITCLASS_CANNON"/>
    		</Update>
    		<Update>
    			<Set ObsoleteTech="TECH_REFRIGERATION"/>
    			<Where Class="UNITCLASS_FRIGATE"/>
    		</Update>
    	</Units>
    </GameData>
    It doesn't do anything at all in-game, but at least it doesn't crash. :D

    The second bit is some tech fiddling. Namely, I'm trying to swap the prerequisite techs for Rifling and Military Science and their location on the in-game tech tree. This code also appears to do nothing!
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Created by ModBuddy on 3/28/2015 10:01:52 PM -->
    <GameData>
      <!-- TODO: Insert table creation example here. -->
     
      <!-- TODO: Insert table data example here.-->
      
      <!-- Enter your Game Data here. -->
    	<Technologies>
    		<Update>
    			<Where TechType="TECH_MILITARY_SCIENCE"/>
    			<GridX>9</GridX>
    			<GridY>6</GridY>
    		</Update>
    		<Update>
    			<Where TechType="TECH_RIFLING"/>
    			<GridX>9</GridX>
    			<GridY>8</GridY>
    		</Update>
    	</Technologies>
    	<Technology_PrereqTechs>
    		<Update>
    			<Where TechType="TECH_MILITARY_SCIENCE"/>
    			<Set PrereqTech="TECH_ECONOMICS"/>
    		</Update>
    		<Update>
    			<Where TechType="TECH_RIFLING"/>
    			<Set PrereqTech="TECH_CHEMISTRY"/>
    		</Update>
    		<Delete>
    			<Where TechType="TECH_MILITARY_SCIENCE"/>
    			<Set PrereqTech="TECH_CHEMISTRY"/>
    		</Delete>
    		<Delete>
    			<Where TechType="TECH_RIFLING"/>
    			<Set PrereqTech="TECH_ECONOMICS"/>
    		</Delete>
    	</Technology_PrereqTechs>
    </GameData>
    I almost feel like there's an important tutorial I just haven't read yet that tells me what likely incredibly obvious thing I'm doing wrong here, but if there is I have not yet found it. Can someone clobber me with some supernoob help here? :(
     
  2. TheMarshmallowBear

    TheMarshmallowBear Benelovent Chieftain of the BearKingdom

    Joined:
    Dec 27, 2006
    Messages:
    7,495
    Location:
    Inside an Ikanda.
    You don't "update" an entry to delete. it's seperate

    so you do this

    Code:
    <Units>
    		<Delete Class="UNITCLASS_WWI_BOMBER"/>
    		<Update>
    			<Set PrereqTech="TECH_REFRIGERATION"/>
    			<Where Class="UNITCLASS_BATTLESHIP"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_ELECTRONICS"/>
    			<Where Class="UNITCLASS_SUBMARINE"/>
    		</Update>">
    For the second thing you need to delete first then make new ones in the same style, otherwise you are just deleting what was created first, it's a sequenece of events

    if you are telling it Writing to be required by Animal Husbandry and then telling it it to delete the requirement then it's gonna have no requirements as opposed to telling it to delete the requirement and then making it require Animal Husbandry.
     
  3. Peng Qi

    Peng Qi Emperor

    Joined:
    Aug 19, 2007
    Messages:
    1,431
    Location:
    Irrelevant.
  4. TheMarshmallowBear

    TheMarshmallowBear Benelovent Chieftain of the BearKingdom

    Joined:
    Dec 27, 2006
    Messages:
    7,495
    Location:
    Inside an Ikanda.
    It's not a bad idea to enable Logging so you can see what exactly the game is failing, it usually will tell you the format is wrong (finds a row where there should be a delete) and it's very helpful when debugging the XML files, since one error will fail the entire XML file.
     
  5. Peng Qi

    Peng Qi Emperor

    Joined:
    Aug 19, 2007
    Messages:
    1,431
    Location:
    Irrelevant.
    I followed the instructions in this thread to enable logging, and I don't appear to be getting any errors other than the ones the base game has? I still have no idea why the mod isn't doing anything. Oh, and I updated the code to:
    Code:
    <GameData>
      <!-- TODO: Insert table creation example here. -->
     
      <!-- TODO: Insert table data example here.-->
      
      <!-- Enter your Game Data here. -->
    	<Units>
    			<Delete Class="UNITCLASS_WWI_BOMBER"/>
    		<Update>
    			<Set PrereqTech="TECH_REFRIGERATION"/>
    			<Where Class="UNITCLASS_BATTLESHIP"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_ELECTRONICS"/>
    			<Where Class="UNITCLASS_SUBMARINE"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
    			<Where Class="UNITCLASS_DESTROYER"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_DYNAMITE"/>
    			<Where Class="UNITCLASS_GREAT_WAR_INFANTRY"/>
    		</Update>
    		<Update>
    			<Set PrereqTech="TECH_REPLACEABLE_PARTS"/>
    			<Where Class="UNITCLASS_ARTILLERY"/>
    		</Update>
    		<Update>
    			<Set ObsoleteTech="TECH_DYNAMITE"/>
    			<Where Class="UNITCLASS_RIFLEMEN"/>
    		</Update>
    		<Update>
    			<Set ObsoleteTech="TECH_REPLACEABLE_PARTS"/>
    			<Where Class="UNITCLASS_CANNON"/>
    		</Update>
    		<Update>
    			<Set ObsoleteTech="TECH_REFRIGERATION"/>
    			<Where Class="UNITCLASS_FRIGATE"/>
    		</Update>
    	</Units>
    </GameData>
    Code:
    <GameData>
      <!-- TODO: Insert table creation example here. -->
     
      <!-- TODO: Insert table data example here.-->
      
      <!-- Enter your Game Data here. -->
    	<Technologies>
    		<Update>
    			<Where TechType="TECH_MILITARY_SCIENCE" GridY="6"/>
    			<Set GridX="9"/>
    			<Set GridY="8"/>
    		</Update>
    		<Update>
    			<Where TechType="TECH_RIFLING" GridY="8"/>
    			<Set GridX="9"/>
    			<Set GridY="6"/>
    		</Update>
    	</Technologies>
    	<Technology_PrereqTechs>
    		<Update>
    			<Where TechType="TECH_MILITARY_SCIENCE" PrereqTech="TECH_CHEMISTRY"/>
    			<Set PrereqTech="TECH_ECONOMICS"/>
    		</Update>
    		<Update>
    			<Where TechType="TECH_RIFLING" PrereqTech="TECH_ECONOMICS"/>
    			<Set PrereqTech="TECH_CHEMISTRY"/>
    		</Update>
    	</Technology_PrereqTechs>
    </GameData>
     
  6. Peng Qi

    Peng Qi Emperor

    Joined:
    Aug 19, 2007
    Messages:
    1,431
    Location:
    Irrelevant.
    Guh...I may have figured it out. I hadn't set the Actions in the Properties correctly. It wasn't even trying to load my code. -_-
     
  7. Peng Qi

    Peng Qi Emperor

    Joined:
    Aug 19, 2007
    Messages:
    1,431
    Location:
    Irrelevant.
    OK! So my unit changes work perfectly! There's something wrong with my tech changes though, since they're not loading in properly at all. I suspect I may need to delete and entirely re-write the two techs?

    EDIT: Editing the code in the above post presently rather than spamming changes.
     

Share This Page