PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: If All Candles Inactive, Fade To Black Script?
(05-04-2013, 02:05 PM)martinnord Wrote: (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..
Im curious, whats the difference between using 2 is equal to signs and using 3, to be more specific whats the difference between "==" and "==="
Me too. This isn't in the comparison operators.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
05-04-2013, 02:07 PM |
|