Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Stuck doing a Jump-Scare script
Kixz0 Offline
Junior Member

Posts: 16
Threads: 3
Joined: Apr 2013
Reputation: 0
#1
Exclamation  Stuck doing a Jump-Scare script

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!
04-07-2013, 08:36 PM
Find
zergling50 Offline
Member

Posts: 74
Threads: 9
Joined: Jul 2012
Reputation: 1
#2
RE: Stuck doing a Jump-Scare script

I don't know if this will help (I'm also new but just trying to help some others out) but I normally use true instead of false on the addentitycollidecallback.
04-07-2013, 08:47 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#3
RE: Stuck doing a Jump-Scare script

Jumpscare_Corspe1
Jumpscare_Corpse1



See the differences? You've got these names mixed up.
Change this:
SetEntityActive("Jumpscare_Corpse1", false);

To this:
SetEntityActive("Jumpscare_Corspe1", false);



And change this:
AddEntityCollideCallback("Player", "JumpScare1", "Jumpscare1", false, 1);

To this:
AddEntityCollideCallback("Player", "JumpScare1", "Jumpscare1", true, 1);



So the collision area would be deleted and the sound won't be heard over and over.
04-07-2013, 08:56 PM
Find
Kixz0 Offline
Junior Member

Posts: 16
Threads: 3
Joined: Apr 2013
Reputation: 0
#4
RE: Stuck doing a Jump-Scare script

(04-07-2013, 08:47 PM)zergling50 Wrote: I don't know if this will help (I'm also new but just trying to help some others out) but I normally use true instead of false on the addentitycollidecallback.

Well, it stopped the sound to repeat. So that's one of the issues solved. Thank you for that!

Now I only need it to disappear and to play the scream sound.

(04-07-2013, 08:56 PM)ClayPigeon Wrote: Jumpscare_Corspe1
Jumpscare_Corpse1



See the differences? You've got these names mixed up.
Change this:
SetEntityActive("Jumpscare_Corpse1", false);

To this:
SetEntityActive("Jumpscare_Corspe1", false);



And change this:
AddEntityCollideCallback("Player", "JumpScare1", "Jumpscare1", false, 1);

To this:
AddEntityCollideCallback("Player", "JumpScare1", "Jumpscare1", true, 1);



So the collision area would be deleted and the sound won't be heard over and over.

Man, you're a hero. That's my bad to miss that one thing.. Thanks!

But I still don't hear this: PlaySoundAtEntity("", "21_scream6.ogg", "Player", 0, false);

I tried to put this above the PlaySoundAtEntity("", "enemy_hallucination_disappear.ogg", "Player", 0, false);

But I didn't hear it there either, any suggestions?
(This post was last modified: 04-07-2013, 09:00 PM by Kixz0.)
04-07-2013, 08:56 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#5
RE: Stuck doing a Jump-Scare script

If you're going to use playsoundatentity, you'll need the .snt files. They're there if you're using amnesia sounds, but if you're using custom sounds, just copy one, rename it just like your sound, then open it with notepad++ (Or any other program) and change the file name to match yours.

Also a small tip: I wouldn't use a lot of jumpscares. About 80% of this forum doesn't like (hates) jumpscares. But if you can pull them off at the right timing and don't spam them, they can be quite effective..
(This post was last modified: 04-07-2013, 09:21 PM by OriginalUsername.)
04-07-2013, 09:18 PM
Find
Kixz0 Offline
Junior Member

Posts: 16
Threads: 3
Joined: Apr 2013
Reputation: 0
#6
RE: Stuck doing a Jump-Scare script

(04-07-2013, 09:18 PM)Smoke Wrote: If you're going to use playsoundatentity, you'll need the .snt files. They're there if you're using amnesia sounds, but if you're using custom sounds, just copy one, rename it just like your sound, then open it with notepad++ (Or any other program) and change the file name to match yours.

Also a small tip: I wouldn't use a lot of jumpscares. About 80% of this forum doesn't like (hates) jumpscares. But if you can pull them off at the right timing and don't spam them, they can be quite effective..


It is a .snt file which is included in the original Amnesia sounds. But from what I have learned the ".snt" isn't necessary to write in the script. The same sound is available as a .snt file too so I'll try it and see if it works. Or maybe I'll just do a new script area for that single sound. Thanks anyway.

I know that many people hate these scares.. But since this is my first Custom Story I want to try as many different scares as possible, I have 3 pretty big levels (maps) in this CS so far and this is the first and maybe the only jumpscare I will use. Rolleyes
04-07-2013, 09:30 PM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#7
RE: Stuck doing a Jump-Scare script

A .snt file isnt important, but if you use a .snt file, you can set if the sound is for 3d or not, and that is important if you're using playsoundatentity. I prefer to use playguisound if the sound has to play at the player himself.
04-07-2013, 09:41 PM
Find




Users browsing this thread: 1 Guest(s)