Different death animation for zero lives

afhc2x17

Active member
Hi again, I hope you're feeling well tonight.

My question is: is it possible (by script, remap, or any other way) to have a different death animation for the player when the player loses the last life? I have searched the manual, but remaps do not include death animations so far, maybe I missed something. Thanks in advance and stay safe!
 
the answer is script, and its going to be one that checks how many lives are left & if zero, then do anim special # something,
this script will most likely have to be added to the character´s "on death script" or it could be executed after the first frame of anim death
 
Hi again, sorry to bother you with this thread again, but I don't know how to do much scripting and I need to know if someone could help me:

I want the player to have a different anim death when gets to zero lives. So I already got this in the ondeathscript file of the player. But "lives" is not recognized by the getentityproperty function and I can't get the equivalent for getting the number of lives required in the "if" according to the manual. So I need the lives number to trigger the script on anim death50 (for zero lives) instead of anim death (everything else). Do I need to define the function on the player file or also need to do directly in the ondeathscript file? Thanks in advance and take care.

Code:
void nodeath(void anim)
{
    void self = getlocalvar("self");
    int lives = getentityproperty(self,"lives");

    if(lives=0)
    {
        changeentityproperty(self, "animation", openborconstant("ANI_DEATH"+anim));
    }
}
 
@afhc2x17:

There's no such thing as lives for an entity. Entities are just a temporary collection of properties that represent exactly one on screen character at a time. Each time you die, the entity that represents your player gets deleted, then replaced with another when you respawn.

The life count is part of player properties. You can get those with the playerproperty() function. You'll need to find out which player is controlling the entity, and then you can get that player's life count, like this:

C:
int player_index = getentityproperty(<entity pointer>, "playerindex");
int player_lives = getplayerproperty(player_index, "lives");

Now you can implement your logic based on number of player lives.

Bonus: You could get remaining credits too... just in case you really want to rub their noses in it when there are no more continues left. 😭

HTH,
DC
 
Back
Top Bottom