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 Candle scripting help
FragdaddyXXL Offline
Member

Posts: 136
Threads: 20
Joined: Apr 2012
Reputation: 7
#7
RE: Candle scripting help

Or, you could keep track of your recent lit candle with a prevCandle and curCandle. (Previous and current).

You'll also need a variable to keep track of how many you currently have in-a-row. Set that variable to 1.
When player lights a second candle, check to see if it's next in line:

PHP Code: (Select All)
int prevCandle 0;
int combo 1;
void OnStart()
{
     for(
int x 1<= 5x++)
     {
          
SetEntityCallbackFunc("candlestick_wall_"+x"MyFunc");
     }
}

void MyFunc(string &in asEntitystring &in type//This function is ran when a player interacts with a candle
{
//GET WHICH CANDLE NUMBER. In my case I have candles candlestick_wall_1 thru candlestick_wall_5
for(int x 1<= 5x++)
{
     if(
asEntity == "candlestick_wall_"+x)
     {
          
int curCandle x;
     }
}

if(
curCandle == (prevCandle 1))
{
     
combo++;
}
else
{
     
combo 1//if they break the combo, set combo back to 1.
//also, set all the candles here to turn off as to restart the puzzle
curCandle 0//This allows you to start from 1 again.
}
//now check for if you have lit candle 5 while keeping the combo up

if(combo == && curCandle == 5)
{
     
//run code for solving  puzzle here
     
return;
}

//At the end of this block, make sure you set the curCandle to prevCandle
prevCandle curCandle;


Dark Seclusion Here
(This post was last modified: 05-24-2012, 09:19 PM by FragdaddyXXL.)
05-24-2012, 08:56 PM
Find


Messages In This Thread
Candle scripting help - by Hatred - 05-23-2012, 08:17 PM
RE: Candle scripting help - by Obliviator27 - 05-23-2012, 08:40 PM
RE: Candle scripting help - by Hatred - 05-23-2012, 08:42 PM
RE: Candle scripting help - by Rapture - 05-23-2012, 08:54 PM
RE: Candle scripting help - by Hatred - 05-23-2012, 09:10 PM
RE: Candle scripting help - by FlawlessHappiness - 05-24-2012, 07:49 PM
RE: Candle scripting help - by FragdaddyXXL - 05-24-2012, 08:56 PM



Users browsing this thread: 1 Guest(s)