Game Development Community

Finding out who threw the proxymine

by Unnown · in Torque Developer Network · 09/10/2013 (1:13 am) · 4 replies

Hello everybody,

I want to make some sort of throwable snowball with torque3d.
Am i correct with using the proxymine as my base?
I tried using the oncollision part to determine who threw the actual ball in order to give him/her exp.
But, i couldn't figure out which variable i had to use or how to find this.
Can you guys help me?

Also if i wanted to log something to the console like all properties and variables of an object without knowing what kind of object this is, is this possible? if so how?

I'm sorry for all these noobish questions =(

About the author

Recent Threads

  • Delete object

  • #1
    09/10/2013 (4:39 pm)
    look in onThrow (do a search - you'll probably find it associated with mines, turrets and inventory) - then attach the player (or client) id to the object. In onDamage check for and handle the information - use the existing projectile code for an example.
    #2
    09/11/2013 (4:02 pm)
    Thank you so much, do you have any idea how to check what information is available for any object? without going through all documentation about it?
    #3
    09/11/2013 (5:14 pm)
    Well, there are three options:

    Documentation
    Source code
    Use the object's dump() command in the console (SimObject.dump()), but it only tells you what methods the object exposes I think....

    They're all rough, and dump() doesn't tell you how to use the methods it shows you.

    RIF - there is no shortcut to knowledge.
    #4
    09/13/2013 (8:09 am)
    What Richard mentioned, but to be more specific.. In proximityMine.cs on game/server directory you'll find this bit of code
    function ProximityMineData::onThrow( %this, %user, %amount )
    {
       // Remove the object from the inventory
       %user.decInventory( %this, 1 );
    
       // Construct the actual object in the world, and add it to
       // the mission group so its cleaned up when the mission is
       // done.  The object is given a random z rotation.
       %obj = new ProximityMine()
       {
          datablock = %this;
          sourceObject = %user;  // <<< this is what you need
          rotation = "0 0 1 "@ (getRandom() * 360);
          static = false;
          client = %user.client;
       };
       MissionCleanup.add(%obj);
       return %obj;
    }

    I've been using this method for glow sticks.