Jump to content
radiantcross13

Resetting Self-Switches A only

Recommended Posts

Hello everyone,

 

I would like to know if there is a way to reset only self switches A. I am already aware of this script call ($game_self_switches = Game_SelfSwitches.new) to reset all self-switches but if I could reset only self-switches A (or any specific letter self-switch for that matter) that would make my day.

Share this post


Link to post
Share on other sites

Yes, it would be for all events across all maps, if possible.

 

Actually, I use a random, respawnable loot system so prefer using self switches and resetting them so I can quickly copy/paste loot events without having to change switches IDs for each (there are lots of loot spots).

 

But I figured it would save me time if I could do that with with the self-switches A and still use other self-switches (B, C, D) for one-time events that I don't want repeated instead of using regular switches.

 

This is what I'll do if I can't reset self-switches A without resetting other self-switches. But using self-switches would save me time and tedium.

 

Sorry If that wasn't clear. I hope it's more understandable now...

Share this post


Link to post
Share on other sites

How about you just use one global switch?  And set up a page on each loot spot that turns Self Switch A off when the page is triggered by the global switch in question?  Would that work?

 

Edit: Shoot, never mind.  I don't know why I thought it would work.

Edited by devonm0

Share this post


Link to post
Share on other sites

Just go through all of the self-switch entries looking for a specific letter and then turn them off

 

class Game_SelfSwitches
  def bulk_set(letter, state)
    switches = @data.keys.select {|data| p data; data[2] == letter }
    switches.each {|key| self[key] = state }
  end
end

class Game_Interpreter
  def bulk_self_switch(letter, state)
    $game_self_switches.bulk_set(letter, state)
  end
end
Usage: script call

 

bulk_self_switch("A", false)
This is only useful for turning off self-switches that are already turned on because switches that have not been changed yet will not exist in the data.

Share this post


Link to post
Share on other sites

Woah, it works! You just saved me a whole lot of time Tsukihime! Thanks a lot!

 

Oh, and it doesn't matter that switches that have not been changed already won't be affected, I really just need to turn OFF those that were turned ON in the first place.

 

That way I can use self-switch A, B and C for my loot system (I have randomly locked doors and chests that use all 3) and still use self-switch D for one-time event. When you exit the dungeon I just turn OFF all self-switches A, B and C through the script call (which I'll do with a common event) and leave self-switches D as is. That way all random loots respawn and one-time/story events won't!

 

Thanks again, I really mean it!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted