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
If All Candles Inactive, Fade To Black Script?
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#4
RE: If All Candles Inactive, Fade To Black Script?

No, I just added a variable in OnStart() with the number 0. Everytime he collides with the script_area, the AddLocalVarInt adds 1 on top of that. So first time 0 + 1 = 1. So after the player unlits the first candle, the lamplit variable = 1. Same with the second and third candle. You can check this with if(GetLocalVarInt("lamplit")===1) and if(GetLocalVarInt("lamplit")===2). And letting them play a sound or something in brackets.

This script would do the same:

void OnStart()
{
AddEntityCollideCallback("script_area1", "Player", "Func1", true, 0);
AddEntityCollideCallback("script_area2", "Player", "Func2", true, 0);
AddEntityCollideCallback("script_area3", "Player", "Func3", true, 0);
SetLocalVarInt("lamplit", 5);
}

void Func1(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle1", false, true);
AddLocalVarInt("lamplit", 1);
check();
}

void Func2(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle2", false, true);
AddLocalVarInt("lamplit", 1);
check();
}

void Func3(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candle3", false, true);
AddLocalVarInt("lamplit", 1);
check();
}

void check()
{
if(GetLocalVarInt("lamplit")===8)
{
FadeOut(2);
}
else
{

}
}

It's just easier to start with 0 instead of 5.
(This post was last modified: 05-04-2013, 01:06 PM by OriginalUsername.)
05-04-2013, 01:01 PM
Find


Messages In This Thread
RE: If All Candles Inactive, Fade To Black Script? - by OriginalUsername - 05-04-2013, 01:01 PM



Users browsing this thread: 1 Guest(s)