Need a little help with simple mod that adds an equipment mod

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

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

Post Reply
User avatar
Takiro Ryo
Posts: 5
Joined: Sat, 5. Sep 20, 12:33
x4

Need a little help with simple mod that adds an equipment mod

Post by Takiro Ryo » Wed, 9. Sep 20, 19:56

I'm just creating my fist mod. I want to add a new equipment mod to the game.
I'm done creating the files and it seems like the mod is loaded correctly. The debug log shows no errors except for missing file signatures. Still I can't get the equipment mod to show up on ingame.
Here are my files:

wares.xml

Code: Select all

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

<diff  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <add sel="//wares">
    <ware id="mod_weapon_reload_01_mk3_custom" name="Reload Mod MK3" description="{20110,100022}" shortname="Reload Mod MK3" transport="inventory" volume="1" tags="crafting equipmentmod">
      <price min="1" average="1" max="1" />
      <production time="10" amount="1" method="default" name="{20206,101}">
        <primary>
          <ware ware="modpart_highenergycatalyst" amount="3" />
          <ware ware="modpart_tuningsoftware" amount="1" />
          <ware ware="modpart_weaponchamber_t3" amount="1" />
        </primary>
        <research>
          <ware ware="research_mod_weapon_mk3" />
        </research>
      </production>
    </ware>
  </add>
</diff>
and equipmentmods.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <add sel="//equipmentmods/weapon">
    <reload ware="mod_weapon_reload_01_mk3_custom" quality="3" min="1.5" max="3.0">
      <bonus chance="1.0" max="3">
        <damage min="1.062" max="1.3" weight="3"/>
        <lifetime min="1.1" max="1.3" weight="2"/>
        <speed min="1.1" max="1.15" weight="1"/>
      </bonus>
    </reload>
  </add>
</diff>

Bluerealis
Posts: 5
Joined: Sun, 2. Jun 13, 02:55
x4

Re: Need a little help with simple mod that adds an equipment mod

Post by Bluerealis » Thu, 10. Sep 20, 09:30

Try changing your selector to use just one '/', like this:

Code: Select all

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

Code: Select all

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

User avatar
Takiro Ryo
Posts: 5
Joined: Sat, 5. Sep 20, 12:33
x4

Re: Need a little help with simple mod that adds an equipment mod

Post by Takiro Ryo » Thu, 10. Sep 20, 10:59

That didn't do the trick unfortunately.

I looked further into it and on inspecting the savegame and x4ep1_mentor_subscription.xml I found that the blueprints have to be added to the player inventory.
I'm currently trying to figure out how to do this, maybe that fixes the problem already.

User avatar
Takiro Ryo
Posts: 5
Joined: Sat, 5. Sep 20, 12:33
x4

Re: Need a little help with simple mod that adds an equipment mod

Post by Takiro Ryo » Thu, 10. Sep 20, 13:58

So, the issue was really the missing blueprint/iventory ware.

This simple md script fixed the issue already

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<mdscript name="ReloadModMk3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>
    <cue name="UnlockCustomEquipmentMods">
      <conditions>
          <check_any>
            <event_cue_signalled cue="md.Setup.GameStart"/>
            <event_player_created/>
            <event_cue_signalled/>
          </check_any>
        </conditions>
      <actions>
        <do_all>
          <show_help duration="10s" custom="'Reload Mod Mk3 enabled.'"/>
          <add_encyclopedia_entry item="ware.mod_weapon_reload_01_mk3_custom.id" type="equipmentmods"/>
          <add_blueprints wares="ware.mod_weapon_reload_01_mk3_custom"/>
        </do_all>
      </actions>
    </cue>
  </cues>
</mdscript>
Now I only have to find out how to check for the player having the needed research already completed.

z1ppeh
Posts: 533
Joined: Sat, 8. May 04, 21:19
x4

Re: Need a little help with simple mod that adds an equipment mod

Post by z1ppeh » Mon, 5. Oct 20, 20:34

create your mod in equipmentmods.xml

then use something akin to this for your wares.xml:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<wares>
  <ware id="testweaponmod1" name="testmod1" description="testmod1" shortname="testmod1" transport="inventory" volume="1" tags="crafting equipmentmod">
    <price min="1" average="1" max="1" />
    <production time="10" amount="1" method="default" name="{20206,101}">
      <primary>
        <ware ware="modpart_highenergycatalyst" amount="1" />
        <ware ware="modpart_tuningsoftware" amount="1" />
        <ware ware="modpart_weaponchamber_t1" amount="1" />
      </primary>
      <research>
        <ware ware="research_mod_weapon_mk1" />
      </research>
    </production>
  </ware>
</wares>

Adjust the research to whatever you want it to be... once research is done the equipment mod will show up.

Post Reply

Return to “X4: Foundations - Scripts and Modding”