Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Models and Media / A good horror Script?

Author
Message
The Twisted
14
Years of Service
User Offline
Joined: 6th Jun 2012
Location: In the Center of Venus....
Posted: 19th Aug 2012 06:02
Ok, I've been learning scripting and wasn't sure how to pull this one off, but how would you make a script to where when the player does something or goes by a certain place and even sometimes randomly a enemy pops up and when the player sees him it plays a different music and continues until the player either gets away or kills the enemy? This seems like a lot, and it is, but that's the reason I'm asking for a little help from my fellow forumites. Thanx a bunch.

Only the best and the worst.
The Storyteller 01
17
Years of Service
User Offline
Joined: 11th May 2009
Location: On a silent hill in dead space
Posted: 19th Aug 2012 15:27 Edited at: 19th Aug 2012 15:28
The good news is: Yes, this can all be achieved.
The bad news is: It takes more than a single script to pull it off.
And the ugly news is, that "enemies that randomly pop up" are amongst the biggest risks in level design as they can damage the game flow, imbalance the difficulty and create illogical spawning.

Here is my method for spicing up gameplay a little:
1.
I set up a corridor with a dynamic door which the player has to pass by, ideally it is at a point in the level where the player has to pass by the door several times.
2.
The door cannot be opened by the player and is scripted to make a random 50% check each time the player passes by. On the "right" outcome the door automatically opens.
3.
Behind the door an enemy is placed with a script that makes him attack as soon as he sees the player. Once the door script opens it, the enemy attacks.
4.
To have the enemy play some "dramatic music", his script has to be altered, so that as long as PLRCANBESEEN is true and the enemy is not destroyed the music plays, otherwise it stops. The hook is, that this might hamper the enemy playing his usual soundset.

I know this setup is not very flashy but it's logical (the enemy opened the door himself), random enough to surprise the player but still easy to balance with the rest of the level.

Coincidencely I am working on a "scary door" script atm, that makes the door play random banging sounds, and if it would help you, I'll do antoher version for opening the door. This script would then kind of warn the player that there IS something behind the door without actually opening it until the player doesnt think of it dangerous anymore

In case you find my grammar and spelling weird ---> native German speaker ^^
The Twisted
14
Years of Service
User Offline
Joined: 6th Jun 2012
Location: In the Center of Venus....
Posted: 19th Aug 2012 23:26
That would sound perfect for the type of project I'm working on and it would help me a bunch

Only the best and the worst.
Braden 713
18
Years of Service
User Offline
Joined: 3rd Aug 2007
Location: Canada
Posted: 20th Aug 2012 03:06
I never actually considered some of these ideas until I read this thread, thanks for the tips and information Storyteller!

I don't suppose you'd be up to showing exactly how one would alter a character script to work the music like that, would you? Any and all help is appreciated.

Life would be much easier if I had the source code.
The Storyteller 01
17
Years of Service
User Offline
Joined: 11th May 2009
Location: On a silent hill in dead space
Posted: 20th Aug 2012 09:45 Edited at: 20th Aug 2012 10:07
Here is the final script (in the attachement) for the door: EnemyDestroyedDoor

How it works:
The door triggers randomly when the player is within randomly (0.1-2.0 secs) and plays random banging sounds (0-3) before it has a high chance to be destroyed (~40%). If the door is not destroyed, the script resets randomly (3-5 secs) after which it can again be triggered by the player. Behind this door an enemy should be placed (the reason for the banging at the door and its
eventual destruction) who is now ready to attack the player.
To make the door not just dissappear upon destruction, a second door has to be put in front of this door and its name has to be put into the "if used" box of this one. The second door has to be slightly angled to the direction it should fall, "spawn at start" has to be put to "NO" and "is immobile" has to be put to "NO" as well. Check out this thread for a detailed setup:http://forum.thegamecreators.com/?m=forum_view&t=182353&b=23
Examples where to use:
In exploration maps where the player has a high chance to pass by this door several times, it can disctract and scare the player as well as providing an additional (surprise) enemy.
Issues:
Random banging sounds are cool but random enemies should be very carefully placed. There should be only one of these doors in a whole level unless the level is very large and the doors are far apart from each other. The stock sounds used for this script are far from perfect for the job. You might find better.

In case you find my grammar and spelling weird ---> native German speaker ^^
The Twisted
14
Years of Service
User Offline
Joined: 6th Jun 2012
Location: In the Center of Venus....
Posted: 20th Aug 2012 22:59
Very nice. Only one more thing I'm curious of: How would you set up the music to only when the character spots the enemy, such as if the enemy would spawn behind the player and the player turned around?

Only the best and the worst.
The Storyteller 01
17
Years of Service
User Offline
Joined: 11th May 2009
Location: On a silent hill in dead space
Posted: 20th Aug 2012 23:24
You have to edit the character script to play the music/sound when the character is spotted.

And I'll be very blunt now: Generally, if you start editing character scripts, you have to learn the basics of scripting first. Character behavior is crucial to any game and tinkering these scripts is always risky unless one knows exactly what they are doing.

Quote: "such as if the enemy would spawn behind the player "

Please don't do this. Ever. It's cheap, cheesy and shows a lack of imagination. Maybe its just me but I have stopped playing DOZENS of indie games and mods after several spawns behind my back that couldn't be logically explained.

In case you find my grammar and spelling weird ---> native German speaker ^^
The Twisted
14
Years of Service
User Offline
Joined: 6th Jun 2012
Location: In the Center of Venus....
Posted: 31st Aug 2012 23:02
Alrighty then, thanks for the help, and also I won't do that exactly, it was just a rough example that I've seen in others games.

Only the best and the worst.

Login to post a reply

Server time is: 2026-07-17 14:26:38
Your offset time is: 2026-07-17 14:26:38