help - can't figure out whats wrong

mattpilot

Warlord
Joined
Jan 29, 2004
Messages
184
trying to make 2 simple changes in a small mod, but i can't get it to work in-game.


Code:
- <GameData>
- <Unit_ResourceQuantityRequirements>
- <Update>
  <Where UnitType="UNIT_MECHANIZED_INFANTRY" /> 
  <Set ResourceType="RESOURCE_IRON" /> 
  </Update>
  </Unit_ResourceQuantityRequirements>
- <Units>
- <Update>
  <Where Class="UNITCLASS_MECH" /> 
  <Set Combat="100" /> 
  </Update>
  </Units>
  </GameData>


Save games crash when i load it with this mod, so i know its doing 'something', but when i start a new game this mod file doesn't seem to affect anything. I use Thal's balance-combined, and i checked those files to see if there's anything 'overriding', but can't find anything.


So whats wrong with the code?
 
Are those minus signs in the actual file? If so, get rid of them. (You get those when you cut and paste from HTML into XML.)

But also, you can't do the Update on the Mechanized Infantry that way, because there's no entry to update. There isn't an entry for Mechanized Infantry in the resource requirement table, so you want to use a new <Row> definition instead of an <Update>.

So replace the first half with
Spoiler :
<Unit_ResourceQuantityRequirements>
<Row>
<UnitType>UNIT_MECHANIZED_INFANTRY</UnitType>
<ResourceType>RESOURCE_IRON</ResourceType>
</Row>
</Unit_ResourceQuantityRequirements>

The second half looks fine, code-wise.
 
Thanks for trying to help.

I made the change, but it still won't work. The '-' are not in the mod file - doing it with modbuddy.


two simple changes and its driving me nuts :crazyeye:
 
i'm thinking maybe i'm missing something between <gamedata> and <unit_resou...> and <units>

a sub-header or something.. but i can't see what.
 
wow.. something is really screwy here ...


So i took my other 2 mods and combined it along with the first post into 1 mod. Now none of the changes work - the changes that were previously in individual files (like unit upkeep in /defines and unit HP changes) are now defunct. Thal's 'balance' mods still work though.

I restarted the game multiple times, checked the 'box' in the mod browser many times off & on to somehow make it 'activate' (its glowing green, of course). it all SHOULD work... but doesn't... AHHHH :cry:

I checked the XML encryption and its "<?xml version="1.0" encoding="utf-8" ?>" (hey, i'm checking all things - i'm desperate ;)).


the file appears absolutely normal -i can't figure out whats wrong :(. Game is patched to the latest version. Doesn't explain though why thal's mods from '23rd dec work but not my latest ones with a few simple changes.


Here's the complete file:

Code:
<?xml version="1.0" encoding="utf-8"?>
<GameData>
	<Defines>
		<Update>
			<Set Value="15"/>
			<Where Name="MAX_HIT_POINTS"/>
		</Update>
		<Update>
			<Set Value="50"/>
			<Where Name="MAX_CITY_HIT_POINTS"/>
		</Update>
		<Update>
			<Set Value="2"/>
			<Where Name="CITY_HIT_POINTS_HEALED_PER_TURN"/>
		</Update>
		<Update>
			<Where Name="UNIT_MAINTENANCE_GAME_MULTIPLIER" />
			<Set Value="5" />
		</Update>
		<Update>
			<Where Name="UNIT_MAINTENANCE_GAME_EXPONENT_DIVISOR" />
			<Set Value="10" />
		</Update>
	</Defines>
	<Units>
		<Update>
			<Where Class="UNITCLASS_MECH"/>
			<Set Combat="100"/>
		</Update>
	</Units>
	<Unit_ResourceQuantityRequirements>
		<Row>
			<UnitType>UNIT_MECHANIZED_INFANTRY</UnitType>
			<ResourceType>RESOURCE_IRON</ResourceType>
		</Row>
	</Unit_ResourceQuantityRequirements>
	
  
</GameData>


Note that everything except the last two changes work in their 'seperate' mod files.

Any ideas?
 
The file looks fine to me. So let's look outside the file:

1> Are you doing OnModActivated / UpdateDatabase in the Actions tab?
2> Do you have the filename right, including path?
3> Do you have "import to VFS" set in that XML file's Properties? (Correct answer is NO)
4> You said that moving the other files' contents into this file caused them not to work. Have you tried the reverse, moving the unit changes into some other file? I had something similar happen after the December patch. Several of my XML files, mainly the TXT_KEY ones, seemed to stop working for no reason; it seems that the mod, somehow, was picking up a several-month-old version of the XML file instead of using the most recent one. Moving the updates into a different filename made them work correctly.
 
1) hmm.. not sure what ya mean. I do the changes in mod-buddy, save/build mod, and then verify the changes in the exported file and make sure its in the 'mod' folder in the game

2) didn't change anything after exporting it from modbuddy, so i guess

3) nope

4) using text editor u mean? yep. unless u mean create a new text file - copy stuff in there, then save as xml, then no. I did notice when starting modbuddy twice that some 'update' or some thing showed up - i clicked it away. And now it won't pop up again - maybe i should of installed that. still odd though that the old mods work

so how did you fix your problem? or you just continue to copy all changes into 'old' files?
 
1> When you make an XML change in ModBuddy, it won't actually DO anything until you activate the XML file in question. Just having it be part of the mod file isn't enough; yes, it'll be copied to the destination directory during the build, but the game won't do anything with the file unless you do this.
To activate XML, you need to go into the Mod's properties window, to the Actions tab, and create a new row.
For the "Set" column, type "OnModActivated"
For the "Type" column, type "UpdateDatabase"
For the "FileName" column, type the name of the file (including any paths relative to the mod's base directory).
Do one row like this for each new XML gamedata file you've added. (Do not do it for non-database XML files, those need the VFS flag instead.)
If you haven't been doing this, then no XML mod will ever work. If you have, then move to the next one:

4> What I meant was, create a different XML file. Move the updates in question into that new file. Activate that one. See if it works. The fact that you said other things had worked before moving them into this file implies that it might be tied to the file itself. (Again, this is a known bug from the December patch.) So try moving everything out of that file into different ones, and see what happens.
 
Thanks spatzi!

That was the problem. Everything works now.


I feel so dumb for not knowing that :(.
 
Back
Top Bottom