Multi-object key binding
by Jeff Trier · in Torque Game Engine · 06/08/2003 (2:01 pm) · 3 replies
Hi all,
I am using the method below to allow the client to take control of another player object.
It works really well except when the client is controlling a player, mounts a vehicle, then switches to another player.
The next player the client is controlling is still using the vehicle key binds. I guess that means the key binds are client specific (makes sense :)).
What would you suggest as the best strategy to overcome my dilema?
Thanks all,
-Jeff
I am using the method below to allow the client to take control of another player object.
function ChangeUnitControl(%Client, %obj){
%Client.camera.setTransform(%Obj.getEyeTransform());
%Client.player = %obj; // Allows New Unit to access Player Functions
%Client.setControlObject(%Obj);
}It works really well except when the client is controlling a player, mounts a vehicle, then switches to another player.
The next player the client is controlling is still using the vehicle key binds. I guess that means the key binds are client specific (makes sense :)).
What would you suggest as the best strategy to overcome my dilema?
Thanks all,
-Jeff
About the author
Originally a Classical/Metal musician, I've always been attracted to anything involving computers, including: Networking, PC Building and Repair, software design and coding. I've been involved with game design and development for over 10 years.
#2
I understand what you are saying about the control objects. I am still suprised that the client isn't using the current controlled player to determine the keyMap for the client. Since I am using "%Client.setControlObject(%Obj)", I would think that the key bind would reflect what the clients object was controlling. Heh, who knows, I am still an uber-noob.
I will continue digging in script and jump into the C++ code and see what I can find. Hopefully this is a scripting issue (I am fairly certain it is).
Thanks again!
-Jeff
06/08/2003 (5:05 pm)
Thanks Josh,I understand what you are saying about the control objects. I am still suprised that the client isn't using the current controlled player to determine the keyMap for the client. Since I am using "%Client.setControlObject(%Obj)", I would think that the key bind would reflect what the clients object was controlling. Heh, who knows, I am still an uber-noob.
I will continue digging in script and jump into the C++ code and see what I can find. Hopefully this is a scripting issue (I am fairly certain it is).
Thanks again!
-Jeff
#3
It appears that if I spawn in and use the original client player to mount a vehicle, I have the above problem. But if I spawn in with the original client, then create a player, take control of that player, then mount a vehicle, then create another player, then switch to it(whew!), there is no problem.
Back to the grind.
EDIT: Fixed. I just removed "client = %this" in "new player".
-Jeff
06/08/2003 (8:02 pm)
Ok, I think the problem is in how I am assigning the client to a player on a switch. It appears that if I spawn in and use the original client player to mount a vehicle, I have the above problem. But if I spawn in with the original client, then create a player, take control of that player, then mount a vehicle, then create another player, then switch to it(whew!), there is no problem.
Back to the grind.
EDIT: Fixed. I just removed "client = %this" in "new player".
-Jeff
Torque Owner Josh Albrecht
The CLIENT has a control object, AND the player has one. So when you are controlling a vehicle, the client control object is the player, and the player control object is the vehicle. I believe you can use %player.setControlObject(%obj) to set the player control object.
Take a look in the ConsoleInit() (or something like that) function for the player class and client class in the C++ code. There, all the script function including those dealing with control objects are declared.
Hopefully that helps you figure out what is going wrong with your code. Good luck. :)