Frictional Games Forum (read-only)

Full Version: Levers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
void MyFunction(string &in asEntity, int alState)
{
if( alState == 1)
{
SetMoveObjectState("Slaver_Lever_Door", 1);
}
}


Put this to your OnStart:
SetEntityConnectionStateChangeCallback("Slaver_Lever", "MyFunction");
(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.
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);
}
}
(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);
}
}
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);
     }
}
(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.
Make sure that everything is named correctly, or else I have hardly an idea why it's messing up. :/
(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?
(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... :/
Pages: 1 2