Hello guys, I'm new to this forum. I made an account just 5 minutes ago just to ask for help. I've been searching around for about an hour now about what I do wrong but nothing seems to help me in this situation..
I want to create a jump-scare script in my custom story where a Body suddenly pops up in front of you and disappears again almost instant (in 0.7 seconds).
The body spawns when I enter the script area but it doesn't despawn.. = It activates but does not de-activate like I want it to, also the sound effect triggers everytime I walk into the script-area, and I only want it to trigger once.
Here's a screenshot of the situation:
Print Screen
The script is this:
void OnStart()
{
AddEntityCollideCallback("Player", "JumpScare1", "Jumpscare1", false, 1);
}
void Jumpscare1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "enemy_hallucination_disappear.ogg", "Player", 0, false);
SetEntityActive("Jumpscare_Corspe1", true);
AddTimer("", 0.7f, "JumpscareEntity_Gone");
}
void JumpscareEntity_Gone(string &in asTimer)
{
PlaySoundAtEntity("", "21_scream6.ogg", "Player", 0, false);
SetEntityActive("Jumpscare_Corpse1", false);
}
Hope someone can help me with this, I will hopefully release the Custom Story when it's done.. I've put a lot of time in it and I hate to get stuck hehe..
Sincerely!