Kaev
Super Moderator
[SOLVED] Add loot to GO via C++
Hiho,
i have a chest-GO, where i want to add new loot via C++.
My script looks like this:
I get a servercrash instead my item, when i open this chest. I think my use of LootStoreItem is wrong.
Can you figure out what's wrong or give me a working example?
~Kaev
Hiho,
i have a chest-GO, where i want to add new loot via C++.
My script looks like this:
Code:
class startChestItemSets : public GameObjectScript
{
public:
startChestItemSets()
: GameObjectScript("startChestItemSets")
{
}
void OnLootStateChanged(GameObject* go, uint32 state, Unit* player)
{
if (go->getLootState() == GO_ACTIVATED)
{
LootStoreItem* item;
item->itemid = 100;
item->maxcount = 1;
item->mincountOrRef = 1;
item->chance = 100;
go->loot.AddItem(*item);
}
}
};
void AddSC_startChestItemSets()
{
new startChestItemSets();
}
I get a servercrash instead my item, when i open this chest. I think my use of LootStoreItem is wrong.
Can you figure out what's wrong or give me a working example?
~Kaev
Last edited: