<update> tag doesn't work for vanilla Units.

CrazyAce

Prince
Joined
Jun 16, 2004
Messages
396
Location
I'm here, soon to be there.
The <update> tag doesn't work for units; I have spent a week (literally 8 hours a day) on just this one little piece of code.

There has to be more than just simply adding the following code into a new xml file:

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/29/2010 4:04:04 PM -->
<GameData>
	<Units>
		<update>
			<Where Type="UNIT_WARRIOR"/>
			<Set Moves="1"/>
		</update>
	</Units>
</GameData>

This just will not work no matter how many times I have tried. I started giving up and lying saying, “yeah I got it to work” :blush: Thinking that I might be missing one little thing, but to find out I am doing it absolutely as it should be done.

When I start the game this is what I do from the very beginning. I execute the shortcut, (at work I select Dx9)(at home I select Dx10), Click to continue screen, MODS, Accept, Browse Mods, Enable Mod (click green check mark to on), Back (one time), Single player, Set up Game, Start Game.


Here is my modinfo file:

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="83579cf7-e50d-4f83-94d0-280bf78c3ef4" version="1">
  <Properties>
    <Name>Unit Tweaks</Name>
    <Stability>Alpha</Stability>
    <Description>None yet.</Description>
    <Authors>CrazyAce</Authors>
    <AffectsSavedGames>1</AffectsSavedGames>
    <MinCompatibleSaveVersion>0</MinCompatibleSaveVersion>
    <SupportsSinglePlayer>1</SupportsSinglePlayer>
    <SupportsMultiplayer>1</SupportsMultiplayer>
    <SupportsMac>1</SupportsMac>
    <ReloadLandmarkSystem>0</ReloadLandmarkSystem>
    <ReloadUnitSystem>0</ReloadUnitSystem>
  </Properties>
  <Dependencies />
  <References />
  <Blocks />
  <Files>
    <File md5="7809E8A02A33DDDEB196126E89D67FE7">XML/Units/UnitTweaks.xml</File>
  </Files>
  <Actions>
    <OnModActivated>
      <UpdateDatabase>XML\Units\UnitTweaks.xml</UpdateDatabase>
    </OnModActivated>
  </Actions>
</Mod>

Everything should be set up correctly, I’m convinced either we are missing something or that it has changed.
 
I haven't actually checked this myself (still writing to the files for my mod, not quite ready to compile a test case), but according to that modding guide PDF floating around, isn't the Set supposed to come BEFORE the Where? I've never liked Reverse Polish notations and would prefer the way you have it, but if the order matters (and I'd assume it would) then that could be doing it.

On an unrelated note, if you're modding the Warrior, you'd probably want to mod all the UUs based on the Warrior at the same time, specifically anything sharing the same UnitClass. I don't know if there's any way to do this other than the brute-force approach, though; ideally you could change the Where to check UnitClass instead of Type, so that it'd change them all at once.
 
yup in Kaels guide it is written first set then where. So your order is wrong CrazyAce
 
Yeap it is wrong and in the reverse order it still doesn't work.

Here I have changed the code diffrent times to these and none of them will work:

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/29/2010 4:04:04 PM -->
<GameData>
	<Units>
		<update>
			<Where UnitType="UNIT_WARRIOR"/>
			<Set Moves="1"/>
		</update>
	</Units>
</GameData>

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/29/2010 4:04:04 PM -->
<GameData>
	<Units>
		<update>
			<Where Unit="UNIT_WARRIOR"/>
			<Set Moves="1"/>
		</update>
	</Units>
</GameData>

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/29/2010 4:04:04 PM -->
<GameData>
	<Units>
		<update>
			<Where Type="UNIT_WARRIOR"/>
			<Set Moves="1"/>
		</update>
	</Units>
</GameData>

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/29/2010 4:04:04 PM -->
<GameData>
	<Units>
		<update>
			<Where UnitClass="UNITCLASS_WARRIOR"/>
			<Set Moves="1"/>
		</update>
	</Units>
</GameData>

... Anyways the correct code layout should be as followed:

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/29/2010 4:04:04 PM -->
<GameData>
	<Units>
		<update>
                                       <Set Moves="1" />
			<Where UnitType="UNIT_WARRIOR" />
		</update>
	</Units>
</GameData>

Still, no change.
 
Works fine for me.

Edit: your slashes are in the wrong direction. Make them match those in the file path.
 

Attachments

  • warrior.jpg
    warrior.jpg
    204.9 KB · Views: 84
Then I wonder if there is a difference between your SDK and ours. No one has been able to resolve a unit edit.

Done that using the required <update> tag. Still doesn't work.
 
Then I wonder if there is a difference between your SDK and ours. No one has been able to resolve a unit edit.

Done that using the required <update> tag. Still doesn't work.

My SDK is the same as yours. Let me see your updated modinfo.
 
Try changing the name of your XML file so it matches the original's name. Change it from UnitTweaks.xml to CIV5Units.xml

Also, the Where should be as follows:

Code:
<Where Type="UNIT_WARRIOR"/>
 
Try changing the name of your XML file so it matches the original's name. Change it from UnitTweaks.xml to CIV5Units.xml

This isn't required. In my mod where it works the filename is Unit_Gaelic_Warrior.xml.
 
