Frictional Games Forum (read-only)

Full Version: Script help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!
Just create one ScriptArea and place it in front of the door, whenever you want him to look at the door Smile Then use:
Code:
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
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
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.
Did you manage to fix the bodyplayerforce thingy? :o

Oh, my bad!
Code:
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!