Frictional Games Forum (read-only)
Another Lever help thread[SOLVED] - 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: Another Lever help thread[SOLVED] (/thread-8015.html)



Another Lever help thread[SOLVED] - Rownbear - 05-15-2011

So I'm not very experienced in scripting but I want it so that when I pull the a lever down it moves a shelf or deactivate the current shelf and reactivate the moved shelf. It's probably easy enough but I just can't get it to work.

void OnStart()
{
SetEntityConnectionStateChangeCallback("Lever_1", "SecretShelf");
}

void SecretShelf(string &in EntityName, int alState)
{
if (alState == -1)
{
SetEntityActive("Shelf_1", false);
SetEntityActive("Shelf_2", true);
}
}

Help appreciated Smile


RE: Another Lever help thread - Kyle - 05-15-2011

Try this:

Code:
void OnStart()
{
     SetEntityConnectionStateChangeCallback("Lever_1", "SecretShelf");
}
void SecretShelf(string &in asEntity, int alState)
{
     if (alState == 1)
     {
          SetEntityActive("Shelf_1", false);
          SetEntityActive("Shelf_2", true);
          return;
     }
}
}


RE: Another Lever help thread - Rownbear - 05-15-2011

Nope it doesnt work :-\ If Anyone have a functional Lever - door function please post it so I can see what you guys did to get it to work Smile


RE: Another Lever help thread - Kyle - 05-15-2011

Oh, I know what's wrong...

The SetEntityActive command doesn't always work for everything.

Try replacing it with a closet or something.


RE: Another Lever help thread - Rownbear - 05-15-2011

You know I just did, I tried it with a closet and it worked, Thank you! Big Grin
Would you happen to know how I get like a message up "It's locked" when a player click on the door?


RE: Another Lever help thread - Kyle - 05-15-2011

You're welcome. I had the same exact problem until I replaced it with a closet... XD