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

Posts: 99
Threads: 39
Joined: May 2011
Reputation: 0
#1
Script help!

Hello fellow amnesia editors!

Im workin on this scene and ill put it clearly here:
you walk down a prison hallway, before you walk up to a cell you are forced to look at the door and have a sound say something like "Please help me" then when you open the door theres a scream, the lights in the cell go out and you're thrown out the cell and the door closes and locks as you exit.
Big Grin sounds a little complicated to me but idk if it truly is.
Help is more than appreciated!
(This post was last modified: 06-02-2011, 12:25 AM by SLAMnesia.)
06-02-2011, 12:24 AM
Find
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
SLAMnesia Offline
Member

Posts: 99
Threads: 39
Joined: May 2011
Reputation: 0
#3
RE: Script help!

Hey man, thanks so much for the help I had no idea what to do >.>
but theres one problem in the script
Quote:AddPlayerBodyForce("3000", "0", "3000", true);
seems to be causing an issue. I dont know if theres some unit you're supposed to include like meters or something. Big Grin thanks again
06-03-2011, 04:48 AM
Find
SLAMnesia Offline
Member

Posts: 99
Threads: 39
Joined: May 2011
Reputation: 0
#4
RE: Script help!

AND I FORGOT ONE MORE!
When I click on the door which initates all the actions all the correct events (except the knockback which is being fixed) happen. But I would like the action to not work after one time.
in other words have the whole scare happen once so when you try to open the door a second time you dont lose more sanity and the door doesn't slam again.
06-03-2011, 06:06 AM
Find
DannieWest Offline
Member

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

Did you manage to fix the bodyplayerforce thingy? :o

Oh, my bad!
SetEntityPlayerInteractCallback("doorname", "CellActivity", false);
The "false" should be "true"! The false in this case means that the callback you call (in this case CellActivity) should be deleted after activated, and that's what we want, so it just happens once and then gets deleted Smile My bad on that one!
06-04-2011, 02:29 PM
Find




Users browsing this thread: 1 Guest(s)