Enables standing back up (or any other revival animation) instead of dropping from the sky when respawning after a lost life.
Use
- Configure the player model's death settings (see OpenBOR manual) to leave body on screen after death.
- Place this function in the player model's
onspawnscript
. I recommend you keep the file separate and use the#import
directive. - Execute the function in
main()
. Supply it with the entity you want to respawn and animation to perform. - When entity repsawns, it will search for a pre-existing body on screen. If found, the script will remove body, move entity to body's location, and perform requested animation. If there's no accessible body on screen, native spawn behavior continues.
Example
C:
#import "data/scripts/dc_respawn_body.c"
void main()
{
void acting_entity = getlocalvar("self");
int animation_id = openborconstant("ANI_RISE");
/*
* Find our body, remove it and play the
* rise animation. "That's all you got?!"
*/
dc_respawn_body(acting_entity, animation_id);
}