Game Development Community

Pick up a proximity mine

by Nils Eikelenboom · in Torque 3D Beginner · 08/10/2013 (2:27 am) · 2 replies

Is their a "quick" way to increase the inventory with ProximityMineData after the game has started?

I would like to let the player pick up unarmed proximity mines and arm those with onthrow.

#1
08/10/2013 (8:14 am)
I'm not exactly sure what you want precisely but I do have some pointers.

Create a new item for your Unarmed Proximity Mine, and set it's image to the standard mine image, then you can set those on your map.

Now, if you want the player to "pick" it up directly and not be able to use other items until dropped or armed, that's a little more tricky. You'll need to modify the existing onPickup() function to lock weapon changes.
#2
08/10/2013 (9:49 am)
Thanks for the reply @Robert!

Sorry, if I'm not so clear.

I'm trying to let the player pick up a ProxMine that's placed in the world, not by the "throw" method. So be able to place the mines with the editor for players to pick up and use them. In my version, picking up items is binded with a key. My final goal with this is to have the proxMines behave as items, rather then as a weapon.

Quote:"@note Proximity mines with the #static field set to true will start in the Armed state. Use this for mines placed with the World Editor."

Both field values have the same effect; exploding when the player is within the triggerRadius. When I set the radius to 0 I'm amble to come close and try to pick it up (as a test) but unable.

Then I though maybe it is the typemask (proximityMine.cpp):

ProximityMine::ProximityMine()
{
   mTypeMask |= StaticShapeObjectType;
   ...
}

so I changed it to:

ProximityMine::ProximityMine()
{
   mTypeMask |= ItemObjectType;
   ...
}

because the script to pick things up is like this:

function serverCmdPickupObject(%client)
{
   %range = 5;
   %control = %client.getControlObject();
   %player = %client.player;
   %result = %control.getLookAtPoint(%range, $TypeMasks::ItemObjectType);
   if (getWordCount(%result) > 0 && getWord(%result, 0) !$= "0")
   {
      %obj = getWord(%result, 0);
      if($TypeMasks::ItemObjectType)
      {
         echo("Picking up item " @ %obj);
         %player.pickup(%obj);
      }
   }
}

but that didn't work.

If I'm creating Items with the ProxMine as image, they no longer behave as proxMines (explode on damage), or am I doing something wrong?

In any way, I'm unable to pick them up. Could this have something to do with the state "deployed", once they are placed in the world? I was unable to pinpoint that in proximityMine.cpp