Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Levers
Angerpull Offline
Member

Posts: 88
Threads: 24
Joined: Jun 2011
Reputation: 0
#1
Levers

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
07-27-2011, 08:08 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Levers

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
Website Find
Angerpull Offline
Member

Posts: 88
Threads: 24
Joined: Jun 2011
Reputation: 0
#3
RE: Levers

(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.
07-27-2011, 08:27 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#4
RE: Levers

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

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

07-27-2011, 08:32 PM
Website Find
Angerpull Offline
Member

Posts: 88
Threads: 24
Joined: Jun 2011
Reputation: 0
#5
RE: Levers

(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:

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);
}
}
07-27-2011, 08:44 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#6
RE: Levers

If I need to do this:

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
Find
Angerpull Offline
Member

Posts: 88
Threads: 24
Joined: Jun 2011
Reputation: 0
#7
RE: Levers

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

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.
07-27-2011, 08:59 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#8
RE: Levers

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
Find
Angerpull Offline
Member

Posts: 88
Threads: 24
Joined: Jun 2011
Reputation: 0
#9
RE: Levers

(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
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#10
RE: Levers

(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... :/

07-27-2011, 09:50 PM
Find




Users browsing this thread: 1 Guest(s)