Game Development Community

Detecting the controlling object

by Kaj Eijlers · in Torque Game Engine · 06/14/2006 (7:14 am) · 1 replies

Hi, I'd like to implement a module where I can have an AI take over the human player and back at any time in the game.

In order to do this, ll have to detect whether it is my AIPlayer or the human who's currently controlling the game.

If I use the ServerConnection.getControlObject() to get the handle of the controlling object, I get something, but how do I find out if it has anything to do with the camera or the player since both are actually different handles? And if I should not use ServerConnection.getControlObject what should I use?

#1
06/14/2006 (7:37 am)
Just check the type of the returned handle? You'll get AIPlayer, Player, Item, Shapebase - you know. You could store %player.camera = %camera and later retrieve it to see if they belong to eachother, if that's what you're after.