Game Development Community

Deleting triggers through script.

by Maddermadcat · in Torque Game Engine · 02/03/2008 (5:21 pm) · 0 replies

I've noticed something strange. Maybe it's just my own inexperience, I don't know -- but for some reason, it's possible to delete triggers through the console but not through script. In my proximity mine script:

function ProximityMineThrown::onDestroyed(%data, %obj, %prevState)
{
   radiusDamage(%obj.sourceObject, %obj.getPosition(), %data.damageRadius, %data.radiusDamage, %data.damageType, %data.kickBackStrength);
   %obj.trigger.delete();
   %obj.schedule(500, "delete");
}

That makes the game crash, followed by a "send error report" message. However, entering something like this in the console:

2145.trigger.delete();

Successfully deletes the trigger with no problems -- my "what the hell" moment of the day. Does anyone have any clue as to why this happens and how to fix it?