Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Neverwinter Nights: Enhanced Edition has been released! Visit to make an order. NWN:EE FAQ is available.
Soundtracks for BG:EE, SoD, BG2:EE, IWD:EE, PST:EE are now available in the Beamdog store.
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Getting Tag from Random item?

From a basic armor rack, OnOpen has
#include "x0_i0_treasure"

void main()

    CTG_CreateSpecificBaseTypeTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF, TREASURE_BASE_TYPE_ARMOR);


I need to get the item that's created to an object variable, but can't find where I would do that. Any ideas?

//something like this, but it's not returning info.
object oItem = CTG_CreateSpecificBaseTypeTreasure(TREASURE_TYPE_LOW, GetLastOpener(), OBJECT_SELF, TREASURE_BASE_TYPE_ARMOR);


  • HimmelweissHimmelweiss Member Posts: 70
    It's not returning an object because CTG_CreateSpecificBaseTypeTreasure() can create multiple items.
    Could be modified with an return type struct, but you really need to know then what you do or you may break things.

    Depending on what you want to do with the object:

    You could make your own little randomized treasure script with using CTG_GetSpecificBaseTypeTreasureItem() and CTG_GetTreasureItem()

    You could get the item object in the OnDisturbed Event of the container with GetInventoryDisturbItem(), but then it counts for all items that either get removed, stolen or added. Unless you make use of GetInventoryDisturbType().

    You also could get the object int the module OnAcquireItem event.

Sign In or Register to comment.