Game Development Community

ControlObject..

by Sam Guffey · in Torque Game Engine · 09/17/2002 (12:36 am) · 8 replies

What would cause the object I am trying to control bump me back to the player without allowing me to control it.

If I set the control in game.cs where the %player = new Blah() then its ok.

Any ideas? I dont recall changing anything in the engine that would cause this.

#1
09/17/2002 (6:17 am)
What code are you using?
You should be using somethign like this

%object - This is the object you want to control
%client - This is your client

%client.setControlObject( %object );
#2
09/17/2002 (2:31 pm)
1377 = the player Im controlling
1375 = the object I want to control.

1377.setControlObject(1375);

It worked before now it dont for some very strange reason.
#3
09/17/2002 (3:27 pm)
Those numbers are identifier numbers used internally by the engine. You shouldn't be using those numbers directly. Instead, use things like %obj, %client or %this, depending on what object you are trying to manipulate.

You can't guarantee that the numbers will be the same everytime you run your game.
#4
09/17/2002 (3:52 pm)
Im calling this from the console, not from script. I can see what my player id and the obj id is so I know the numbers are correct.

See what happens is when I do set the object the camera will update to the new object then bounce me back to my player without giving me a chance to control the object, kinda like it dont want me to control it. This happens to everything.

Say I added an AI to the map, I try to take control and it bumps me back to my body. This goes for vehicles as well.
#5
09/17/2002 (5:54 pm)
Umm... You should be using the client object not the player object to control another object.

%player.client.controlobject(%object);
#6
09/17/2002 (6:09 pm)
Yes, Im using the client id, not the player id. Didnt mean to confuse the two. I did alot of modding for T2 before I got torque so I know quite a bit about the scripting engine. Just dont know why its kicking back to my previous controlled object.
#7
09/17/2002 (6:15 pm)
Are you running with a dedicated server?
#8
09/17/2002 (10:07 pm)
Nope.