Yeap updated modinfo from 2 minutes ago:


Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="83579cf7-e50d-4f83-94d0-280bf78c3ef4" version="1">
  <Properties>
    <Name>Unit Tweaks</Name>
    <Stability>Alpha</Stability>
    <Description>None yet.</Description>
    <Authors>CrazyAce</Authors>
    <AffectsSavedGames>1</AffectsSavedGames>
    <MinCompatibleSaveVersion>0</MinCompatibleSaveVersion>
    <SupportsSinglePlayer>1</SupportsSinglePlayer>
    <SupportsMultiplayer>1</SupportsMultiplayer>
    <SupportsMac>1</SupportsMac>
    <ReloadLandmarkSystem>0</ReloadLandmarkSystem>
    <ReloadUnitSystem>0</ReloadUnitSystem>
  </Properties>
  <Dependencies />
  <References />
  <Blocks />
  <Files>
    <File md5="5776A6626C85358B67B0367088F780AE">XML/Units/UnitTweaks.xml</File>
  </Files>
  <Actions>
    <OnModActivated>
      <UpdateDatabase>XML/Units/UnitTweaks.xml</UpdateDatabase>
    </OnModActivated>
  </Actions>
</Mod>

:edit:

And just to see if creating a mod even works for me, I have copied the examples from "Thalassicus Balance - Fewer Bad Buildings (v 3)" and sure enough I can edit the monument to cost 0 and GoldMaintenance to 0 using the same <update><set> and <where> tags.
 
Use back-slashes, not forward slashes.

Also, the Where needs to search on Type not Unit.

And I've had unit edits working fine, and Update works if you put Set before OR after the Where, it doesn't matter.
 
Try using Update, not update. I did this in one of my own mods and it worked when I capitalized it. I'm not sure that's the problem here though.

Forward slashes are correct. Why are you directly altering your modinfo file? ModBuddy takes care of that data automatically.

The order of Set and Where does not matter, it's translated correctly either way.

On a side note, the reason you sometimes see WHERE last is it's the industry convention for SQL database statements. In that situation information retrieval is much more common than updates (what is customer 152's name?), and it makes sense to put the information you're searching for first. (SELECT stuff ...WHERE conditions are met) When actually doing updates like we're doing however, it's more intuitive to use "Where" stuff "Set" value. That's the order things appear in tables and the game's XML files, with a header at the front and values after the header.
 
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 9/29/2010 6:30:43 PM -->
<GameData>
	<Units>
		<Update>
			<Set Moves="1" />
			<Where Type="UNIT_WARRIOR" />
		</Update>
	</Units>
</GameData>

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="0b3489af-b10a-4bb7-a8cc-99726e5084d3" version="1">
  <Properties>
    <Name>Unit Tweaks</Name>
    <Stability>Experimental</Stability>
    <Description>This mod will tweak various game units, such as the amount of spaces a unit can move,changes range a unit can bombard and incudes bombard ability for gunpowder units.</Description>
    <Authors>CrazyAce</Authors>
    <SpecialThanks>Kael, Dale, Firaxis, 2KGames and Civfanatics.com</SpecialThanks>
    <AffectsSavedGames>1</AffectsSavedGames>
    <MinCompatibleSaveVersion>0</MinCompatibleSaveVersion>
    <SupportsSinglePlayer>1</SupportsSinglePlayer>
    <SupportsMultiplayer>1</SupportsMultiplayer>
    <SupportsMac>1</SupportsMac>
    <ReloadLandmarkSystem>0</ReloadLandmarkSystem>
    <ReloadUnitSystem>0</ReloadUnitSystem>
  </Properties>
  <Dependencies />
  <References />
  <Blocks />
  <Files>
    <File md5="F44BBEAC9FF5F3D26C85B335CCFFDFD1">XML/Units/UnitTweaks.xml</File>
  </Files>
  <Actions>
    <OnModActivated>
      <UpdateDatabase>XML\Units\UnitTweaks.xml</UpdateDatabase>
    </OnModActivated>
  </Actions>
</Mod>

Yeap still doesn't work. This post is from home, the above posts were from work. If anyone "else" (outside of beta testers I know Dale and Kael) can get them to work, can get a unit updated, please prove me wrong and let me dissect the code.

I have run out of different possible combinations to get this working.

:edit:

Dale or Kael, when you guys received the SDK before the public release, did you guys set any configuration or settings up differently than us?
 
Yeap I sure have, if you take a look at the modinfo code listed in the above posts it will show that it is set to load. And yeah please I beg of you get 1 working, I will look it over with a fine tooth comb to see what the difference is between the too. Preferably its move status, this way it makes it quick to test.
 
Dunno if you changed this already but your slashes for the file name and the updatedatabase are backwards. Should they maybe be in the same direction?
 
Here, unzip the attached project folder into your Firaxis ModBuddy directory, then load and build the project (it's empty except for your warrior update code). When I start a game, the starting warrior has 1 maximum moves.

Make sure that the mod is enabled on the Mods > Browse Mods > Installed Mods menu, and that you start a game through the Mods > Start Game menu. Mods have no effect if you play through the normal Single Player menu.

Also, and this is important: it's vital you go to the project page and click the New button next to ModID. Otherwise, your mod will have the same ID as anyone else who uses this project file as a starting point.
 

Attachments

  • Unit Moves Test.zip
    7 KB · Views: 73
CrazyAce, I can't get your mod or my own similar little mod to work. I guess we are missing the same step. From what I can tell our mods aren't updating the sql database with the new code because if I edit the sql database directly it'll do what I want. I've made sure that OnModActivated UpdateDatabase <filename> action is added correctly to the project properties too.
 
Top Bottom