Explanations: Lately I have been experimenting with some spikes puzzles and global control for the spikes. Puzzles look simple - you have a controller event (button) and spike events (multiple for each button). When the button is pressed it brings down the spikes so that the player can pass. Then it turns into a parallel event that counts N frames in the background and after the frame window ends the spikes go back up. Here is a screenshot of the first page of the controller event:
The second one is the same but it basically turns off each individual Self Switch A. However, in order to turn these on I need to call the command 3 times and manually type all the IDs all of the spikes events. What I want to do instead I imagine like that (I just need the right "wording" for it):
Code:
mapid = $gameMap.mapId();
sswitch = "A";
ss = true;
//Define some array with manually chosen event IDs
//Define variable l with the number of elements that the array contains
for (var i = 0; i <= l; ++i)
{var key = [mapid, array[i], sswitch];
$gameSelfSwitches.setValue(key, ss);}Could you help me do that? Also, if there if there is some nifty way to make a code that checks all events notes for some special tag like "<Spikes1>", "<Spikes2>" and take all event IDs for the events tagged with the specific note.
If you ask why don't I just use global switch for this then...you have a point here! I cannot do that though. I implemented in my game "restart puzzle on command" system. Press R to restart the puzzle. It brings the player to the entrance of the puzzle and restarts all self switch A (to OFF) of all events in the map. So I would like to have these restarted when the player presses R as well. I am also a little sceptic about how the game would react if the player leaves the screen before the parrallel event could have restarted the spikes for example.
I use global switches only for events that must not be affected by the restart (like taking a special item, learning a crucial skill or having perma block on some of your paths) and self switches for all else.