Game Development Community

Pickup function?

by Daniel Buckmaster · in Torque Game Engine · 01/20/2007 (3:45 am) · 0 replies

In my starter.fps player.cs script, there is the following function:

function Armor::onCollision(%this,%obj,%col)
{
   if (%obj.getState() $= "Dead")
      return;

   // Try and pickup all items
   if (%col.getClassName() $= "Item")
[b]      %obj.pickup(%col);[/b]

   // Mount vehicles
   %this = %col.getDataBlock();
   if ((%this.className $= WheeledVehicleData) && %obj.mountVehicle &&
         %obj.getState() $= "Move" && %col.mountable) {

      // Only mount drivers for now.
      %node = 0;
      %col.mountObject(%obj,%node);
      %obj.mVehicle = %col;
   }
}

Whenever I collide with ammo in the Stronghold level, the console gives the following error:

starter.fps/server/scripts/player.cs (801): Unknown command pickup.
Object (1809) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject

So it's tripping at the emboldened line above. But why? I haven't modifid that file, and the only thing I've done to the engine is try to implement the Continuous Laser resource.
The basic effect it's having on the mission is that the crossbow starts with no ammo, and I can't pick up any. I just get that error message every second or so.

About the author

Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!