• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Video Tutorial : XPath Modding for Beginners.

Please sticky.

Heck, as a general rule, any tutorial that shows people how to use the modding tools, should be sticky. It's only the ones that show people how to do specific mods, that should remain in the thread.

 
Buggi - it really is an excellent video. I would give it a 10 except for two things:

1. In the first part, in describing append, (using polymers for stonearrows) you don't mention if the new stone arrow recipe REPLACES existing feathered stone arrows - or if this adds another instance. (Can you tell I am a noob? cuz I don't know. Easy to figure out - but would have been nice if you mentioned.)

2. How do you get these new mods to work? Do they go into a special folder, etc.? Again, I have no doubt this is easy to figure out - but would have been nice in the video.

Thank you!

For anyone else needing answer #2: Sphereii's 1st post in XPath Modding Explanation Thread explains this.

 
Last edited by a moderator:
I have a video explaining how to install mods.

Also, why was this removed from sticky-hood?

 
Huh. Looks like everything was unstickied. My guess is he'll be indexing and making one link post, since this thread had more stickies than non stickies. :)

 
hey Buggi, I thought the video was great. I tried to follow your instructions with a simple modlet I created to increase walking and running speed but I get a syntax error. I already have a post asking for help and pasted in the code, didn't want to tie up your thread here. if you have any suggestions please let me know. The other modlet I created worked fine.

 
Can you help me with localization? I made cooking peas turn into boiled peas. I copied the localization for foodcanPeas and changed it to my mod foodCanPeasCooked. It didn't work. The name does not show up as Boiled Peas and there is no description. I don't really care about translations or description but I really want the name to show up.

foodCanPeasCooked,items,Food,KgNone,Boiled Peas,Conserve de petits pois,Dose Erbsen,,Lata de guisantes,

foodCanPeasCookedDesc,items,Food,EnChanged,No more food poisoning

Your tutorial was very helpful.

Any help will be much appreciated, thank you for you time. :smile-new:

Solved the problem without localization, just named the items what I want them to show up as. Much easier.

I would like to have a description if possible.

Now I have another issue. I'm trying to increase the risk of food poisoning on can food items. I followed your tutorial but I must have something wrong. Can't figure out what it is. This is what I did. The middle part is all one line in the file.

<FoodPoisoning>

<setattribute xpath="/items/item[@name 'foodCanBeef']/property[@name=FoodPoisoningRisk]/@value">.25</setattribute>

</FoodPoisoning>

Again thank you for your time.

 
Last edited by a moderator:
As far as I know what you are changing in items is only the display value. What is displayed on the HUD.

You need to change the "buffIllFoodPoisoning0" in buffs but doing that would change everything that calls for the buff, not just canned food. A better way might be to add another buff, then have all canned foods call your new buff.

 
As far as I know what you are changing in items is only the display value. What is displayed on the HUD.
You need to change the "buffIllFoodPoisoning0" in buffs but doing that would change everything that calls for the buff, not just canned food. A better way might be to add another buff, then have all canned foods call your new buff.
It's not even changing the display value so something is wrong. Not sure how to create a new buff.

 
It's not even changing the display value so something is wrong. Not sure how to create a new buff.
I have a headache today and can't see clearly but this should be close to what you want I think

Code:
<configs>
<set xpath="/items/item[@name='foodCanBeef']/effect_group[@tiered='false']/triggered_effect[@trigger='onSelfPrimaryActionEnd'][@buff='buffIllFoodPoisoning0']/requirement[@name='RandomRoll']/@value">25</set>


<set xpath="/items/item[@name='foodCanBeef']/effect_group/display_value[@name='FoodPoisoningRisk']/@value">0.25</set>
</configs>
I think this is set to 25% chance of infection.

