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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Another Lever help thread[SOLVED]
Rownbear Offline
Member

Posts: 157
Threads: 13
Joined: Apr 2011
Reputation: 2
#1
Another Lever help thread[SOLVED]

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
(This post was last modified: 05-15-2011, 08:18 PM by Rownbear.)
05-15-2011, 05:04 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#2
RE: Another Lever help thread

Try this:

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;
     }
}
}

05-15-2011, 05:46 PM
Find
Rownbear Offline
Member

Posts: 157
Threads: 13
Joined: Apr 2011
Reputation: 2
#3
RE: Another Lever help thread

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
05-15-2011, 06:02 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: Another Lever help thread

Oh, I know what's wrong...

The SetEntityActive command doesn't always work for everything.

Try replacing it with a closet or something.

05-15-2011, 06:13 PM
Find
Rownbear Offline
Member

Posts: 157
Threads: 13
Joined: Apr 2011
Reputation: 2
#5
RE: Another Lever help thread

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?
(This post was last modified: 05-15-2011, 06:18 PM by Rownbear.)
05-15-2011, 06:17 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#6
RE: Another Lever help thread

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

05-15-2011, 06:18 PM
Find




Users browsing this thread: 1 Guest(s)