Rusty and generally unskilled in XML

ante185

Chieftain
Joined
Oct 27, 2013
Messages
56
so i got this little snippet of code here, and something is wrong as the changes do not occur, i think it's in the <where> tag i fail
PHP:
<GameData>
	<Units>
		<Update>
			<Where>
				<UnitType>UNIT_EXPLORER</UnitType>
			</Where>
			<Set>
				<Combat>5</Combat>
			</Set>
		</Update>
		<Update>
			<Where>
				<UnitClass>UNITCLASS_MARINE</UnitClass>
			</Where>
			<Set>
				<PrereqTech>TECH_CHEMISTRY</PrereqTech>
			</Set>
		</Update>
	</Units>
</GameData>
 
I don't know if Where and Set can have childs. Normally their "arguments" are set as attributes of the xml node

Could you test it like this?

HTML:
<GameData> 
    <Units> 
        <Update> 
            <Set Combat="5" /> 
	    <Where UnitType="UNIT_EXPLORER"/> 
            </Set> 
        </Update> 
	<Update> 
            <Set PrereqTech="TECH_CHEMISTRY" />
            <Where UnitClass="UNITCLASS_MARINE"/> 
            </Set> 
        </Update> 
    </Units> 
</GameData>

Also make sure to update the corresponding databases
 
Tried that, no change, i did remove the excess </set> tags you left there tho.
I've attached it here
 

Attachments

  • Scouts And Soldiers (v 1).rar
    15.4 KB · Views: 60
In the attachment, you changed it to the alternate syntax correctly (miguelferreira had it wrong), but your first one would have worked too. However, the Units table doesn't have a "UnitType" column; it's "Type."
Code:
	<Units>
		<Update>
			<Set Combat="5" />
			<Where Type="UNIT_EXPLORER"/>
		</Update>
		<Update>
			<Set PrereqTech="TECH_CHEMISTRY" />
			<Where Type="UNIT_MARINE"/>
		</Update>
	</Units>

Note I changed the second Where to reference Type rather than Class. That would have worked, but then it would have applied to the Alien Wolf Beetle too, which you don't want.
 
Thanks Nutty!
Edit: while we're on it where do i find the subtechs/leafs for the techs/branches?
 
They are just regular techs with the LeafTech boolean set to true; that is, they include

Code:
<LeafTech>True</LeafTech>

in the XML.

You'll also want to set up a TechnologyConnections table like so:

Code:
<Technology_Connections>
  <Row>
    <FirstTech>YOUR_LEAF_TECH</FirstTech>
    <SecondTech>YOUR_MAJOR_TECH</SecondTech>
  </Row>
</Technology_Connections>

So that the player has to research the major tech your leaf tech is attached to first.
 
Top Bottom