Frictional Games Forum (read-only)
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: Levers (/thread-9427.html)

Pages: 1 2


Levers - Angerpull - 07-27-2011

How can I make a functional Lever to open a door? Can someone make a script for me to do this?

The levers name is: Slaver_Lever
The door's name is: Slaver_Lever_Door

Thanks in advance!

-Angerpull Angel


RE: Levers - Tanshaydar - 07-27-2011

void MyFunction(string &in asEntity, int alState)
{
if( alState == 1)
{
SetMoveObjectState("Slaver_Lever_Door", 1);
}
}


Put this to your OnStart:
SetEntityConnectionStateChangeCallback("Slaver_Lever", "MyFunction");


RE: Levers - Angerpull - 07-27-2011

(07-27-2011, 08:15 PM)Tanshaydar Wrote: void MyFunction(string &in asEntity, int alState)
{
if( alState == 1)
{
SetMoveObjectState("Slaver_Lever_Door", 1);
}
}


Put this to your OnStart:
SetEntityConnectionStateChangeCallback("Slaver_Lever", "MyFunction");

It doesn't work, the door doesn't unlock or anything. The lever just moves up and down and won't do anything to the door. It just keeps itself locked.


RE: Levers - Tanshaydar - 07-27-2011

Is it a traditional door? I thought it was a door that moves upside.
Anyway, here's the code for you:

Code:
void MyFunction(string &in asEntity, int alState)
{
if( alState == 1)
{
  SetSwingDoorLocked("Slaver_Lever_Door", false, true);
}
}



RE: Levers - Angerpull - 07-27-2011

(07-27-2011, 08:32 PM)Tanshaydar Wrote: Is it a traditional door? I thought it was a door that moves upside.
Anyway, here's the code for you:

Code:
void MyFunction(string &in asEntity, int alState)
{
if( alState == 1)
{
  SetSwingDoorLocked("Slaver_Lever_Door", false, true);
}
}

It still doesn't work. Do I have to do something about the lever? Or anything? The door doesn't unlock and it just doesn work. Anything wrong with the script?

Spoiler below!
SetEntityConnectionStateChangeCallback("Slaver_Lever", "Lever_Slaver");

void Lever_Slaver(string &in asEntity, int alState)
{
if( alState == 1)
{
SetSwingDoorLocked("Slaver_Lever_Door", false, true);
}
}



RE: Levers - Kyle - 07-27-2011

If I need to do this:

Code:
void OnStart()
{
     SetEntityConnectionStateChangeCallback("Slaver_Lever", "Lever_Slaver");
}
void Lever_Slaver(string &in asEntity, int alState)
{
     if (alState == 1)
     {
          SetSwingDoorLocked("Slaver_Lever_Door", false, true);
     }
}



RE: Levers - Angerpull - 07-27-2011

(07-27-2011, 08:50 PM)Kyle Wrote: If I need to do this:

Code:
void OnStart()
{
     SetEntityConnectionStateChangeCallback("Slaver_Lever", "Lever_Slaver");
}
void Lever_Slaver(string &in asEntity, int alState)
{
     if (alState == 1)
     {
          SetSwingDoorLocked("Slaver_Lever_Door", false, true);
     }
}

Still doesn't work. This is frustrating. The door keeps shut, the lever can only be moved up and down with nothing happening.


RE: Levers - Kyle - 07-27-2011

Make sure that everything is named correctly, or else I have hardly an idea why it's messing up. :/


RE: Levers - Angerpull - 07-27-2011

(07-27-2011, 09:26 PM)Kyle Wrote: Make sure that everything is named correctly, or else I have hardly an idea why it's messing up. :/

Everything is named correctly. Why won't it work? Can you maybe make your own level and name the door and the lever the same and test it?


RE: Levers - Kyle - 07-27-2011

(07-27-2011, 09:35 PM)Angerpull Wrote:
(07-27-2011, 09:26 PM)Kyle Wrote: Make sure that everything is named correctly, or else I have hardly an idea why it's messing up. :/

Everything is named correctly. Why won't it work? Can you maybe make your own level and name the door and the lever the same and test it?

I made it exactly with the same names and the same script pieces. It works perfectly, and the way it should. I'm not sure why it doesn't work for you... :/