Alright then, just whipped together your exact scenario in my map after I saw your reply. Hopefully this code helps you understand a bit better.
void combolit(string &in asEntity, string &in asType)
{
if(asType == "OnIgnite")
{
// Here I named the candles in ascending order, 1 being what I want lit first, 4 last. Using a local variable, I keep
// track of how far along I am in the sequence. If the right one is lit at the right time, it adds one to how many
// were gotten right, if not, it does nothing.
if((asEntity == "candle_combo_1") && (GetLocalVarInt("combototal") == 0))
{
AddLocalVarInt("comboright", 1);
}
if((asEntity == "candle_combo_2") && (GetLocalVarInt("combototal") == 1))
{
AddLocalVarInt("comboright", 1);
}
if((asEntity == "candle_combo_3") && (GetLocalVarInt("combototal") == 2))
{
AddLocalVarInt("comboright", 1);
}
if((asEntity == "candle_combo_4") && (GetLocalVarInt("combototal") == 3))
{
AddLocalVarInt("comboright", 1);
}
// I add one to the total lit regardless
AddLocalVarInt("combototal", 1);
// If we have all 4 lit...
if((GetLocalVarInt("combototal") == 4))
{
// Were all the ones lit in correct order?
if(GetLocalVarInt("combototal") == GetLocalVarInt("comboright"))
{
PlaySoundAtEntity("rawr", "guardian_ontop.snt", "Player", 0.0f, false);
}
// Or did we get off track somewhere.
else if(GetLocalVarInt("comboright") < GetLocalVarInt("combototal"))
{
// If we got something wrong, reset the checking values
SetLocalVarInt("comboright", 0);
SetLocalVarInt("combototal", 0);
// And kill the candles (timer due to trouble otherwise)
// so player can try again.
AddTimer("killcandles", 0.25f, "killcandles");
}
}
}
}
void killcandles(string &in asTimer)
{
for(int i = 1; i <= 4 ; i++)
{
SetLampLit("candle_combo_" + i, false, false);
}
}
Gotta love how abstractly you have to think for this stuff!