Replace in XML not working?!?

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
kackdichan
Posts: 7
Joined: Mon, 20. Jul 20, 17:02
x4

Replace in XML not working?!?

Post by kackdichan » Tue, 21. Jul 20, 17:38

I want to change a weapon from Split DLC.

I did a folder extensions/smu, added a content.xml file and created the folder:
assets\props\WeaponSystems\heavy\macros\weapon_spl_s_sticky_01_mk2_macro.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?> 
<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<replace sel="macros/macro/properties">
	<identification name="{20105,2354}" basename="{20105,2351}" shortname="{20105,2355}" description="{20105,2352}" mk="2" />
      <bullet class="bullet_spl_m_sticky_01_mk2_macro" />
      <heat overheat="10000" cooldelay="0.13" coolrate="4000" reenable="9500" />
      <rotationspeed max="106.4" />
      <rotationacceleration max="53.2" />
      <reload />
      <hull max="1001" hittable="0" />
</replace>
</diff>
This code sould work. Of corse, I could go deeper to change the coolrate, but should be fine I think.

After taht I created the Cat / DAt file and started the game. No Change to the cool rate.

What did I do wrong?

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7411
Joined: Mon, 15. Dec 03, 18:53
x4

Re: Replace in XML not working?!?

Post by BlackRain » Tue, 21. Jul 20, 18:16

You forgot the /

<replace sel="/macros/macro/properties">

I didn't look at that file so i am not sure of the path but you need a slash in the beginning or a // depending

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: Replace in XML not working?!?

Post by UniTrader » Tue, 21. Jul 20, 18:21

also you forgot the encapsulating <properties>....</properties>

because now you replace

Code: Select all

<properties>
      <identification name="{20105,2354}" basename="{20105,2351}" shortname="{20105,2355}" description="{20105,2352}" mk="2" />
      <bullet class="bullet_spl_m_sticky_01_mk2_macro" />
      <heat overheat="10000" cooldelay="0.13" coolrate="1000" reenable="9500" />
      <rotationspeed max="106.4" />
      <rotationacceleration max="53.2" />
      <reload />
      <hull max="1001" hittable="0" />
</properties>
with just

Code: Select all

      <identification name="{20105,2354}" basename="{20105,2351}" shortname="{20105,2355}" description="{20105,2352}" mk="2" />
      <bullet class="bullet_spl_m_sticky_01_mk2_macro" />
      <heat overheat="10000" cooldelay="0.13" coolrate="4000" reenable="9500" />
      <rotationspeed max="106.4" />
      <rotationacceleration max="53.2" />
      <reload />
      <hull max="1001" hittable="0" />

PS you should make your changes more atomic. if you just change the cool rate a

Code: Select all

<replace sel="//properties/heat/@coolrate">4000</replace>
is enough. no need to replace the whole properties node.



PS 2
Your File Path is also incomplete. Since this Weapon is a new File inside the Split DLC the diff file path in your mod should be in this case

Code: Select all

extensions\ego_dlc_split\assets\props\WeaponSystems\heavy\macros\weapon_spl_s_sticky_01_mk2_macro.xml 
(your path would be correct if the file in the DLC was a diff file changing something in the original game though)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

kackdichan
Posts: 7
Joined: Mon, 20. Jul 20, 17:02
x4

Re: Replace in XML not working?!?

Post by kackdichan » Tue, 21. Jul 20, 19:12

thx did work

Post Reply

Return to “X4: Foundations - Scripts and Modding”