FANDOM


To respawn loot in the default treasure systems, a few changes to some standard scripts are required. In addition, it is assumed that the placeables containing the treasure have not been destroyed; these changes respawn the loot, not the treasure chests. Furthermore, these changes do not check to see if items were taken; one can open a chest, close it, and re-open it some time later and see double treasure.

When standard scripts are saved in a module, they will replace the BioWare version within that module, and only within that module. Once they have been manually saved via the script editor, they can be recompiled as part of building the module.

Original system Edit

The original treasure system uses several nw_o2_* scripts. To specify the time it takes for treasure to respawn, add a line like the following to nw_o2_concinclude.

    const float RESPAWN_TREASURE_DELAY = 120.0;

This sets the number of seconds from the time a chest is opened to the time loot can again be generated. In this example, the delay is set to two minutes. This script must be saved before making the remaining modifications. For most of the other scripts in this system – nw_o2_bookshelf, nw_o2_boss, nw_o2_classhig, nw_o2_classlow, nw_o2_classmed, nw_o2_generalhig, nw_o2_generallow, nw_o2_generalmed, and nw_o2_generalmid – the modification consists of finding the line

    SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);

and adding the following line after it:

    DelayCommand(RESPAWN_TREASURE_DELAY, DeleteLocalInt(OBJECT_SELF, "NW_DO_ONCE"));

For the remaining two scripts – nw_o2_classweap and nw_o2_feat – the addition is similar, but the name of the local variable is different. Find the line

    SetLocalInt(OBJECT_SELF, "NW_L_OPENONCE",1);

and add the following line after it:

    DelayCommand(RESPAWN_TREASURE_DELAY, DeleteLocalInt(OBJECT_SELF, "NW_L_OPENONCE"));

If the delay needs to be changed, the new line in the include file can be changed, after which the remaining scripts need to be recompiled.

SoU system Edit

The SoU treasure system uses several x0_o2_* scripts, with the rest of the script names indicating the type of treasure and the level of treasure (low, medium, high, and unique). This system has an additional caveat when making the loot respawn: while something containing unique treasure can be made to spawn additional treasure after a delay, this will not cause a specific item to spawn again. That is, unique treasure remains unique, and unique treasure will be depleted if an appropriate chest is opened enough times. To exclude unique treasure from the respawn modification, skip the scripts whose names end in "uniq".

To make treasure respawn in this system, the script x0_i0_treasure needs a line added. This line is added immediately after the following line, which is found in the function CTG_SetIsTreasureGenerated:

    SetLocalInt(oCont, sTreasureGeneratedVarname, bGenerated);

The line to add is

    DelayCommand(120.0, DeleteLocalInt(oCont, sTreasureGeneratedVarname));

This specifies 120.0 seconds from the time a chest is opened to the time loot can again be generated. This number can be changed as needed. This script must be saved before saving the remaining scripts of the system. To actually use this respawn, the remaining scripts of the system must be saved in the module. The script names begin with an indication of what they produce (ten options): x0_02_any, x0_02_arm, x0_02_book, x0_02_clth, x0_02_gold, x0_02_mlee, x0_02_noam, x0_02_potn, x0_02_rang, and x0_02_weap; the names end with "high", "low", "med", and "uniq", for a total of 39 scripts (there is no "golduniq").

If the delay needs to be changed, the new line in the include file can be changed, after which the remaining scripts need to be recompiled.

HotU system Edit

The HotU treasure system uses the x2_02_* scripts. This system can be made to respawn treasure using the method described for the original system. The script nw_o2_coninclude receives the same addition, and the six x2_02_* scripts are modified in the same manner as most of the scripts in the original system.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.