This should insert a new buff. (Only the buff name was changed to "buffIllFoodPoisoning3" from "buffIllFoodPoisoning0"

Code:
<insertAfter xpath="/buffs/buff[@name='buffIllFoodPoisoning2']">
   <buff name="buffIllFoodPoisoning3 hidden="true">
       <damage_type value="Disease"/>
       <stack_type value="ignore"/>
       <duration value="90"/>
       <effect_group>
           <triggered_effect trigger="onSelfBuffFinish" action="AddBuff" target="self" buff="buffIllFoodPoisoning1">
               <requirement name="RandomRoll" seed_type="Random" target="self" min_max="0,100" operation="LTE" value="@$illnessChance"/>
           </triggered_effect>


           <triggered_effect trigger="onSelfBuffStart" action="AddBuff" target="self" buff="buffIllnessIndicatorTrigger"/>
           <triggered_effect trigger="onSelfBuffRemove" action="AddBuff" target="self" buff="buffIllnessIndicatorTrigger"/>
       </effect_group>
   </buff>
</insertAfter>
 
Last edited by a moderator:
In your "insertAfter" there's an error.

Code:
<buff name="buffIllFoodPoisoning3 hidden="true">
You're missing a " after the buff name.

 
I don't know what I'm doing wrong.

I want to change all zombie sounds to this new one. The growling noises give me nightmares so I currently don't play with zombies on.

I get this message when loading:

WRN xml patch for "sounds.xml" from mod "ChangeZombieSounds" did not apply

<set xpath="/sounds/SoundDataNode[@name=zombieArlene]/AudioSource[@name=Sounds/AudioSource]"

The zombie I am working with is now silent and I get a message every time the zombie would be making a sound:

AudioManager::AudioData::Play() failed to load audio clip #@modfolder(ChangeZombieSounds):resources/ChangeSounds.unity3d?ZombieSounds

In unity Parent object is ChangeSounds, child object is ZombieSounds and has ZombieSounds.wav attached to it. That was built into ChangeSounds.unity3d and is in my resources folder.

Now for the code:

sounds.xml

<append xpath="/Sounds">

<SoundDataNode name="ZombieSounds">

<AudioSource name="Sounds/AudioSource_Pain"/>

<Noise ID="1" range="1" volume="7" time="3" muffled_when_crouched="0.5"/>

<AudioClip ClipName="#@modfolder:resources/ChangeSounds.unity3d?ZombieSounds"/>

<Channel name="Mouth"/>

<Priority name="2"/>

<maxVoicesPerEntity value="1"/>

<LocalCrouchVolumeScale value="1.0"/>

<CrouchNoiseScale value="0.5"/>

<NoiseScale value="1"/>

<MaxVoices value="10"/>

<MaxRepeatRate value="0.9"/>

</SoundDataNode>

</append>

<set xpath="/sounds/SoundDataNode[@name=zombieArlene]/AudioSource[@name=Sounds/AudioSource]">ZombieSounds</set>

----------------------------------------------------------------------------------------------------------------------------

entityclasses.xml

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundRandom' and @value='Enemies/Base_Zombie_Female/zombiefemaleroam]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundAlert' and @value='Enemies/Base_Zombie_Female/zombiefemalealert]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundAttack' and @value='Enemies/Base_Zombie_Female/zombiefemaleattack]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundHurt' and @value='Enemies/Base_Zombie_Female/zombiefemalepain]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundDeath' and @value='Enemies/Base_Zombie_Female/zombiefemaledeath]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundSense' and @value='Enemies/Base_Zombie_Female/zombiefemalesense]/@value">ZombieSounds</set>

 
Last edited by a moderator:
I don't know what I'm doing wrong. I want to change all zombie sounds to this new one. The growling noises give me nightmares so I currently don't play with zombies on.
Need help with blanket settings.

Got it working for zombies on an individual basis with this:

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundRandom' and @value='Enemies/Base_Zombie_Female/zombiefemaleroam]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundAlert' and @value='Enemies/Base_Zombie_Female/zombiefemalealert]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundAttack' and @value='Enemies/Base_Zombie_Female/zombiefemaleattack]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundHurt' and @value='Enemies/Base_Zombie_Female/zombiefemalepain]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundDeath' and @value='Enemies/Base_Zombie_Female/zombiefemaledeath]/@value">ZombieSounds</set>

<set xpath="/entity_classes/entity_class[@name=zombieArlene]/property[@name=SoundSense' and @value='Enemies/Base_Zombie_Female/zombiefemalesense]/@value">ZombieSounds</set>

What I want to do is a blanket setting for anything containing zombie and sound to set to my ZombieSounds. Is that even possible.

I tried blanket setting with this for one of the sounds:

<set xpath="/entity_classes/entity_class[contains@name,'zombie']/property[@name=SoundRandom]/@value">ZombieSounds</set>




I don't get any errors when loading or warning while running, but it doesn't do anything. If I try to add the same format for the other sounds I get an error message.

 
Code:
<set xpath="/entity_classes/entity_class[contains[color=#ff0000]([/color]@name,'zombie'[color=#ff0000])[/color]]/property[@name='SoundRandom']/@value">ZombieSounds</set>
 
Code:
<set xpath="/entity_classes/entity_class[contains[color=#ff0000]([/color]@name,'zombie'[color=#ff0000])[/color]]/property[@name='SoundRandom']/@value">ZombieSounds</set>
Thank you, but it still doesn't do anything. currentconfigs shows nothing changed.

 
Thank you, but it still doesn't do anything. currentconfigs shows nothing changed.
Hey Winter, kind of learning XPath myself. I did find a way to change ALL ZOMBIE SOUNDS to a value:

<set xpath="/entity_classes/entity_class[contains(@name,'zombie')]/property[contains(@name,'Sound')]/@value">Enemies/Base_Zombie_Male/zombiemalealert</set>

ExportCurrentConfigs shows all Zombie Sounds modified.

I used the default base male zombie just to test with (and to avoid any possible errors with a new sound). You can replace with your "ZombieSounds".

It does generate 3 errors: ZombieBoe, zombiedogs and something else. I figured this at least gets you going.

Hope it helps.

 
Back
Top