Frictional Games Forum (read-only)
[SCRIPT] Levers - 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] Levers (/thread-19946.html)



Levers - assassinhawk45 - 01-15-2013

I'm having trouble with scripting a lever. I'm am trying to make it activate a monster, but when I pull it, it doesn't do anything.

Script:
void OnStart()
{
AddEntityCollideCallback("Player", "trap_1", "Jump1", true, 1);
}
void Jump1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("fail_1", true);
}


RE: Levers - The chaser - 01-15-2013

You are doing it wrong:

Copy&paste this:

Code:
void OnStart()
{
SetEntityConnectionStateChangeCallback("lever", "func_shelf");
}


void func_shelf(string &in asEntity, int alState)
{
     if (alState == 1)
     {
     SetEntityActive("fail_1", true);
     }
}
Hope it works!


RE: Levers - assassinhawk45 - 01-15-2013

Do I have to do anything for the lever? I put the script in and nothing happened. I'm guessing it migh thave to do with something in the level editor, but I'm not sure.


RE: Levers - The chaser - 01-15-2013

Ofc, change the name of the lever to "lever". The problem must be the names.


RE: Levers - assassinhawk45 - 01-15-2013

Thanks, it's working now