Frictional Games Forum (read-only)
[SCRIPT] I Want To Break A Ladder. - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] I Want To Break A Ladder. (/thread-21518.html)



I Want To Break A Ladder. - thestormcrow - 05-16-2013

I wanted a ladder to break as the player is climbing down it for a scare. The following is in my script file:

void OnStart()
{
AddEntityCollideCallback("Player", "LadderBreakArea", "BreakLadder", true, 1);
}

void OnEnter()
{
PlayMusic(("12_amb.ogg"), true, 1, 10, 0, false);
}

void OnLeave()
{
StopMusic(1, 0);
}

void BreakLadder(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("ladder", 0);
SetEntityActive("LadderArea_1", false);
}


The ladder does not break and the ladder area doesn't deactivate til the player leaves it. Have I made some mistake/can anyone suggest a suitable workaround?


RE: I Want To Break A Ladder. - str4wberrypanic - 05-17-2013

I think it doesn't break because the ladder haven't an animation for it.


RE: I Want To Break A Ladder. - 7heDubz - 05-17-2013

once the player is in the area, whether it is turned on or off the player will still be on it as you said. try using playerforce ( like prop force) to move the player away from the ladder area... might work.


As for the animation I don't know.


RE: I Want To Break A Ladder. - Daemian - 05-17-2013

I would try ChangePlayerStateToNormal(); to make the player fall.
Then, i'd replace the stairs with smaller parts. And don't forget the sound.



RE: I Want To Break A Ladder. - palistov - 05-17-2013

Have you tried pushing the player off of the ladder area when it breaks? PlayerAddForce or something like that. Can't quite remember.

Edit: Or maybe try teleporting them to a script area very close to where they would be when the event triggers. Combine that with some screen shaking and it shouldn't be noticeable.


RE: I Want To Break A Ladder. - FlawlessHappiness - 05-17-2013

Easy way: FadeOut(0);
and play a sound