Buyable weapon modification parts - need help
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
Buyable weapon modification parts - need help
Hello Guys!
I am trying to create a mod in which you could buy weapon modification parts at the Ship Equipment Vendor traders. The problem is I cannot figure out where that information is stored, which wares a Ship Equipment Vendor has.
Anybody could help me out please?
I am trying to create a mod in which you could buy weapon modification parts at the Ship Equipment Vendor traders. The problem is I cannot figure out where that information is stored, which wares a Ship Equipment Vendor has.
Anybody could help me out please?
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
the file is called md/Setup.xml (i assume you already extracted the Game)
note that the actions performed there will only be executed on the start of a new Game, so changes there only work in this file. i suggest altering the List in a seperate MD Script with roughly this content:
exact values of the append_to_list have to be looked up - i just put in some filler stuff there..
note that the actions performed there will only be executed on the start of a new Game, so changes there only work in this file. i suggest altering the List in a seperate MD Script with roughly this content:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="KopiG_Personal_cues" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="AddModPartsToTraders">
<conditions>
<check_any>
<event_game_loaded/>
<event_cue_completed cue="md.Setup.Start"/>
</check_any>
</conditions>
<actions>
<append_to_list list="md.$ShipTechLists.{1}" exact="[ware.***MOD_PART_WARE*****, 3, 6, 50]"/>
</actions>
</cue>
</cues>
</mdscript>
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
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

-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
So I have created it in those locations with this content:
md\addWeaponPartsToTrader.xml
I enabled my mod and loaded up the game but it does not work 
The way I tested it is that I contacted a vendor in space and asked for a trade. Or do I have to dock for this to work?
md\addWeaponPartsToTrader.xml
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="KopiG_Personal_cues" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="AddWeaponModPartsToTraders">
<conditions>
<check_any>
<event_game_loaded/>
<event_cue_completed cue="md.Setup.Start"/>
</check_any>
</conditions>
<actions>
<append_to_list list="md.$ShipTechLists.{1}" exact="[ware.inv_weaponmodpart_t1, 3, 6, 100]"/>
<append_to_list list="md.$ShipTechLists.{1}" exact="[ware.inv_weaponmodpart_t2, 3, 6, 100]"/>
<append_to_list list="md.$ShipTechLists.{1}" exact="[ware.inv_weaponmodpart_t3, 3, 6, 100]"/>
</actions>
</cue>
</cues>
</mdscript>

The way I tested it is that I contacted a vendor in space and asked for a trade. Or do I have to dock for this to work?
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
strude posted some code here that does something similar:
http://forum.egosoft.com/viewtopic.php? ... 50#4596750
Maybe you'll have to go through variables as well? Although adding in lists directly should be possible, I would have thought.
http://forum.egosoft.com/viewtopic.php? ... 50#4596750
Maybe you'll have to go through variables as well? Although adding in lists directly should be possible, I would have thought.
-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
Yeah I will try the variable way because it just doesnt work 
EDIT: This does not work either
Btw my I only have the content.xml file. No other files in the mod.
I took the ids from Roguey's site:
http://roguey.co.uk/xrebirth/wares/ware-135/

EDIT: This does not work either

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="KopiG_Personal_cues" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="AddWeaponModPartsToTraders">
<conditions>
<check_any>
<event_game_loaded/>
<event_cue_completed cue="md.Setup.Start"/>
</check_any>
</conditions>
<actions>
<set_value name="$weaponModPartT1" exact="[ware.inv_weaponmodpart_t1, 3, 6, 100]" />
<set_value name="$weaponModPartT2" exact="[ware.inv_weaponmodpart_t1, 3, 6, 100]" />
<set_value name="$weaponModPartT3" exact="[ware.inv_weaponmodpart_t1, 3, 6, 100]" />
<append_to_list list="md.$ShipTechLists.{1}" exact="$weaponModPartT1"/>
<append_to_list list="md.$ShipTechLists.{1}" exact="$weaponModPartT2"/>
<append_to_list list="md.$ShipTechLists.{1}" exact="$weaponModPartT3"/>
</actions>
</cue>
</cues>
</mdscript>
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<content id="1.0" name="Buyable Weapon Mod Parts" description="You can buy Weapon Modification Party at the Ship Equipment Vendor" author="KopiG" version="1.0" save="false">
</content>
http://roguey.co.uk/xrebirth/wares/ware-135/
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
did you switch Zones after loading to create new NPCs? their Inventory is only set on their creation upon switching Zone context.
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
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

