Trigger Damage to Death Count down.
by Sventhors · in Torque Game Engine · 06/30/2006 (8:05 am) · 3 replies
I created a trigger where you inside of the trigger it gives damage and counts down your damage bar. But when you are finally dead it leaves the body there but does not respawn the character. When body fades away the engine ctashes.
Heres the trigger script:
I tried to look at player.cs and find where it death.
I put
I put it in nothing happen. the same thing.
Is there another way.
Heres the trigger script:
datablock TriggerData(DeathTrigger)
{
// The period is value is used to control how often the console
// onTriggerTick callback is called while there are any objects
// in the trigger. The default value is 100 MS.
tickPeriodMS = 100;
};
function DeathTrigger::OnEnterTrigger(%this,%trigger,%obj) {
%checkname = %trigger.getName();
%client = %obj.client;
if(!%client)
{
echo("not a client!");
return;
}
%client.player.applyDamage(1);
%client.player.deathpoints = 1;
CommandToClient(%client,'bottomprint',"\nDeath is Occurring...",5,2);
DeathSched(%trigger,%client);
}
function DeathSched(%trigger,%client) {
if (%client.player.getDamageLevel() > 0) {
//%client.player.setDamageLevel(%client.player.getDamageLevel() - 0.2);
%client.player.setDamageLevel(%client.player.getDamageLevel() + 0.2);
%client.player.DeathSched = schedule(20,0,"DeathSched",%trigger,%client);
} else {
CommandToClient(%client,'bottomprint',"\nDeath is Complete Complete...",5,2);
%client.player.deathpoints = 0;
}
}
//Leave Trigger
function DeathTrigger::onLeaveTrigger(%this,%trigger,%obj)
{
%checkname = %trigger.getName();
%client = %obj.client;
if(!%client)
{
return;
}
if (%client.player.deathpoints == 1) {
cancel(%client.player.DeathSched);
CommandToClient(%client,'bottomprint',"\nDeath Stop haha...",5,2);
%client.player.deathpoints = 0;
} else
%client.player.deathpoints = 0;
}I tried to look at player.cs and find where it death.
I put
%obj.schedule($CorpseTimeoutValue - 10000, "startFade", 10000, 0, true); %obj.schedule($CorpseTimeoutValue, "delete");
I put it in nothing happen. the same thing.
Is there another way.
About the author
#2
Not a complete solution but you can respawn .
07/11/2006 (8:02 pm)
For a fast look try something like this ,if you not want to use the suggestion Anthony did .function DeathSched(%trigger,%client)
{
if (%client.player.getState() $= "Dead")
{
%client.onDeath(%trigger, %client,"DeathSched", "body");
CommandToClient(%client,'bottomprint',"\nDeath is Complete Complete...",5,2);
%client.player.deathpoints = 0;
return;
}
if (%client.player.getDamageLevel() > 0)
{
%client.player.applyDamage(0.1);
%client.player.DeathSched = schedule(20,0,"DeathSched",%trigger,%client);
}
}Not a complete solution but you can respawn .
#3
07/11/2006 (8:06 pm)
Yes, thanks Billy L and Anothy R for the help. That work out great. Awesome:)
Associate Anthony Rosenbaum