Roarl 29 Posted January 14, 2016 (edited) Hi there! How do you access the (player) user of a gameobject?For instance, let us consider this simple gameobject script :class go_chairofjudgmentgood : public GameObjectScript { public: go_chairofjudgmentgood() : GameObjectScript("go_chairofjudgmentgood") { } struct go_chairofjudgmentgoodAI : public GameObjectAI { uint32 goTimer; go_chairofjudgmentgoodAI(GameObject* go) : GameObjectAI(go) {} void Reset() { goTimer = 7000; } void UpdateAI(uint32 diff) override { GameObjectAI::UpdateAI(diff); if (goTimer <= diff) { //HERE } else goTimer -= diff; } }; GameObjectAI * GetAI(GameObject * go) const { return new go_chairofjudgmentgoodAI(go); } };Let us assume the object type of the chairofjudgmentgood is indeed a chair. How could I get the Player (class) of the player sitting on the chair at line 23 (//HERE)?Thanks in advance for your help Edited January 14, 2016 by Roarl Share this post Link to post Share on other sites
Rangorn 125 Posted January 14, 2016 According To this : https://github.com/TrinityCore/TrinityCore/blob/6.x/src/server/game/Entities/GameObject/GameObject.cppThe code for Chairs and barbershop chair is something like that if (user->GetTypeId() != TYPEID_PLAYER) return; Player* player = user->ToPlayer(); 2 Share this post Link to post Share on other sites
Roarl 29 Posted January 14, 2016 That will do! Thanks dude! 1 Share this post Link to post Share on other sites