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!
DannieWest Offline
Member

Posts: 156
Threads: 13
Joined: Apr 2011
Reputation: 0
#2
RE: Script help!

Just create one ScriptArea and place it in front of the door, whenever you want him to look at the door Smile Then use:
void OnStart()
{
     AddEntityCollideCallback("Player", "ScriptArea_x", "LookAndVoice", true, 1);
     SetEntityPlayerInteractCallback("doorname", "CellActivity", false);
}

void LookAndVoice(string &in asParent, string &in asChild, int alState)
{
     StartPlayerLookAt("doorname", 3.0, 3.0, "");
     PlaySoundAtEntity("", "voice you wanna play", "doorname", 0, false);
     AddTimer("", 1.5, "StopLook");
}

void StopLook(string&in asTimer)
{
     StopPlayerLookAt();
}

void CellActivity(string &in asEntity)
{
     PlayGuiSound("name of scream sound file", 1.0f);
     SetLightVisible("name of light", false);
     AddPlayerBodyForce("amount of force on X-axis", "Force on Y-axis", "Force on Z-axis", true); //Test your way on this one as I'm not sure which axis it will be (You need values over 2000 to get any effect
     SetSwingDoorLocked("doorname", true, true);
     PlaySoundAtEntity("", "break_wood", "doorname", 0, false); //This one is if you wanna have a extra sound of the door really slamming shut, and depending on the door type you might wanna change the break_wood one
     GiveSanityDamage(25, true); //Incase you wanna give him sanity damage, completely optional, but preferably since it would scare a normal person
}

All stuff behind // can be removed if you think it gets to messy, just put em there if you wanna copy the script, so nothing gets messed up Smile
(This post was last modified: 06-02-2011, 12:58 AM by DannieWest.)
06-02-2011, 12:56 AM
Find


Messages In This Thread
Script help! - by SLAMnesia - 06-02-2011, 12:24 AM
RE: Script help! - by DannieWest - 06-02-2011, 12:56 AM
RE: Script help! - by SLAMnesia - 06-03-2011, 04:48 AM
RE: Script help! - by SLAMnesia - 06-03-2011, 06:06 AM
RE: Script help! - by DannieWest - 06-04-2011, 02:29 PM



Users browsing this thread: 3 Guest(s)