Turn all self switches off on a map?

Hi everyone,

I'm running out of time, too much on my head yet I still want to finish my submission.

Is there a command or something i can use to turn all the self switches on / off  on a map on somehow? Otherwise making switches for each little item it going to be a nightmare and will take quite some time... I'd rather add more content in the meantime. Or just something like turn all ''A'' switches on the map with the ID 001, I really don't know what script calls I could use there...

Thanks a ton!
You could use a conditional branches to tie them all into a single variable trigger, as I have done this in the past.  But there may be an easier way.  Perhaps a better mind has a better answer.   🤘
Hmm... I'm not sure how I could make that work, maybe with some really complex branch as they are all separate things. I'd just erase event, but it would mean infinite loot... Hmm.

Ah, I also forgot to mention that I'd need to change them from a different map.
No, just have them all conditional at the beginning  on the last page, that if the "reset" condition is met, it turns the it's own self-switch off.  It was a pain in the butt though, I will admit, and I never did get it working exactly like the reset spell I was after.   :headshake:

I found this floating around. Could this help you?

https://grimoirecastle.wordpress.com/2012/02/03/self-switch-reset/

Edit:  You can not have the conditional branch for reset at the beginning.  It has to be on the self switch page you would be resetting from.  My apologies.
You can use a script call to turn off a self switch, regardless of what map it is on. The call is

$game_self_switches[[map id, event id, self switch id]] = 'false' will turn it off.

Note though that for the self switch id the id has to be enclosed in ''. So for switch A, you would use 'A'.

You might be able to use that and a loop to do it from another map?
If you know which switches will be turned off and on, try this:

[*1..10].each do |random name|
  $game_switches[random name] = false
end


1..10 groups together the switches with the id number 1 to 10.
 

If you want to group random switches then try this:

[1,5,10,3000].each do |another random name|
  $game_switches[another random name] = false
end

 

You can combine this the with script call above like this:

[1,5,10,3000].each do |event_id|
  $game_self_switches[@map_id, event_id, "A/B/C/D"] = false
end


@map_id should automatically replace itself with the number of the map you are in, in case the self switches you want to deactivate are in the same map.
 
This is the little scriptlet I use to reset all 'D' self switches on a particular map.

Code:
class Game_Interpreter  def reset_gather_points(map_id)    map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))    map.events.each do |i, event|      key = [map_id, i, 'D']      $game_self_switches[key] = false    end  endend
You call it with a script call of reset_gather_points(id of map). Or you could just copy the body of it into a script call if it's not something you're going to be using as extensively as what I was using it for.
Huh, both solutions will work, thanks!

Feel free to close it.
If you want your thread closed, please Report your opening post (the Report button is bottom right, near the multiquote button) and ask for it to be closed.  The mod for this forum might not see your post, but will see your Report.

Thanks.

Original thread: https://forums.rpgmakerweb.com/threads/turn-all-self-switches-off-on-a-map.43314/