Getting Wheeled Flying vehicle demo to run
by Andy Hawkins · in General Discussion · 06/02/2005 (8:31 pm) · 9 replies
Can someone point me in the right direction with getting this tutorial to work -
I'm up to torque scripting in the web docs but I still don't know how to make this one work. Any help would be appreciated.
Do I add the .cc file to config or something once I'm in Starter.fps?
You don't have to explicitely tell me, in fact if someone could point me to the right documentation I am more than happy to read up on it.
The demo is this link...
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7405
I'm up to torque scripting in the web docs but I still don't know how to make this one work. Any help would be appreciated.
Do I add the .cc file to config or something once I'm in Starter.fps?
You don't have to explicitely tell me, in fact if someone could point me to the right documentation I am more than happy to read up on it.
The demo is this link...
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7405
#2
Do I need to add the plane perhaps or modify some other scripts?
BTW dev_aircraft comes up in Static meshes when I press F11 and go to world creator.
06/02/2005 (8:54 pm)
Okay I added the cc and .h file to the project under Torque Demo Files -> Source Files ->Game ->vehicles (in VC++6) - unpack the other files to Starter.fps so they overwrote Client, Data and Server files as you said. I compile and run from VC++6 (Ctrl F5) but it just looks like the orc deathmatch - in that I'm still controlling the Orc and there is no airplane in the mission to control. Do I need to add the plane perhaps or modify some other scripts?
BTW dev_aircraft comes up in Static meshes when I press F11 and go to world creator.
#3
I will install this resource on a fresh copy of TGE in a moment and update my post then (Check back in about ten minutes).
EDIT: I apologize, but I must leave without installing this. But looking in the scripts, it looks like you should go into the Mission Editor and add the airplane from Shapes->Vehicles. I wish I could have helped more, :(.
Robert
06/02/2005 (8:57 pm)
Without using the resource before, I will have to say that you should go into your Mission Editor and place an airplane (Under Shapes somewhere I would guess).I will install this resource on a fresh copy of TGE in a moment and update my post then (Check back in about ten minutes).
EDIT: I apologize, but I must leave without installing this. But looking in the scripts, it looks like you should go into the Mission Editor and add the airplane from Shapes->Vehicles. I wish I could have helped more, :(.
Robert
#4
One last question, am I attempting to overwrite the player character with the airplane? Is that the concept here?
06/02/2005 (9:04 pm)
Okay - thanks for advice. I'll try again. One last question, am I attempting to overwrite the player character with the airplane? Is that the concept here?
#5
I think you may have to add vehicle mounting code.
I have a highly modified Torque install, but (assuming the idea is to mount the player to this) you should be able to get this working with this code (assuming you don't already have the code).
In player.cs:
In function Armor::onAdd add:
The important part throughout this being the addition to Armor::onCollision and the check for "%this.className $= WheeledFlyingVehicleData".
Robert
06/03/2005 (4:16 am)
Since the mod uses starter.fps, I am pretty sure the idea is to have the Player "mount" the vehicle.I think you may have to add vehicle mounting code.
I have a highly modified Torque install, but (assuming the idea is to mount the player to this) you should be able to get this working with this code (assuming you don't already have the code).
In player.cs:
In function Armor::onAdd add:
%obj.mountvehicle = true;After function Armor::onAdd add:
function Armor::onMount(%this,%obj,%vehicle,%node)
{
if (%node == 0) {
%obj.setTransform("0 0 0 0 0 1 0");
%obj.setActionThread(%vehicle.getDatablock().mountPose[%node],true,true);
%obj.lastWeapon = %obj.getMountedImage($WeaponSlot);
%obj.unmountImage($WeaponSlot);
%obj.setControlObject(%vehicle);
%obj.client.setObjectActiveImage(%vehicle, 2);
}
}
function Armor::onUnmount( %this, %obj, %vehicle, %node )
{
if (%node == 0)
%obj.mountImage(%obj.lastWeapon, $WeaponSlot);
}
function Armor::doDismount(%this, %obj, %forced)
{
// This function is called by player.cc when the jump trigger
// is true while mounted
if (!%obj.isMounted())
return;
// phdana turrets ->
if(%obj.mVehicle)
{
%data = %obj.mVehicle.getDataBlock();
if (%data.className $= TurretData)
%data.playerDismounted(%obj.mVehicle, %obj);
%obj.mVehicle.mountable = true;
%client = %obj.client;
if(%obj.mVehicle.mountedTurret.currentDriver == %client)
%obj.mVehicle.mountedTurret.currentDriver = "";
}
%obj.mountVehicle = false;
%obj.schedule(4000, "setMountVehicle", true);
%obj.schedule(4000, "mountVehicles", true);
// Mount last weapon used, unmount from node, and give player control.
%obj.unMount();
%this.onUnMount(%obj);
%obj.setControlObject(%obj);
// <- phdana turrets
// Position above dismount point
%pos = getWords(%obj.getTransform(), 0, 2);
%oldPos = %pos;
%vec[0] = " 0 0 1";
%vec[1] = " 0 0 1";
%vec[2] = " 0 0 -1";
%vec[3] = " 1 0 0";
%vec[4] = "-1 0 0";
%impulseVec = "0 0 0";
%vec[0] = MatrixMulVector( %obj.getTransform(), %vec[0]);
// Make sure the point is valid
%pos = "0 0 0";
%numAttempts = 5;
%success = -1;
for (%i = 0; %i < %numAttempts; %i++) {
%pos = VectorAdd(%oldPos, VectorScale(%vec[%i], 3));
if (%obj.checkDismountPoint(%oldPos, %pos)) {
%success = %i;
%impulseVec = %vec[%i];
break;
}
}
if (%forced && %success == -1)
%pos = %oldPos;
%obj.unmount();
%obj.setControlObject(%obj);
if(%obj.mVehicle)
{
%obj.mVehicle.getDataBlock().playerDismounted(%obj.mVehicle, %obj);
%obj.mVehicle.mountable = true;
}
%obj.mountVehicle = false;
%obj.schedule(4000, "MountVehicles", true);
// if (%forced && %success == -1)
// %pos = %oldPos;
//
// %obj.mountVehicle = false;
// %obj.schedule(4000, "mountVehicles", true);
// Position above dismount point
%obj.setTransform(%pos);
%obj.applyImpulse(%pos, VectorScale(%impulseVec, %obj.getDataBlock().mass));
%obj.setPilot(false);
%obj.vehicleTurret = "";
}In function (at the end) Armor::onCollision add:// %this = %col.getDataBlock();
if ((%this.className $= WheeledVehicleData || %this.className $= WheeledFlyingVehicleData) && %obj.mountVehicle &&
%obj.getState() $= "Move" && %col.mountable) {
// Only mount drivers for now.
%node = 0;
%col.mountObject(%obj,%node);
%obj.mVehicle = %col;
}The important part throughout this being the addition to Armor::onCollision and the check for "%this.className $= WheeledFlyingVehicleData".
Robert
#6
06/03/2005 (8:20 am)
Please quit using the General Forums for these questions.
#7
06/03/2005 (6:10 pm)
Where am I supposed to ask these questions?
#9
06/03/2005 (6:23 pm)
My sincerest apologies. It's the first time I've even seen that area. All you people who have read this without having purchase the SDK - I will have to kill you :)
Torque Owner Robert Pierce
Then, you would just add the wheeledflyingvehicle.cc and .h file into your makefile or project, then recompile the engine.
After that, you would just run the EXE (the new one that was just compiled).
NOTE: If you just extract the ZIP into your torque\SDK directory, you will be overwriting your starter.fps/server/scripts/game.cs and starter.fps/client/scripts/default.bind.cs.
I hope this helps.
Robert