Sign in to follow this  
Roarl

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

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

Share this post


Link to post
Share on other sites
Sign in to follow this