This is the basic structure to make GameObject scripts.
So, for instance, if you want to make a GO open only if player has a certain item, do this:Code:#include "StdAfx.h" #include "Setup.h" class GONAME : public GameObjectAIScript { public: GONAME(GameObject* goinstance) : GameObjectAIScript(goinstance) {} static GameObjectAIScript *Create(GameObject * GO) { return new GONAME(GO); } void OnActivate(Player * pPlayer) { //do stuff here } }; void SetupGONAME(ScriptMgr * mgr) { mgr->register_gameobject_script(ENTRY, &GONAME::Create); }
Code:#include "StdAfx.h" #include "Setup.h" class GONAME : public GameObjectAIScript { public: GONAME(GameObject* goinstance) : GameObjectAIScript(goinstance) {} static GameObjectAIScript *Create(GameObject * GO) { return new GONAME(GO); } void OnActivate(Player * pPlayer) { if(pPlayer->GetItemInterface()->GetItemCount(KEYENTRY,false)) this->_gameobject->Activate(pPlayer->GetMapMgr()); else pPlayer->GetSession()->SendNotification("You need a key to open this."); } }; void SetupGONAME(ScriptMgr * mgr) { mgr->register_gameobject_script(ENTRY, &GONAME::Create); }