Skip to content

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);

Comments

  • HimmelweissHimmelweiss Member Posts: 72
    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.