-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
Please try this one and post the resulting logfile:
also keep in mind that in this form the Script is only executed once per Save/gamestart and changes made after that are not recognized.
Info on how to enable and find the debug log here:
https://www.egosoft.com:8444/confluence ... d=30113934
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="KopiG_Personal_cues" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="AddWeaponModPartsToTraders">
<conditions>
<check_any>
<event_game_loaded/>
<event_cue_completed cue="md.Setup.Start"/>
</check_any>
</conditions>
<actions>
<debug_text filter="general" text="'Ware List Before:\n%1'.[ md.$ShipTechLists.{1} ]"/>
<set_value name="$weaponModPartT1" exact="[ware.inv_weaponmodpart_t1, 3, 6, 100]" />
<set_value name="$weaponModPartT2" exact="[ware.inv_weaponmodpart_t1, 3, 6, 100]" />
<set_value name="$weaponModPartT3" exact="[ware.inv_weaponmodpart_t1, 3, 6, 100]" />
<append_to_list list="md.$ShipTechLists.{1}" exact="$weaponModPartT1"/>
<append_to_list list="md.$ShipTechLists.{1}" exact="$weaponModPartT2"/>
<append_to_list list="md.$ShipTechLists.{1}" exact="$weaponModPartT3"/>
<debug_text filter="general" text="'Ware List After:\n%1'.[ md.$ShipTechLists.{1} ]"/>
</actions>
</cue>
</cues>
</mdscript>
also keep in mind that in this form the Script is only executed once per Save/gamestart and changes made after that are not recognized.
Info on how to enable and find the debug log here:
https://www.egosoft.com:8444/confluence ... d=30113934
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
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

-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
This is the file I used:
This is the log result:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="KopiG_Personal_cues" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="AddWeaponModPartsToTraders">
<conditions>
<check_any>
<event_game_loaded/>
<event_cue_completed cue="md.Setup.Start"/>
</check_any>
</conditions>
<actions>
<debug_text filter="general" text="'Ware List Before:\n%1'.[ md.$ShipTechLists.{1} ]"/>
<set_value name="$weaponModPartT1" exact="[ware.inv_weaponmodpart_t1, 3, 6, 100]" />
<set_value name="$weaponModPartT2" exact="[ware.inv_weaponmodpart_t2, 3, 6, 100]" />
<set_value name="$weaponModPartT3" exact="[ware.inv_weaponmodpart_t3, 3, 6, 100]" />
<append_to_list list="md.$ShipTechLists.{1}" exact="$weaponModPartT1"/>
<append_to_list list="md.$ShipTechLists.{1}" exact="$weaponModPartT2"/>
<append_to_list list="md.$ShipTechLists.{1}" exact="$weaponModPartT3"/>
<debug_text filter="general" text="'Ware List After:\n%1'.[ md.$ShipTechLists.{1} ]"/>
</actions>
</cue>
</cues>
</mdscript>
Code: Select all
Logfile started, time Sat Mar 12 16:17:56 2016
[General] 122842.65 ======================================
[=ERROR=] 122842.65 extensions\buyableWeapModParts\md\addWeaponPartsToTrader.xml(16): Required attribute 'name' is missing
[General] 122842.65 ======================================
[General] 122842.65 ======================================
[=ERROR=] 122842.65 extensions\buyableWeapModParts\md\addWeaponPartsToTrader.xml(16): append_to_list: Attribute list should not be used here
[General] 122842.65 ======================================
[General] 122842.65 ======================================
[=ERROR=] 122842.65 extensions\buyableWeapModParts\md\addWeaponPartsToTrader.xml(17): Required attribute 'name' is missing
[General] 122842.65 ======================================
[General] 122842.65 ======================================
[=ERROR=] 122842.65 extensions\buyableWeapModParts\md\addWeaponPartsToTrader.xml(17): append_to_list: Attribute list should not be used here
[General] 122842.65 ======================================
[General] 122842.65 ======================================
[=ERROR=] 122842.65 extensions\buyableWeapModParts\md\addWeaponPartsToTrader.xml(18): Required attribute 'name' is missing
[General] 122842.65 ======================================
[General] 122842.65 ======================================
[=ERROR=] 122842.65 extensions\buyableWeapModParts\md\addWeaponPartsToTrader.xml(18): append_to_list: Attribute list should not be used here
[General] 122842.65 ======================================
[General] 122865.08 ======================================
[=ERROR=] 122865.08 Error in AI script trade.performtraderun on entity 0xef3e: TradeID 1124: trade 390 Ore between Fedhelm and Integrative URV Forge failed with reasoncode 65536 (0x10000 - 0000000000000010000000000000000b)!
[General] 122865.08 ======================================
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
ah, my mistake.. the result Value / list where something has to be appended to is not list but name.. so basically changing all list= to name= and it should workKopiG wrote:[/code]
This is the log result:Code: Select all
Logfile started, time Sat Mar 12 16:17:56 2016 [General] 122842.65 ====================================== [=ERROR=] 122842.65 extensions\buyableWeapModParts\md\addWeaponPartsToTrader.xml(16): Required attribute 'name' is missing [General] 122842.65 ====================================== [General] 122842.65 ====================================== [=ERROR=] 122842.65 extensions\buyableWeapModParts\md\addWeaponPartsToTrader.xml(16): append_to_list: Attribute list should not be used here [General] 122842.65 ======================================

