Vehicles in Game
by Chris Frankie · in Torque Game Engine · 02/15/2007 (10:06 am) · 4 replies
Alright, I have everything down very well for vehicles - the only thing I can NOT get done is to create one that a player can mount WITHOUT having to press a button to CREATE one.
I just simply want a vehicle to be there, the player walks up to it, and mounts the silly thing.
All demos of the code require the silly thing to be created with a button press...
Rather confused.
Creating an object with the information of the Vehicle doesn't work, calling the create command outside the button press only pops it ontop of the character and putting position and rotation into the creation doesn't help either...
SO
My question is: How does one create a static vehicle a player has to walk up to and mount without pressing buttons to create the vehicle?
I just simply want a vehicle to be there, the player walks up to it, and mounts the silly thing.
All demos of the code require the silly thing to be created with a button press...
Rather confused.
Creating an object with the information of the Vehicle doesn't work, calling the create command outside the button press only pops it ontop of the character and putting position and rotation into the creation doesn't help either...
SO
My question is: How does one create a static vehicle a player has to walk up to and mount without pressing buttons to create the vehicle?
About the author
#2
moveMap.bindCmd(keyboard, "ctrl f", "commandToServer(\'addflyer\');", "");
Another example where they create a vehicle through Key Commands.
Little more informative though in some other areas I was exploring.. ;)
02/15/2007 (10:38 am)
Ah, once again - moveMap.bindCmd(keyboard, "ctrl f", "commandToServer(\'addflyer\');", "");
Another example where they create a vehicle through Key Commands.
Little more informative though in some other areas I was exploring.. ;)
#3
new WheeledVehicle(Jetbike) {
position = "360.629 358.514 218.796";
dataBlock = Jetbike;
};
Had to create that in the MISSION File - by hand - rather strange, but works.... now to get that silly thing to become mountable!
02/15/2007 (1:05 pm)
Ahh - finally figured it out:new WheeledVehicle(Jetbike) {
position = "360.629 358.514 218.796";
dataBlock = Jetbike;
};
Had to create that in the MISSION File - by hand - rather strange, but works.... now to get that silly thing to become mountable!
#4
Also, to make them mountable, try having something like this defined for your datablock class:
Finally, I noticed that you are using a datablock named 'Jetbike' in an object whose name is also 'Jetbike'. That is generally a bad idea, as one of the names will end up clobbering the other. I'd name either the datablock or the object instance something different (ie., JetbikeData for the datablock, etc...).
02/15/2007 (2:29 pm)
Do you see a vehicles category in the Shapes section of the world editor 'creator' (assuming you set the category value of your vehicle datablocks to "Vehicles".Also, to make them mountable, try having something like this defined for your datablock class:
function Jetbike::onAdd(%this,%obj)
{
%obj.mountable = true;
}If you want ALL of your wheeled vehicles to be made mountable when added to a mission, substitute 'WheeledVehicleData' for 'Jetbike' in my code above.Finally, I noticed that you are using a datablock named 'Jetbike' in an object whose name is also 'Jetbike'. That is generally a bad idea, as one of the names will end up clobbering the other. I'd name either the datablock or the object instance something different (ie., JetbikeData for the datablock, etc...).
Torque Owner Dave MacIsaac
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3925
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2036