Frictional Games Forum (read-only)

Full Version: How to make Iron maiden slam doors shut.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I'm working on a custom story and for the gameplay the player needs to go into an iron maiden so he can hide from the monster. But I want to program it so that when the player gets inside the iron maiden it will slam the doors shut on the player so the iron maiden is definitely closed. Any ideas how this can be achieved with a script. I have it set up so far that when the player enters the iron maiden a collision script is set to run but I just can't get the doors slam shut. Any advice or ideas?
I looked at the entity in the level editor and it has all of the same options as a door; try using setswingdoorclosed or setswingdoorlocked (this will automatically close it+make it unopenable, unless unlocked). Just make sure you have the entity collide callback far enough back in the maiden so there's no chance the place could be on the outside when the even occurs.

Hope that helped
Grab it and push them shut =D
I also created a story where you couldn't open the door of the iron maiden once inside , that's how i did:

Creates a script area (inside the iron maiden) that call once it collide with the player. Use SetSwingDoorClosed to make the door close by itself .Then , you can call StartPlayerLookAt("iron_maiden_1") to make the player look at the door , than , SetPlayerActive(false) , which would make the player unable to move and to interact with the iron maidan door.

In my custom story , once i called SetPlayerActive , i created a timer that waits 1 second , than , i added footsteps noise from outside of the iron maiden , you can do this , it's an awesome scare Big Grin


I would really appreciate +rep if it helped you out Smile
...Or, if you actually want them to shut on their own, you can examine the games script for when the iron maiden opens and reverse it.

I have found it:

///////////////////////////////////////////////////
// Iron Maiden doors opening scare
void OpenIronMaiden(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Scary iron maiden opening", false);

SetSwingDoorDisableAutoClose("iron_maiden_2", true);
SetSwingDoorClosed("iron_maiden_2", false, false);

/////////////////////////////////////////////
// Open iron maiden doors
AddBodyImpulse("iron_maiden_2_leftDoor", -0.7, 0 , -0.7, "world");
AddBodyImpulse("iron_maiden_2_rightDoor", -0.7, 0 , 0.7, "world");

AddTimer("TimerExtraMaidenImpulse", 0.1, "TimerExtraMaidenImpulse");

PlaySoundAtEntity("AreaIronMaidenEffect", "24_iron_maiden", "AreaIronMaidenEffect", 0.0f, false);

PlayerReact(0.5f);

CreateParticleSystemAtEntity("maidensmoke","ps_iron_maiden_event_smoke.ps", "AreaIronMaidenEffect", false);
StartScreenShake(0.1f, 0.1f, 0.0f, 0.1f);

// Disable trigger area and activate room sanity drain
SetEntityActive("AreaIronMaidenOpen", false);
SetEntityActive("AreaInsanityEffect_1", true);

GiveSanityDamage(10.0f, true);
SetRadialBlurStartDist(0.4f);
FadeRadialBlurTo(0.2f, 0.4f);

AddTimer("TimerActiveMaidenEmotion",1.5f,"TimerActiveMaidenEmotion");
}

void TimerExtraMaidenImpulse(string &asTimer)
{
AddBodyImpulse("iron_maiden_2_leftDoor", -0.7, 0 , -0.7, "world");
AddBodyImpulse("iron_maiden_2_rightDoor", -0.7, 0 , 0.7, "world");
}