{HELP} script to add cargo to station not working (possible bug)

The place to discuss scripting and game modifications for X Rebirth.

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

Post Reply
XATSUB
Posts: 5
Joined: Wed, 12. Dec 18, 13:05

{HELP} script to add cargo to station not working (possible bug)

Post by XATSUB » Sun, 23. Dec 18, 17:47

i've made a patch that replaces some of the storage modules on stations with better ones. However, i need to destroy the old containers and transfer their contents. After some trial and error, i managed to get the amount and ware value into separate lists. However, i'm running into an issue with "add_cargo" when i try to add the wares back into the new containers.

<do_all exact="$formerstoragecount.count" counter="$b">
<add_cargo exact="$formerstoragecount.{$b}" object="$PMCEXCHA.{$i}" ware="$formerstorage.{$b}"/>
</do_all>

where "$formerstoragecount is a list of integers.
$formerstorage is a list of wares.
and $PMCEXCHA.{$i} is one instance of a station from a list of such station types (that is currently being iterated through).

my patch works but it doesn't transfer the full amount of wares from the previous storage container. Using debug_text, i can confirm that the values in the list are correct at that it's the "add_cargo" (function? object? method?) that's not working correctly.

Station before patch:
Image

After (as you can see, some of my more...discretely acquired goods are now missing):
Image

For now i'll try emptying my "warehouse" of Spaceweed and Narcotics, and pray that the other wares won't also be affected after i changed the possible wares. However, i'm afraid that the imperfect transfer will affect NPC stations (stations being patched are Plutarch Exchange and Warehouses, and only the liquid and energy storage for warehouses, so Teracorp might lose some resources from the patch).

Post Reply

Return to “X Rebirth - Scripts and Modding”