Jump to content

Help Code


Gargioss

Recommended Posts

Hello, I ask for help for a mod xpath code, example of original code of the simplified "campfire":

 

part of the original code: <block name="campfire">

 

<drop event="Destroy" count="0"/>

<property name="Stacknumber" value="1"/>

 

final results:

 

<drop event="Destroy" name="campfire" count="1"/>

<property name="Stacknumber" value="5"/>

_______________________________________

 

I have already tried several solutions using the commands:

<remove>, <setattribute> and <append>

but the results lead to error.

 

It works only <set> on "Stacknumber".

 

But it works only if I remove the whole code and I hang the new modified code.

 

it is the only solution ?

Thank you and Happy Holidays to all.

Link to comment
Share on other sites

This is what you are looking for. Altered from my workbench modlet to change the campfire instead I use this in my full convertion. definitely works. :-)

<!-- Delete and insert drop event -->
<remove xpath="/blocks/block[@name='campfire']/drop[@event='Destroy']"/>
<insertBefore xpath="/blocks/block[@name='campfire']/drop[@event='Fall']">
   <drop event="Destroy" name="campfire" count="1"/>
</insertBefore>
<!-- resize stack -->
<set xpath="/blocks/block[@name='campfire']/property[@name='Stacknumber']/@value">5</set>

 

PS: you don't need to use insert before. append will work fine. I just prefer insert before for the accuracy.

Link to comment
Share on other sites

You can also use the SetAttribute to add the information

 

<setattribute xpath="/blocks/block[@name='campfire']/drop" name="name">campfire</setattribute>
<set xpath="/blocks/block[@name='campfire']/property[@name='Stacknumber']/@value">5</set>
<set xpath="/blocks/block[@name='campfire']/drop/@count">1</set>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...