• Mods are now organized as resources. Use the Mods link above to browse for or submit a mod, tool, or prefab.

    The TFP Official Modding Forum Policy establishes the rules and guidelines for mod creators and mod users.

Feature or bug of the xpath SET command?

seven

Community Moderator
I've not seen using the SET command in this way documented anywhere so I wonder if it's intended, or something I should avoid. Am I blind and just haven't seen it?


An example, say I want to change the warming effect of a cup of coffee so it gives 10 warming for 5 minutes.

I could use 5 individual SET commands like this (not tested so don't actually know if these are valid xpaths)

Code:
<set xpath="/items/item[@name='drinkJarCoffee']/effect_group[@name='Drink Tier 1']/display_value[@name='dHypothermalResist']/@value">10</set>
<set xpath="/items/item[@name='drinkJarCoffee']/effect_group[@name='Drink Tier 1']/display_value[@name='dDuration']/@value">300</set>
<set xpath="/items/item[@name='drinkJarCoffee']/effect_group[@name='Drink Tier 1']/triggered_effect[@operation='add']/@value">303</set>
<set xpath="/items/item[@name='drinkJarCoffee']/effect_group[@name='Drink Tier 1']/triggered_effect[@operation='set']/@value">903</set>
<set xpath="/items/item[@name='drinkJarCoffee']/effect_group[@name='Drink Tier 1']/triggered_effect/requirement/@value">903</set>


Or, I could just use the SET command this way and replace that entire effect group block. I could probably use the remove and append to do the same thing, but this is one step. I think this is easier to read, and less prone to mistakes than the individual SETs and so I've done some things this way.


Code:
<set xpath="/items/item[@name='drinkJarCoffee']/effect_group[@name='Drink Tier 1']">
   <requirement name="!HasBuff" buff="buffIsOnFire"/>
   <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$waterAmountAdd" operation="add" value="24"/>
   <display_value name="dStaminaRegen" value=".2"/>
   <display_value name="dHypothermalResist" value="8"/>
   <display_value name="dDuration" value="300"/>
   <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$buffCoffeeDuration" operation="add" value="303"/>
   <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$buffCoffeeDuration" operation="set" value="903">
      <requirement name="CVarCompare" cvar="$buffCoffeeDuration" operation="GT" value="903"/></triggered_effect>
   <triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff" buff="buffProcessConsumables,buffCoffee"/>
</set>
 
Back
Top