prevent death function

Discussions about Coding and Scripting
Post Reply
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

prevent death function

Post by Rakiayn »

the prefentdeath function in a mutator what does it really do?
is it the same as the scorekill function?
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: prevent death function

Post by Feralidragon »

No, they're different.

PreventDeath is a boolean function that will ultimately decide if a specific player/pawn dies or not (hence the name "prevent death").
If it returns False, then the player dies, if it returns True, then the player shouldn't die and you have to give him some health (otherwise the code will give him just 1HP).

Its most obvious usage is in spawn protection mods or any situation that the player should not die, but it can also be used to do something upon the death of the player (in case all the other mutators PreventDeath return false, or in case you don't care if he ends up really dying or not).

ScoreKill happens only once the players is confirmed to be killed (after PreventDeath returns False, if PreventDeath returns True then ScoreKill does not get called at all).
User avatar
Rakiayn
Masterful
Posts: 550
Joined: Fri Aug 28, 2009 3:33 pm

Re: prevent death function

Post by Rakiayn »

ah, ok.
I guess the relic where you get teleported somewere instead of dying uses this function
Post Reply