Game Development Community

Turrets for TGEA 1.8.1

by Andy Hawkins · in Torque Game Engine Advanced · 03/06/2009 (7:53 am) · 7 replies

I'm tracking my progress here...
www.garagegames.com/community/resources/view/5345/6#comment-113453

but I still can't mount the turret or get the aiturret to fire a projectile.

mounting a turret I get these errors
scriptsAndAssets/server/scripts/player.cs (761): Unable to find function findEmptySeat
FOUND MOUNTED TURRET ON vehicle! %node = 2276
scriptsAndAssets/server/scripts/player.cs (765): Unable to find object: '' attempting to call function 'mountObject'
Mounted a Turret, not a vehicle
TurretData::playerMounted()

and the aiturret I tried adding this to the datablock...
projectile = RifleProjectile;

but it doesn't fire :( I go over to the Aiturret and the projectile is stuck on the turret pointing down, there is glow on the floor but the projectile doesn't move. Seems to have no angle or velocity.

#1
03/08/2009 (3:47 pm)
Anyone have the same problems? Should I contact the original author to fix the problem? I just added the code, compiled it, followed the instructions and the problem above arose.
#2
03/08/2009 (3:55 pm)
Fixed the first bug - forgot to add the following code to the bottom of player.cs

// phdana turrets ->
// if you dont already have this for vehicles
// you need it for turrets
function findEmptySeat(%vehicle, %vehicleblock)
{
  for (%i = 0; %i <  %vehicleblock.numMountPoints; %i++)
  {
    %node = %vehicle.getMountNodeObject(%i);
    if (%node == 0)
    {
         return %i;
    }
  }
  return -1;
}
// <- phdana turrets
#3
03/08/2009 (4:24 pm)
Fixed the second problem.

In genericTurret.cs if you haven't included rifle.cs (in game.cs) this code will not produce a projectile...

datablock ShapeBaseImageData(SmallTurretGun)
{
   // Basic Item properties
   shapeFile = "~/data/shapes/turrets/smallTurretGun.dts";
   mass = 15;
   //category					= "Turrets";  // you dont want to place these

   mountPoint = 0;
   offset = "0 0 0";

   projectile = RifleProjectile;   // <--- doesn't exist!!!
   projectileType = Projectile;
   correctMuzzleVector = false;   // not sure how this is used
...

Replace RifleProjectile with CrossbowProjectile and it works fine.

I will make a PDF out of all this as a final upload.
#4
03/08/2009 (5:17 pm)
Nice work, just what I need.
#5
03/09/2009 (7:49 am)
How about submitting this as a new resource will all update in. So it's just a drop in? I'm a bit lazy :-P
#6
03/09/2009 (3:24 pm)
No it's okay James, it should be a resource and I will do so. I want to complete all the requirements first before I do so. The next step is to make sure I can make the new objects, namely the tank barrel and TRON tank work together for both player and AI. Then I will submit the lot. I will add my Abrahms tank as the test object...
www.mediafire.com/imgbnc.php/bdcf499f2bc2a2b3a7271f1a8cfe2cd34g.jpg
#7
03/10/2009 (4:39 am)
OOoo... Very nice Tank. Can't wait for the resource - I'll probably use it when it gets released for Solar Battles.