Adding a tag to a Macro

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

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

Post Reply
bhorton22
Posts: 7
Joined: Sun, 29. Aug 10, 22:30
x4

Adding a tag to a Macro

Post by bhorton22 » Sat, 27. Jan 24, 02:27

I am trying to add the tag 'influencelist="medium_drive_disrupt' to the macro 'bullet_pir_turret_m_battleship_01_gatling_01_mk1_macro'. The orginal macro looks like this:

<?xml version="1.0" encoding="utf-8"?>
<!--Exported by: nick (192.168.3.123) at 02.09.2021_15-21-12-->
<macros>
<macro name="bullet_pir_turret_m_battleship_01_gatling_01_mk1_macro" class="bullet">
<component ref="bullet_gen_m_gatling_01_mk1" />
<properties>
<ammunition value="15" reload="1" />
<bullet speed="3221.1" lifetime="2.863" amount="1" barrelamount="2" icon="weapon_gatling_mk1" timediff="0.025" angle="0.43" maxhits="2" ricochet="0.01" restitution="0.3" scale="0" attach="0">
<damagecurves>
<time>
<point position="0.2" value="1" />
<point position="0.5" value="0.8" />
<point position="1" value="0.1" />
</time>
<distance>
<point position="0.2" value="1" />
<point position="0.5" value="0.7" />
<point position="1" value="0.1" />
</distance>
</damagecurves>
</bullet>
<reload rate="8" />
<damage value="26" repair="0" />
<effects>
<impact ref="impact_gen_s_gatling_01_mk1" inside="impact_gen_s_gatling_01_mk1_inside" />
<bigobjectimpact ref="impact_gen_s_gatling_01_mk1_bigobject" inside="impact_gen_s_gatling_01_mk1_bigobject_inside" />
<launch ref="muzzle_turret_gen_m_gatling_01_mk1" />
</effects>
<weapon system="turret_shortrange" />
</properties>
</macro>
</macros>

I want it to look like this:

<macros>
<macro name="bullet_pir_turret_m_battleship_01_gatling_01_mk1_macro" class="bullet">
<component ref="bullet_gen_m_gatling_01_mk1" />
<properties>
<ammunition value="15" reload="1" />
<bullet speed="3221.1" lifetime="2.863" amount="1" barrelamount="2" icon="weapon_gatling_mk1" timediff="0.025" angle="0.43" maxhits="2" ricochet="0.01" restitution="0.3" scale="0" attach="0" influencelist="medium_drive_disrupt">
<damagecurves>
<time>
<point position="0.2" value="1" />
<point position="0.5" value="0.8" />
<point position="1" value="0.1" />
</time>
<distance>
<point position="0.2" value="1" />
<point position="0.5" value="0.7" />
<point position="1" value="0.1" />
</distance>
</damagecurves>
</bullet>
<reload rate="8" />
<damage value="26" repair="0" />
<effects>
<impact ref="impact_gen_s_gatling_01_mk1" inside="impact_gen_s_gatling_01_mk1_inside" />
<bigobjectimpact ref="impact_gen_s_gatling_01_mk1_bigobject" inside="impact_gen_s_gatling_01_mk1_bigobject_inside" />
<launch ref="muzzle_turret_gen_m_gatling_01_mk1" />
</effects>
<weapon system="turret_shortrange" />
</properties>
</macro>
</macros>

I thought the following would do it:

<?xml version="1.0" encoding="utf-8"?>
<diff>
<add sel="//macros/macro/properties/bullet[@attach="0"]">influencelist="medium_drive_disrupt"</add>
</diff>

but that does not work. What am I missing?

sprIder
Posts: 93
Joined: Sat, 3. Jul 10, 23:23
x4

Re: Adding a tag to a Macro

Post by sprIder » Sat, 27. Jan 24, 13:23

Hi bhorton22,

there may be several reasons for this.

1. Did you set the dependency to the pirate dlc in your content.xml?
2. If you take a look at this patch tutorial: viewtopic.php?f=129&t=354310 you'll see, that you have to use e.g. ".." for the patch path and '...' for the value. Or the other way around:

Code: Select all

<add sel='//macros/macro/properties/bullet[@attach="0"]'>influencelist="medium_drive_disrupt"</add>
2a. Also in the first post:
theqmann wrote:
Sun, 24. Nov 13, 19:19

[...]

All of these will use this basic source file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <bar>
    <foo a="1"/>
    <foo a="2"/>
  </bar>
</root>
[...]

Add an attribute

Patch

Code: Select all

  <add sel="root/bar" type="@cat">3</add>
Result

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <bar cat="3">
    <foo a="1"/>
    <foo a="2"/>
  </bar>
</root>
To summarize, it should therefore be as follows for you:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<add sel="//macros/macro/properties/bullet" type="@influencelist>medium_drive_disrupt</add>
</diff>
I hope this works and helps you.

bhorton22
Posts: 7
Joined: Sun, 29. Aug 10, 22:30
x4

Re: Adding a tag to a Macro

Post by bhorton22 » Thu, 11. Apr 24, 23:10

Thank You. That worked.

Post Reply

Return to “X4: Foundations - Scripts and Modding”