Forum > Serverside Modding
[SOLVED] [QUESTION] TC2. Script executed after loot.
<< < (2/2)
Ascathos:
Did you add it as script for the gob?
Daweo:
I added this script to core (Custom script, ScriptLoader, etc.). Then I added the script name for my chest. I know what i have to do when I want execute this script but the script doesnt do anything. There is problem in calling... You can normally loot the chest but nothing from script is done. That means that the script is not called by this on-function....
Daweo:
I solved my problem. The main problem was that I am begginer in C++ and I did not see my mistake in calling function. For someone can be interesting changing of lootstate when you are looting.
--- Code: ---States go in order: GO_ACTIVATED - You open loot table and take items O_JUST_DEACTIVATED - The loot table is closed and object come invisible GO_NOT_READY - GameObject waits for respawn, is invisible (not for GM) GO_READY - Gameobject waits for looter... --- End code ---
Thank Ascathos for help very much... :)
There is code which can maybe help somebody...
--- Code: ---#include "ScriptPCH.h" #include "ScriptMgr.h" #include "GameObject.h" #include "LootMgr.h"
class despawn_script : public GameObjectScript { public:
despawn_script() : GameObjectScript("despawn_script") { } void OnLootStateChanged(GameObject* go, uint32 state, Unit* player) { switch (go->getLootState()) { case GO_NOT_READY: { sLog->outString("GO_NOT_READY"); break; } case GO_READY: { sLog->outString("GO_READY"); break; } case GO_ACTIVATED: { sLog->outString("GO_ACTIVATED"); break; } case GO_JUST_DEACTIVATED: { sLog->outString("GO_JUST_DEACTIVATED"); } } } };
void AddSC_despawn_script() { new despawn_script(); }
--- End code ---
Navigation
[0] Message Index
[*] Previous page
|