Game Development Community

Help with dealing damage

by KevinG · in Torque Game Engine · 06/25/2005 (2:46 pm) · 0 replies

I'm making a reactor chamber that houses barrels of toxic waste.
I'm trying to simply get these static barrel objects to deal the players
(not bots) some damage if they get too close to them. the player
would eventually die from prolonged exposure.

I'm currently trying to figure out how to set up a basic damage
triggers. I find this example:


//------------------------------------------------------------------------
datablock TriggerData(Damage)
{
tickPeriodMS = 100;
};

function Damage::onEnterTrigger( %this, %trigger, %obj)

{
echo("taking radiation damage");
}

function Damage::onLeaveTrigger(%this, %trigger, %obj)

{
echo("stop radiation damage");
}

//--------------------------------------------------------------------------

in that example(if it even works?), in the onEnter we have
%this, %trigger, %obj. Is that to read %player, %Damage(trigger name),
and %barrel? How would i set up a simple trigger like this? then,
where the heck do i place this datablock? to the barrel.cs or the player?

Cheers.