The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Script Help Why won't this script work?
ferryadams10 Offline
Senior Member

Posts: 288
Threads: 40
Joined: Apr 2011
Reputation: 19
#1
Why won't this script work?

Hi guys.

What I'm trying to do is make the SlideDoor2 go open when I've set all levers in a proper order.

lever_1, 3 and 4 should be down

lever_2 and 5 should be up.

But.. Now the PerformLeverTaskCompleted starts working as soon as I pull just a random lever.

Please help me to make the SlideDoor2 open when I put em in the right order. Sad

PHP Code: (Select All)
////////////////////////////
// Run first time starting map
void OnStart()
{
//START LEVER PUZZLE//
 
SetEntityConnectionStateChangeCallback("lever_1""StoreCheckLeverState");
 
SetEntityConnectionStateChangeCallback("lever_2""StoreCheckLeverState");
 
SetEntityConnectionStateChangeCallback("lever_3""StoreCheckLeverState");
 
SetEntityConnectionStateChangeCallback("lever_4""StoreCheckLeverState");
 
SetEntityConnectionStateChangeCallback("lever_5""StoreCheckLeverState");
 
SetEntityConnectionStateChangeCallback("lever_6""StoreCheckLeverState");
//END LEVER PUZZLE//
}
//START LEVER PUZZLE//
void CheckLeverStates()
{
 if (
GetLocalVarInt("lever_1") == -1
 
&& GetLocalVarInt("lever_2") == 1
 
&& GetLocalVarInt("lever_3") == -1
 
&& GetLocalVarInt("lever_4") == -1
 
&& GetLocalVarInt("lever_5") == 1
 
&& GetLocalVarInt("lever_6") == 1)
{
 
PerformLeverTaskCompleted();
}
}
void PerformLeverTaskCompleted()
{
 
SetMoveObjectStateExt("SlideDoor2"1.0f1.0f1.0f0.0ffalse);
}
void StoreCheckLeverState(string &in entityint state)
{
 
SetLocalVarInt("lever_1", -1);
 
SetLocalVarInt("lever_2"1);
 
SetLocalVarInt("lever_3", -1);
 
SetLocalVarInt("lever_4", -1);
 
SetLocalVarInt("lever_5"1);
 
SetLocalVarInt("lever_6"1);
 
CheckLeverStates();

//END LEVER PUZZLE// 

Got a nice sofa
Please come and have a seat for a while

12-17-2011, 04:29 PM
Find


Messages In This Thread
Why won't this script work? - by ferryadams10 - 12-17-2011, 04:29 PM
RE: Why won't this script work? - by palistov - 12-17-2011, 05:18 PM
RE: Why won't this script work? - by Dobbydoo - 12-17-2011, 05:29 PM
RE: Why won't this script work? - by Dobbydoo - 12-17-2011, 07:50 PM
RE: Why won't this script work? - by ferryadams10 - 12-17-2011, 06:52 PM
RE: Why won't this script work? - by palistov - 12-17-2011, 07:10 PM
RE: Why won't this script work? - by ferryadams10 - 12-21-2011, 08:29 PM



Users browsing this thread: 1 Guest(s)