Game Development Community

Which object is under player control?

by Jason Farmer · in Torque Game Engine · 02/01/2006 (3:02 pm) · 2 replies

Hi, this sounds like a really noddy problem...

I've got 4 Player objects in my game that I can control by pressing 1-4. This all works lovely.

Now if I kill one of them, I want to know in GameConnection::onDeath if the object that died is the one currently under player control so I can set the Corpse-Cam to the corpse, prompting the player to select another Avatar until all 4 are dead.

Currently, the corpse-cam comes on if I kill one of my own guys.
I only want it to come on if the avatar I'm controlling gets killed somehow.

I think I'm being extraordinarily stupid here 'cos I can't figure out how to do it.

Can someone tell me or suggest a better way?

Thanks in advance.

#1
02/02/2006 (11:23 am)
%bool = isObject(%somePlayer.getControllingClient());

Where %somePlayer is your player name/id. %bool becomes true if the object is being controlled by a client, and false if not.
#2
02/02/2006 (2:07 pm)
Thanks Manoel, just the job :-)