FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
RE: If All Candles Inactive, Fade To Black Script?
(05-04-2013, 12:52 PM)Smoke Wrote: Yes, here it is:
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", 0);
}
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")===3)
{
FadeOut(2);
}
else
{
}
}
Everytime the players unlits a candle, the function 'check' goes active. The function 'check' checks if the variable 'lamplit' is 3. If it's not, it does nothing.Ugh, my english..
Okay, I understand most of that, but why would "lamplit" equal to three when you set the varients to zero? Does that mean if the three "lamplit" items all equal the same fade out?
|
|
05-04-2013, 12:58 PM |
|