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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spoiler How to make the Wind Open's a Door!
VeNoMzTeamHysterical Offline
Member

Posts: 240
Threads: 36
Joined: Dec 2012
Reputation: 3
#1
Tongue  How to make the Wind Open's a Door!

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 damageSmile

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!


I hope its useful for anyone.

http://www.frictionalgames.com/forum/thread-21719.html
Evil Awaking Work In Progress!
Hours Spend 472.
(This post was last modified: 04-16-2013, 02:51 PM by VeNoMzTeamHysterical.)
03-20-2013, 01:39 PM
Website Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: How to make the Wind Open's a Door!

Mistake spotted! You wrote onStart();. People copy-pasting this WILL get an error. Change it to void OnStart()

EDIT:
Those who don't know scripting....follow the basic tut below. It will help you.
http://www.frictionalgames.com/forum/thread-8851.html

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
Find
VeNoMzTeamHysterical Offline
Member

Posts: 240
Threads: 36
Joined: Dec 2012
Reputation: 3
#3
RE: How to make the Wind Open's a Door!

(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()

EDIT:
Those who don't know scripting....follow the basic tut below. It will help you.
http://www.frictionalgames.com/forum/thread-8851.html

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 Smile
So probably for other people to.

http://www.frictionalgames.com/forum/thread-21719.html
Evil Awaking Work In Progress!
Hours Spend 472.
03-20-2013, 03:28 PM
Website Find
Hardarm Offline
Posting Freak

Posts: 891
Threads: 39
Joined: Apr 2011
Reputation: 43
#4
RE: How to make the Wind Open's a Door!

and the "ps_dust_whirl" isn't the right particle to make a door push.
That one is "ps_dust_push.ps" or the other types

listen to boards of canada
(This post was last modified: 03-21-2013, 09:12 AM by Hardarm.)
03-21-2013, 09:12 AM
Website Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#5
RE: How to make the Wind Open's a Door!

And...
Quote: {
AddEntityCollideCallback("Player", "area1", "Open_Door", true, 1);
}
... that really needs a function header, which JustAnotherPlayer pointed out (but you didn't follow Tongue)

Quote:void OnStart()
{
AddEntityCollideCallback("Player", "area1", "Open_Door", true, 1);
}

(This post was last modified: 03-21-2013, 01:42 PM by Adrianis.)
03-21-2013, 01:41 PM
Find
VeNoMzTeamHysterical Offline
Member

Posts: 240
Threads: 36
Joined: Dec 2012
Reputation: 3
#6
RE: How to make the Wind Open's a Door!

Better now Wink

http://www.frictionalgames.com/forum/thread-21719.html
Evil Awaking Work In Progress!
Hours Spend 472.
04-16-2013, 02:51 PM
Website Find




Users browsing this thread: 2 Guest(s)