Actionmap
by Tasty Green Pees :-, · in General Discussion · 02/26/2006 (6:39 am) · 11 replies
I have a pickle... When my player mounts a vehicle these functions are called in the onPlayerMount function in player.cs
My question is where is the "PopActionMap" function contained.
because I don't think that my $Vehicle::moveMaps[%node] is being used.
function onPlayerMount(%player,%obj,%vehicle,%node)
{
CommandToClient(%obj.client, 'PopActionMap', moveMap);
CommandToClient(%obj.client, 'PushActionMap', $Vehicle::moveMaps[%node]);
...My question is where is the "PopActionMap" function contained.
because I don't think that my $Vehicle::moveMaps[%node] is being used.
About the author
#2
this is what was there:
02/26/2006 (6:56 am)
I checked out client/scripts/client.cs but there was not reference to actionmapthis is what was there:
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Server Admin Commands
//-----------------------------------------------------------------------------
function SAD(%password)
{
if (%password !$= "")
commandToServer('SAD', %password);
}
function SADSetPassword(%password)
{
commandToServer('SADSetPassword', %password);
}
//----------------------------------------------------------------------------
// Misc server commands
//----------------------------------------------------------------------------
function clientCmdSyncClock(%time)
{
// Time update from the server, this is only sent at the start of a mission
// or when a client joins a game in progress.
}
#3
02/26/2006 (7:13 am)
Are you working off the tutorial base? Below what you just posted should also be this...//----------------------------------------------------------------------------
// ActionMap server commands
//----------------------------------------------------------------------------
function clientCmdPopActionMap()
{
echo("Popping Player action map " );
movemap.pop();
}
function clientCmdPushActionMap()
{
echo("Pushing Player action map " );
movemap.push();
}
#4
I then call the client.cs file in init.cs
my client.cs file looks like this:
02/26/2006 (7:25 am)
You're right I am using tutorial.base but funnily enough, the above client.cs file was copied from starter.racing.I then call the client.cs file in init.cs
my client.cs file looks like this:
function clientCmdPopActionMap(%map)
{
echo("Popping action map " @ %map);
%map.pop();
}
function clientCmdPushActionMap(%map)
{
echo("Pushing action map " @ %map);
%map.push();
}
#5
All that function does is push a new actionmap which should be called something like vehicleDriverMap.cs, this enables you to have a set of different keybindings between the player & the vehicle controls.
02/26/2006 (7:30 am)
Could you explain what the problem you're having is exactly? All that function does is push a new actionmap which should be called something like vehicleDriverMap.cs, this enables you to have a set of different keybindings between the player & the vehicle controls.
#6
However, the actionmaps are not being popped and pushed because when I am in the vehicle the moveMap.bind commands are the ones in use.
eg. my player still tossess grenades from inside the car...
when I hit "e" instead of dismounting the car as is commanded through vehicleDrivermap the player tried to mount a vehicle again even though he is in one meaning the actionmap hasn't been changed.
plus i don't get the echos that i should recieve on popping and pushing the actionmaps
this is the function calling for the pop and push functions:
I cannot see why it won't work.
I appriciate u trying to help me figure this out by the way, Tim.
02/26/2006 (7:40 am)
I've managed to get ride of the aformentioned error.However, the actionmaps are not being popped and pushed because when I am in the vehicle the moveMap.bind commands are the ones in use.
eg. my player still tossess grenades from inside the car...
when I hit "e" instead of dismounting the car as is commanded through vehicleDrivermap the player tried to mount a vehicle again even though he is in one meaning the actionmap hasn't been changed.
plus i don't get the echos that i should recieve on popping and pushing the actionmaps
this is the function calling for the pop and push functions:
function onPlayerMount(%player,%obj,%vehicle,%node)
{
CommandToClient(%obj.client, 'PopActionMap', moveMap);
CommandToClient(%obj.client, 'PushActionMap', $Vehicle::moveMaps[%node]);I cannot see why it won't work.
I appriciate u trying to help me figure this out by the way, Tim.
#7
Could this be the problem or is there another place that it is being called outside the vehicle.cs file?
02/26/2006 (7:45 am)
Having searched the vehicle.cs file for where the onPlayerMount function is being called i failed to find one.Could this be the problem or is there another place that it is being called outside the vehicle.cs file?
#8
This inside player.cs
and this in vehicle.cs
Also make sure vehicleDrivermap.cs is being executed from client/init.cs
02/26/2006 (7:53 am)
It should be in two places:This inside player.cs
function Armor::onMount(%this,%obj,%vehicle,%node)
{
onPlayerMount(%this,%obj,%vehicle,%node);
if(%col.mountable && %col.getMountNodeObject(%node) == 0)
{
%col.mountObject(%obj, %node);
%obj.mVehicle = %col;
%obj.client.setcontrolobject(%col);
%col.mountObject(%obj,%seat);
}
}and this in vehicle.cs
function onPlayerMount(%player,%obj,%vehicle,%node)
{
CommandToClient(%obj.client, 'PopActionMap', moveMap);
CommandToClient(%obj.client, 'PushActionMap', $Vehicle::moveMaps[%node]);
%obj.setTransform(%vehicle.getDataBlock().mountPointTransform[%node]);
%obj.lastWeapon = %obj.getMountedImage($WeaponSlot);
%obj.unmountImage($WeaponSlot);
%obj.setActionThread(%vehicle.getDatablock().mountPose[%node],true,true);
// Are we driving this vehicle?
if (%node == 0) {
%obj.setControlObject(%vehicle);
}
}Also make sure vehicleDrivermap.cs is being executed from client/init.cs
#9
the rest of the above i there but i don't have an init.cs file
from what i can see my main.cs file is that it is loading the same scripts.
02/26/2006 (8:01 am)
Is it not alright for the vehicledrivemap.cs to be executed from main.csthe rest of the above i there but i don't have an init.cs file
from what i can see my main.cs file is that it is loading the same scripts.
#10
02/26/2006 (8:25 am)
Yeah that's fine. The tutorial base is set up differently. I've never used it (I deleted mine). Are you using your own model or the buggy?
#11
02/26/2006 (12:27 pm)
I'm using the buggy
Torque Owner Tim Heldna