//Make sure to read over this code. I didn't test it, so there is probably mistakes.
//Furthermore, never copy+paste code unless you're sure what it does.
//I put some internal documentation if it helps you understand what is going on~
//Feel free to remove it later.
void OnStart()
{
AddEntityCollideCallback("Player", "servant_grunt_x", "check_collide", true, 0); //Change enemy name. Cannot be (*).
}
void check_collide(string &in asParent, string &in asChild, int alState)
{
RemoveCallback(asParent, asChild); //Stop checking constantly. Comment it out if nothing is working.
if(GetPlayerHealth() <> GetLocalVarFloat("player_health") //Checks if Player health does not equal placeholder float.
{
SetLocalVarFloat("player_health", GetPlayerHealth()); //Sets placeholder float to the same value as Player's health.
} //It's unlikely that the player will hurt themself
AddTimer("anim_trigger", 1.0f, "play_animation"); //Other than from an enemy in 1 second. Change timer
} //if you need it earlier/later.
void play_animation(string &in asTimer)
{
if(GetPlayerHealth < GetLocalVarFloat("player_health"))
{
//Run all your CreateParticleSystemAtEntity and anything else here~
//It will only run this if the Player's health is lower than what it was earlier.
//Then will run through to re-adding the CollideCallback and resetting the Float.
}
AddEntityCollideCallback("Player", "servant_grunt_x", "check_collide", true, 0); //Change enemy name.
SetLocalVarFloat("player_health", GetPlayerHealth()); //Comment out Callback if RemoveTimer is also.
}