I'm developing a game with a minigame, which involves a lot of events and quite a lot of logic.
It works really well! However, the problems come when I leave the map in which the minigame takes place, and then return to that map - and I want it to run a second time, just the same way as the first.
This is a problem as many of the events I've used have states governed by Self-Switches - so when I come back to the map for a 2nd run, much of the logic is broken because the self-switches do not reset upon leaving a map.
Is there a bit of logic I can run in Javascript that would set all self-switches that correspond to a given map to OFF? Like maybe it would loop through all the entries or something.
EDIT: I know you can change a self-switch like this:
$gameSelfSwitches.setValue([mapId, eventID, 'A'], true)
Do I literally just run a loop, given a MapId, through all possible event ID's and set them all to false?
Will it care if I just ask it to go from 0-10,000, and not check if those events actually exist?
It works really well! However, the problems come when I leave the map in which the minigame takes place, and then return to that map - and I want it to run a second time, just the same way as the first.
This is a problem as many of the events I've used have states governed by Self-Switches - so when I come back to the map for a 2nd run, much of the logic is broken because the self-switches do not reset upon leaving a map.
Is there a bit of logic I can run in Javascript that would set all self-switches that correspond to a given map to OFF? Like maybe it would loop through all the entries or something.
EDIT: I know you can change a self-switch like this:
$gameSelfSwitches.setValue([mapId, eventID, 'A'], true)
Do I literally just run a loop, given a MapId, through all possible event ID's and set them all to false?
Will it care if I just ask it to go from 0-10,000, and not check if those events actually exist?