Frictional Games Forum (read-only)
Lever that controls door or hatch! - 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: Lever that controls door or hatch! (/thread-4477.html)



Lever that controls door or hatch! - tkmatty - 09-17-2010

Simple question: how do I script the lever/button etc, to open a door/hatch ??


RE: Lever that controls door or hatch! - theDARKW0LF - 09-18-2010

I'd like to know the same, someone able to assist?


RE: Lever that controls door or hatch! - swat1cat - 09-18-2010

(09-18-2010, 12:18 AM)theDARKW0LF Wrote: I'd like to know the same, someone able to assist?

06_distillery.map has a crank that opens a hatch - I would check that level and see how they did it.


RE: Lever that controls door or hatch! - tkmatty - 09-18-2010

Ok ive found something out by checking scrips from other maps.
I need to name my controller, in this case it's elevator_lever_1. I named it in the ConnectionStateChangeCallback (CSCC) as Lever1 then the script should go something like this:

//Function: ConnectionStateChangeCallback
void Lever1(string &in asEntity, in alState)
{
//If the lever is pulled max up or down then open hatch_metal01_1
if(alState == 1 or alState == -1)
{
//NO idea what to script here.. i know it should be some kind of code "if" lever is in some state it should activate the hatch to open "false or true" depends on the value on the lever.
}
}

one extra question: can I put this script anywhere in my deafault script or does it need a specific place to be? thanks
As for the question over I think it's an interresting topic for noobs like meWink