Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Help With Levers and Stuckstate
Author Message
heyitsrobert97 Offline
Member

Posts: 68
Joined: Jan 2012
Reputation: 0
Post: #1
Help With Levers and Stuckstate

I need Help With A Big problem with my map. i have places custom levers in the game and they work but when i try to have the lever stick at a place when pulled down they stuff up Undecided so basically their is a fluro ceiling light that is off and when you pull the lever down its supposed to turn on and stick the lever at the down. and then when you pull the lever it unsticks and lets you pull it up so the light turns off. but it doesn't work its just stuck.
anyone know how to make it work?

-----------------------------------------------------------------------------------------------------------

SetEntityConnectionStateChangeCallback("light_switch", "func_switch");
SetEntityPlayerInteractCallback("light_switch", "light", false);
}

void light(string &in asEntity)
{
SetLeverInteractionDisablesStuck("light_switch", true);
}

void func_switch(string &in asEntity, int alState)
{
if (alState == 1)
{
SetLampLit("fluro_1", true, true);
PlaySoundAtEntity("", "click.snt", "Player", 0.0f, false);
SetLeverStuckState("light_switch", 1, false);
}
else
{
if (alState == -1)
SetLampLit("fluro_1", false, true);
PlaySoundAtEntity("", "click.snt", "Player", 0.0f, false);
SetLeverStuckState("light_switch", -1, false);
}
}

But When I Remove The Stuckstate and Player Interaction the script works and they are not stuck. But it only works with lever with one light script in it( so light switches that only start one light work). but others with 2 or more lights strangely do this, when holding the lever down (value 1) the lights stay on. but when i let go (goes to value 0) the lights go out except for the first one on the script code. and when i pull it up (value -1) that one light goes out?

This Darn House! , Four Doors, Youtube
(This post was last modified: 05-31-2012 12:44 PM by heyitsrobert97.)
05-31-2012 12:34 PM
Find all posts by this user Quote this message in a reply
Putmalk Offline
Senior Member

Posts: 291
Joined: Apr 2012
Reputation: 15
Post: #2
RE: Help With Levers and Stuckstate

Hm, try removing the "else { }" and just having two if statements there. That might help.

05-31-2012 03:12 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)