Jump to content
Sign in to follow this  
Buggi

Video Tutorial : XPath Modding in A17 for Beginners.

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Edited by Quantum Blue (see edit history)

Share this post


Link to post
Share on other sites

I have a video explaining how to install mods.

 

Also, why was this removed from sticky-hood?

Share this post


Link to post
Share on other sites

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. :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Edited by Winterhart
add info (see edit history)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

 

<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"

 

<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>

Edited by DukeW74 (see edit history)

Share this post


Link to post
Share on other sites

In your "insertAfter" there's an error.

 

<buff name="buffIllFoodPoisoning3 hidden="true">

 

You're missing a " after the buff name.

Share this post


Link to post
Share on other sites

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>

Edited by Winterhart
rewrite post (see edit history)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
<set xpath="/entity_classes/entity_class[contains[color=#ff0000]([/color]@name,'zombie'[color=#ff0000])[/color]]/property[@name='SoundRandom']/@value">ZombieSounds</set>

Share this post


Link to post
Share on other sites
<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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

extra content at end of line 7

 

thanks, i think i am doing this right. I made admin tools and then an admin starter kit. I think i appended this to the entity classes right but notepadd++ keeps saying the middle xpath has extra content at the end of line 7.

 

 

<?xml version="1.0" encoding="UTF-8"?>

<DWModsAdminMod>

<set xpath="/entity_classes/entity_class/[@name="playerMale"]/property[@name="ItemsOnEnterGame.GameModeSurvival" ]/@valueadminsuperbag</set>
<set xpath="/entity_classes/entity_class/[@name="playerMale"]/property[@name="ItemsOnEnterGame.GameModeSurvivalSP" ]/@valueadminsuperbag</set>
<set xpath="/entity_classes/entity_class/[@name="playerMale"]/property[@name="ItemsOnEnterGame.GameModeSurvivalMP" ]/@valueadminsuperbag</set>

</DWModsAdminMod>

 

 

ooh i fixed it, i used double quote where i should have used single.

 


<DWModsAdminMod>

<set xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='ItemsOnEnterGame.GameModeSurvival']/@value">adminsuperbag</set>
<set xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='ItemsOnEnterGame.GameModeSurvivalSP']/@value">adminsuperbag</set>
<set xpath="/entity_classes/entity_class[@name='playerMale']/property[@name='ItemsOnEnterGame.GameModeSurvivalMP']/@value">adminsuperbag</set>

</DWModsAdminMod>

 

 

thank you so very much for your video

Edited by SlicksGirl (see edit history)

Share this post


Link to post
Share on other sites

so i've run into a snag with running <append xpath=/lootcontainer>

 

it is not recognizing items in the loot list, even vanilla items copied over exactly from the vanilla files.

 

i'm trying to make this starter bag by Valmod https://7daystodie.com/forums/showthread.php?31157-Survivor-s-Pack-Starting-Gear&highlight=starter+pack and everything else loads and parses perfectly, except the loot in the lootlists on the lootcontainer page.

 

any Ideas?

 

 

<?xml version="1.0" encoding="UTF-8"?>

<DWModsAdminMod>

<append xpath="/lootcontainers">


<!--small Loot-->

<lootgroup name="adminCoin" count="all">
    <item group="meleeBoneShiv" count="4"/>
   <item group="modArmorTripleStoragePocket" count="4"/>
   <item group="cntSecureStorageChest" count="4"/>	
</lootgroup>

 

its saying the boneshive doesnt exist. i swapped out casinocoins for a boneshive in case my admin coins that extended the casino coins were the issue.

 

thanks for your help

Edited by SlicksGirl (see edit history)

Share this post


Link to post
Share on other sites

Do you have an item group named meleeBoneShiv ?

 

 

I am assuming you want

 

 

<lootgroup name="adminCoin" count="all">
   <item name="meleeBoneShiv" count="4"/>
   <item name="modArmorTripleStoragePocket" count="4"/>
   <item name="cntSecureStorageChest" count="4"/>    
</lootgroup>

Share this post


Link to post
Share on other sites
Do you have an item group named meleeBoneShiv ?

 

 

I am assuming you want

 

 

<lootgroup name="adminCoin" count="all">
   <item name="meleeBoneShiv" count="4"/>
   <item name="modArmorTripleStoragePocket" count="4"/>
   <item name="cntSecureStorageChest" count="4"/>    
</lootgroup>

 

i fixed that error several hour ago. Thanks!

 

though its still bugged, cant get it to spawn the loot when i break the first container. and most container models completely break the game when used. but I've been up doing coding and manual labor for 24 hours straight now. So i'll try to tackle the refusal to spawn loot issue tomorrow.

Share this post


Link to post
Share on other sites

May I suggest you get this mod and make it do what you want. Most of the legwork is already done for you, unless you are just trying to learn.

 

Here

 

 

I think it is a good practice when working with loot to use insertAfter and Before. loot can be tricky sometimes.

 

This will insert after the last vanilla group and then after the last vanilla container, I used "249". I think 250 is max

<configs>
<insertAfter xpath="/lootcontainers/lootgroup[@name='BuriedStashChest']">
<lootgroup name="adminCoin" count="all">
   <item name="meleeBoneShiv" count="4"/>
   <item name="modArmorTripleStoragePocket" count="4"/>
   <item name="cntSecureStorageChest" count="4"/>  
</lootgroup>
</insertAfter>


<insertAfter xpath="/lootcontainers/lootcontainer[@id='116']">


<lootcontainer id="249" count="1" size="8,9" sound_open="UseActions/open_cardboard" sound_close="UseActions/close_cardboard" loot_quality_template="treasureTemplate" destroy_on_close="true">
<item group="adminCoin"/>
</lootcontainer>
</insertAfter>
</configs>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...