Well i made a script i think its pretty nice.
When you walk in an Area a door will open and you hear the wind.
Then a timer will start and you will react scare and you get sanity damage
Here is the Script
Spoiler below!
onStart();
{
AddEntityCollideCallback("Player", "area1", "Open_Door", true, 1); // When player collides with Area 1 the script is gonna happen.
}
void Open_Door(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door1", false, true);
SetSwingDoorDisableAutoClose("door1", true); // Disable autoclose means its not gonna close by it self.
AddTimer("", 0.5, "Door_Effect"); // Leading to functions in Door_Effect script.
}
void Door_Effect (string &in asTimer)
{
CreateParticleSystemAtEntity("", "ps_dust_whirl", "AreaOpenEffect", false); // Makes a patricle system at the scriptbox AreaOpenEffect.
PlaySoundAtEntity("AreaOpenEffect", "scare_wind.snt", "Player", 1, true); // Plays a sound at the scriptbox named AreaOpenEffect.
AddPropForce("door1", 1500, 1500, 1500, "world"); // Gives the door a push so it goes open.
AddTimer("", 0.5, "Door_Scare"); // For adding more effect like Sound/Sanity Damage.
}
void Door_Scare(string &in asTimer)
{
PlaySoundAtEntity("scare", "react_scare.snt", "Player", 1, true); // For better scare effect.
GiveSanityDamage(5, true); // Your screen goes a bit forward to scare you more.
}
Make sure you named the Area where the functions triggers 'area1' or change it in anything you want but make sure you change it in the script to.
Also the door name in this script is Door1 'you can change it in anything you want but also make sure the change it in script and level editor'
Also in Level Editor make an script area behind the door named 'AreaOpenEffect' this is where the particle 'effect' is gonna show up!
EDIT2:
If you want to add force to the door, don't you only need to add force to either the X-Axis or the Z-Axis? (NOTE: the Y-Axis doesn't do anything. It propels the door upwards.) .__.
"Veni, vidi, vici." "I came, I saw, I conquered."
(This post was last modified: 03-20-2013, 02:53 PM by PutraenusAlivius.)
(03-20-2013, 02:49 PM)JustAnotherPlayer Wrote: Mistake spotted! You wrote onStart();. People copy-pasting this WILL get an error. Change it to void OnStart()
EDIT2:
If you want to add force to the door, don't you only need to add force to either the X-Axis or the Z-Axis? (NOTE: the Y-Axis doesn't do anything. It propels the door upwards.) .__.
Hahaha oke anyway but its working for me
So probably for other people to.