Game Development Community

Help please

by Ronald J Nelson · in Torque Game Engine · 09/03/2005 (2:45 pm) · 3 replies

After dozens of failed attempts and trys to use resources I am pretty aggravated so I thought I would just try asking.

Has anyone created a system that works with TGE 1.3 that allows a player to mount a vehicle within a certain radius after using a key or button? If so would you please consider sharing it?

#1
09/03/2005 (3:24 pm)
Have you considered using ContainerSearch or CastRay?

CastRay would be nice if you want to aim at the vehicle and press a key to enter it. You would just check range, kill the player/mount the player, give the player control of the vehicle. Pretty easy.

If you want an example of ContainerRadiusSearch, take a look at radiusdamage.cs inside the starter.fps/server folder.
#2
09/03/2005 (8:39 pm)
I tried it and get this result:

main/client/scripts/default.bind.cs (501): Unable to find object: '' attempting to call function 'getWorldBoxCenter'
main/client/scripts/default.bind.cs (503): Call to initContainerRadiusSearch in mountByRadius uses result of void function call.

with this code I wrote:

function mountByRadius(%val)
{
   // Looking to mount car after it is detected within radius.

   if(!$VehicleDetectRadius)
   {
      %radius = 1;

      %position = %client.player.getWorldBoxCenter();

      %Vehicle = InitContainerRadiusSearch(%position, %radius, $TypeMasks::VehicleObjectType);
   }

   if (%Vehicle)
   {
      %node = 0;
      %Vehicle.mountObject(%obj,%node);
      %obj.mVehicle = %Vehicle;
      %obj.client.setcontrolobject(%Vehicle);

      return true;
   }
   %mountByRadius = schedule(1000, 0, "mountByRadius" );
   return false;
}

OK any ideas on what I am doing wrong?
#3
09/04/2005 (3:19 am)
Yeah, where do you get %client from? You need to pass the client ID to the function.