Jump to content

[SOLVED] Accessing the (player) user of a gameobject

By Roarl
in Serverside

Recommended Posts

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 :D

Edited by Roarl
Link to comment
Share on other sites

×
×
  • Create New...