In a for loop, if a continue statement is hit, the loop will exit instead of continuing, but only under certain conditions. If there is an if/continue at the start of the loop then this seems to cause the unexpected behaviour. Simplified code below.
In the code, I expect the message to be printed saying ‘your number is 7’. However, when the code enters the condition ‘if Event Player.Player2’ it goes to the continue in the else block and exits the loop early. I would like this to be looked at by any other modders or OW devs to check it’s actually a bug in the workshop backend.
variables
{
player:
26: Player1
27: Player2
}
rule("rule")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Has Spawned(Event Player) == True;
}
actions
{
Event Player.Player1 = True;
Event Player.Player2 = False;
For Player Variable(Event Player, A, 0, 10, 1);
If(Event Player.A == 3);
Continue;
End;
If(Event Player.A == 5);
If(Event Player.Player2);
Small Message(All Players(All Teams), Custom String("your number is 5"));
Else;
Continue;
End;
Else If(Event Player.A == 7);
If(Event Player.Player1);
Small Message(All Players(All Teams), Custom String("your number is 7"));
Else;
Continue;
End;
End;
End;
}
}