Frictional Games Forum (read-only)
Another need for help in scripting - 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: Another need for help in scripting (/thread-10329.html)



Another need for help in scripting - OccultedNinJa - 09-15-2011

I'm pretty new at scripting, and I have a lot of questions. I've read the tutorials, and I know where to find the scripts in the wiki. I mostly need help with proper placement of the scripts, and how to get them to work properly. I have some that work really well thanks to previous threads, but there are some more specific needs for the custom story I'm creating that I still need help with. So I was wondering if there's anyone who is kind enough to lend an ear and a helping hand to a scripting nublet, starting with how to get the doors to a cupboard to fly open when entering the script area. Here's the code that I have for the script already.

Code:
void Scare(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("deathcloset", false, true);
GiveSanityDamage(80, true);
PlayGuiSound("react_scare.snt", 0.5f);
PlayGuiSound("insanity_whisper.snt", 0.5f);
PlayMusic("01_amb_darkness.ogg", false, 10, 0.5f, 0, false);
}

I saw somewhere about using the SetSwingDoorClosed script to cause doors to fly open or closed. Have I done this correctly or does it need tweaking?





RE: Another need for help in scripting - Khyrpa - 09-15-2011

I think SetSwingDoorClosed does not work for closets. Just use PropForce instead.



RE: Another need for help in scripting - OccultedNinJa - 09-15-2011

EDIT: I figured it out. It's the AddPropImpulse code, not the force one. Regardless it definitely got me pointed in the right direction. Big Grin