Frictional Games Forum (read-only)
[SOLVED] Making closet doors slam up? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: [SOLVED] Making closet doors slam up? (/thread-6314.html)



[SOLVED] Making closet doors slam up? - Linus Ågren - 01-21-2011

[SOLVED]
How do you script so that if you are close to a closet, the doors will slam up? I only need the script for the doors!


RE: Making closet doors slam up? - Shev - 01-21-2011

Probably AddPropForce

Code:
AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);



RE: Making closet doors slam up? - Tanshaydar - 01-21-2011

And see the correct direction in the level editor. Probably -Z, but very likely to be different.
And do it like 1000.0f


RE: Making closet doors slam up? - Linus Ågren - 01-21-2011

Btw, I know practically nothing of coding in this lang (is it c++?). My code looks like this. Do I need any other code for the AddPropForce? Cause I'm not entirely sure how it works ^^

Code:
void CollideClosetScare(string &in asParent , string &in asChild , int alState)
{
GiveSanityDamage(6.0f, true);
PlaySoundAtEntity("Scare_1", "react_pant.snt", "Player", 0, true);
}



RE: Making closet doors slam up? - Tanshaydar - 01-21-2011

You want to close the door when player enters that area?
Code:
    SetSwingDoorLocked("door_name", false, false or true);
    SetSwingDoorClosed("door_name", false, false or true);
    SetSwingDoorDisableAutoClose("door_name", true);
    AddPropImpulse("door_name", 0.0f, 0.0f, 10000.0f, "World" or "Local");

I wrote "or" where it depends on what you want to do.


RE: Making closet doors slam up? - Linus Ågren - 01-21-2011

Thank you! Works flawlessly Big Grin
One last question.

Can you test your map from the editor? (Not using MapView)


RE: Making closet doors slam up? - Tanshaydar - 01-21-2011

Of course. Just upload it somewhere and many people here, including me, will gladly test it.


RE: Making closet doors slam up? - Linus Ågren - 01-21-2011

It's not near complete yet Big Grin
What I meant btw, was to test it from the actual editor, and not starting the game to test it, like if it is some hotkey to try it.


RE: Making closet doors slam up? - Tanshaydar - 01-21-2011

LOL. These days I have some understanding issues.
You have to start the game to test it. You can setup a dev_environment to make it faster.


RE: Making closet doors slam up? - Linus Ågren - 01-21-2011

Haha it can happen to anyone.

Thanks again for the help! Big Grin