Hi, I am having a blast using MV. My game demo allows for saving at the end for a sort-of NewGame+ mode, where you keep all your experience, items and gold. But I noticed that all self switches I used were still set ON. I guess that is to be expected, though.
Because those self switches hinder the second cycle of the game, I needed to find out a way to turn them all OFF. After looking through the forums last night, I decided to brute force it at the introduction, but I still think I need to heavily optimize my code.
I am using the following Script call at my introduction scene:
But it takes about... ten to fifteen seconds to run through that loop. Also, I fear it takes even longer as I add more maps and events on the game. Thus, I'd like to know a few things. Instead of running through 999 maps (or whatever I set the number as), is there a way to run only as many loops as there are maps? I tried something like mapId.length but ran into errors. Also, the second loop. I know there is this $dataMap.events.length, but isn't that referring to the current loaded map? I might have pulled that from the 'Outer Self Switch' plugin or from the forums, can't really remember at the moment.
Thanks in advance.
-Zelgadis85
Because those self switches hinder the second cycle of the game, I needed to find out a way to turn them all OFF. After looking through the forums last night, I decided to brute force it at the introduction, but I still think I need to heavily optimize my code.
I am using the following Script call at my introduction scene:
Code:
for (var mapId = 1; mapId < 999; mapId++) { for (var eventId = 1; eventId < 999; eventId++) { $gameSelfSwitches.setValue([mapId, eventId, 'A'], false); $gameSelfSwitches.setValue([mapId, eventId, 'B'], false); $gameSelfSwitches.setValue([mapId, eventId, 'C'], false); $gameSelfSwitches.setValue([mapId, eventId, 'D'], false); }}
Thanks in advance.
-Zelgadis85