Game Development Community

Changing key's when you enter a vehicle

by Anthony Rosenbaum · in Torque Game Engine · 06/04/2002 (11:57 am) · 3 replies

AS of right now when a player gets into a wheeled vehicle the mouse controls the steering and W and S control the throttle/brake/reverse actions. What I'd like would be to make the steering be controlled by A and D so the mouse could be free to control a turrent on the vehicle(turrents will be another series of posts). So can anyone point me in the direction of changing the steering controls for the wheeled vehicle (only)?

#1
06/04/2002 (4:19 pm)
Make a client scripting function like this:

function clientCmdSetVehicleKeys( %inVehicle )
{
   if( %inVehicle )
   {
      vehicleActionMap.push();
   }
   else
   {
      vehicleActionMap.pop();
   }
}

And call it from Armor::onMount:

commandToClient( %obj.client, 'SetVehicleKeys', true );

And Armor::onUnmount:

commandToClient( %obj.client, 'SetVehicleKeys', false );
#2
06/05/2002 (12:45 pm)
but I still have to make and actionMap tell me if I am one the right track
new ActionMap(vampMoveMap);
vampMoveMap.moveMap.bind( keyboard, a, moveleft );
vampMoveMap.moveMap.bind( keyboard, d, moveright );
and as for your push and pop examples I'm still not sure how to activate everything
function clientCmdSetVampKeys( %inVamp )
{
   if( %inVamp)
   {
      vampActionMap.active();
   }
   else
   {
      vampActionMap.disable();
   }
}
finally will the moveleft/right functions be correct or should I be trying to divide yaw function so it will read both A and D?
OH I want these just to be used in 1 type of vehicle so will putting clientCmdSetVampKeys( %inVamp ) call in Vamp::onMount be better than Armor::onMount?
#3
06/05/2002 (1:28 pm)
OH I want these just to be used in 1 type of vehicle so will putting clientCmdSetVampKeys( %inVamp ) call in Vamp::onMount be better than Armor::onMount?

Yeah, you're on the right track. And yeah, that would probably work better for limiting it to a single vehicle. =)

You can make the action map on the fly, or you can have it stored so the options dialog can be used (that's what I do).