I still wonder why the added debug outpud doesnt appear..
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
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

-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
After the fix the vendor still does not have my wares and the log is pretty much empty this time
The log file:
Its like it isnt executed? I am loading always the same file but of course never save it. Is that an issue?

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="KopiG_Personal_cues" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="AddWeaponModPartsToTraders">
<conditions>
<check_any>
<event_game_loaded/>
<event_cue_completed cue="md.Setup.Start"/>
</check_any>
</conditions>
<actions>
<debug_text filter="general" text="'Ware List Before:\n%1'.[ md.$ShipTechLists.{1} ]"/>
<set_value name="$weaponModPartT1" exact="[ware.inv_weaponmodpart_t1, 20, 20, 100]" />
<set_value name="$weaponModPartT2" exact="[ware.inv_weaponmodpart_t2, 20, 20, 100]" />
<set_value name="$weaponModPartT3" exact="[ware.inv_weaponmodpart_t3, 20, 20, 100]" />
<append_to_list name="md.$ShipTechLists.{1}" exact="$weaponModPartT1"/>
<append_to_list name="md.$ShipTechLists.{1}" exact="$weaponModPartT2"/>
<append_to_list name="md.$ShipTechLists.{1}" exact="$weaponModPartT3"/>
<debug_text filter="general" text="'Ware List After:\n%1'.[ md.$ShipTechLists.{1} ]"/>
</actions>
</cue>
</cues>
</mdscript>
Code: Select all
Logfile started, time Sat Mar 12 16:40:27 2016
[General] 122865.20 ======================================
[=ERROR=] 122865.20 Error in AI script trade.performtraderun on entity 0xef3e: TradeID 1124: trade 390 Ore between Fedhelm and Integrative URV Forge failed with reasoncode 65536 (0x10000 - 0000000000000010000000000000000b)!
[General] 122865.20 ======================================
-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
-
- Posts: 419
- Joined: Wed, 11. Dec 13, 02:39
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
sorry i didnt reply yet - i have lost track of this topic..
i just copied the Code above into my Game and it worked... the Message appeared in the Log (hidden by dozens of other messages.. didnt test/clean my current WiP Script yet
) and the Wares were also immediately buy-able in a new Game on the first random Ship Technican i could contact..should be the same for Savegames after a Zone switch (if this Script wasnt used before in thsi save; couldnt test the save case because i dont have one at hand).. so no idea whats wrong there..
could you put this line somewhere into actions and tell us if it throws any errors:
<set_value name="no idea" exact="blah blah blah"/>
(putting invalid code somewhere is imo a good way to make sure the code is read/used at all)
This should cause multiple errors in the log - two when reading the file and one or two more on execution....
i just copied the Code above into my Game and it worked... the Message appeared in the Log (hidden by dozens of other messages.. didnt test/clean my current WiP Script yet

could you put this line somewhere into actions and tell us if it throws any errors:
<set_value name="no idea" exact="blah blah blah"/>
(putting invalid code somewhere is imo a good way to make sure the code is read/used at all)
This should cause multiple errors in the log - two when reading the file and one or two more on execution....
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
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

-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
-
- Posts: 270
- Joined: Sat, 16. Nov 13, 11:07
Okay I started out a new game and the mod is working perfectly fine with the mods I installed. What could be the problam? Somewhere I read I think that these "cues" are instanceiated only once and keep running even if the mod is taken out. Could this be the case that the non functioning cue got stuck in my save file?
Renamed the cue's name but nothing changed. The ware list is not updated.
Renamed the cue's name but nothing changed. The ware list is not updated.