Can someone tell me whats wrong?
by Jermaine Morgan · in Torque Game Engine · 07/31/2007 (6:45 am) · 3 replies
I been trying to mod the fps starter kit so that when a the players pick up a object it deletes.
It does not work though. It will not delete though.
I tried both obj.delete();
and this.delete();
I get no errors at all.
datablock ItemData(TorqueLogoItem)
{
category = "Items";
shapeFile = "~/data/shapes/Logo/torque_logo.dts";
};
function TorqueLogoItem::onCollision(%this, %obj, %col)
{
// Apply health to colliding object if it needs it.
// Works for all shapebase objects.
this.delete();
if (%col.client)
messageClient(%col.client, 'MsgHealthPatchUsed', '\c2Health Patch Applied');
}
Can someone help me out?
Text does come up that says "Health Patch Applied".
Can someone help?
It does not work though. It will not delete though.
I tried both obj.delete();
and this.delete();
I get no errors at all.
datablock ItemData(TorqueLogoItem)
{
category = "Items";
shapeFile = "~/data/shapes/Logo/torque_logo.dts";
};
function TorqueLogoItem::onCollision(%this, %obj, %col)
{
// Apply health to colliding object if it needs it.
// Works for all shapebase objects.
this.delete();
if (%col.client)
messageClient(%col.client, 'MsgHealthPatchUsed', '\c2Health Patch Applied');
}
Can someone help me out?
Text does come up that says "Health Patch Applied".
Can someone help?
About the author
#2
07/31/2007 (8:46 am)
Thanks I forgot the % sign.
#3
%obj is your logo instance.
%col is what the object (%obj) hit. You can do a %col.getClassName() to determine what type of thing hit it if you wanted. Looks like you want to apply health to player, so I would check for player type or vehicle, or whatever you want to apply health to.
I would delete the object after you messageClient if I were you.
The message to client is a whole other ball of wax. Is this running server side (I assume so)? Do you have appropriate client side functions for receiving the serverMessage? Looks like your client side function just takes the "Health Patch Applied" string and spits it out?
07/31/2007 (8:59 am)
Should look something like this...%obj is your logo instance.
%col is what the object (%obj) hit. You can do a %col.getClassName() to determine what type of thing hit it if you wanted. Looks like you want to apply health to player, so I would check for player type or vehicle, or whatever you want to apply health to.
I would delete the object after you messageClient if I were you.
The message to client is a whole other ball of wax. Is this running server side (I assume so)? Do you have appropriate client side functions for receiving the serverMessage? Looks like your client side function just takes the "Health Patch Applied" string and spits it out?
function TorqueLogoItem::onCollision(%this, %obj, %col)
{
//delete your object first?
%obj.delete();
//message to client
if (%col.client)
messageClient(%col.client, 'MsgHealthPatchUsed', '\c2Health Patch Applied');
}
Torque Owner Andrew Edmonds
EiKON Games