I'M SCARED OF SELF-SWITCHES.

Posts

Pages: 1
On this very board, I read an account of someone who overused them, and then was screwed, because they couldn't outwardly influence the 500 events that depended on them from other parts of the game using regular switches. For some reason, when I began my project years ago, I just didn't "get" self-switches, and stayed away from them. As a result, I ended up using over 2,000 regular switches in my game (ah, such a happy day it was when I hit the 2k mark).

Now that I better understand self-switches, I see how handy they might be, but that one person's story scares me. In VX Ace, the automatic treasure chest event uses self-switches, but in this case, you couldn't have the chest's switch set off an event elsewhere, like when retrieving an item for someone (though I suppose you could just use the "Item" event page handler).

What I'm asking is, what's the best protocol when using self-switches? How can you not "overuse" them and dig yourself a ditch that's all but impossible to get out of? Just limit them to treasure chests, or...?
I personally mainly use them for treasure chests. :)

I use them other places too, but only if I'm sure that the event changing has no bearing on any other event. I used to only use regular switches too, but I didn't know if there was a cap for regular switches, so I started to use self switches more. It's amazing for treasure chests though, all you have to do is copy any treasure chest event and just change the treasure and text, rather than changing the affected switch too.
author=Orias_Obderhode
It's amazing for treasure chests though, all you have to do is copy any treasure chest event and just change the treasure and text, rather than changing the affected switch too.

Sounds wonderful. :)

Only thing, I liked being able to keep track of all the treasure in the game just by looking at the switch array (useful when I wanted to go back and alter the quantity of treasure or just move/change something).

The convenience of self-switches just might offset this, though... so long as I don't "pay for it" like that other poor fella. :(
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
$game_self_switches[[50, 7, 'B']] = false
That'll turn off self-switch B for event 7 on map 50. Use the "script call" command and paste that line of code into it. Change the numbers and letters as necessary. Change the word false to true if you want to turn the switch on instead of off. So you're never really "stuck", you can always access them externally if you need to.

Works in XP, VX, and VX Ace.
...Wow. That's really good to know, LockeZ!

I gotta say, you sure do seem like you're on top of things.
use the following protocol to determine whether you should use a switch or a self switch

ask yourself..."does this event need to be referenced by or effect anything else?". if the answer is no, then a self switch is fine. i usually use self switches for treasure chests, except the few that are plot dependent and trigger cutscenes or whatever.

also lockez little script-nugget is super useful
KingArthur
( ̄▽ ̄)ノ De-facto operator of the unofficial RMN IRC channel.
1217
Treasure chests, one-time auto-start events, random NPCs, stuff like that are great for self-switches.

That said, you don't have to use self-switches and there is nothing wrong with using 2000 ordinary switches in your game. Back in RM2K(3) we didn't have self-switches.
Craze
why would i heal when i could equip a morningstar
15170
I hate clutter, so self-switches are a godsend. I use them as much as possible and cringe when I have to make a normal switch (and even then I have a tendency to just add a new variable to $game_party or $game_map or whatever needs it).

HOWEVER! My current game requires a lot of mindless event-copying due to how "dungeons" work (they are... not normal dungeons at all), and I have to quickly reset the dungeons whenever you enter them again. As such, I wanted to be able to access all the switches easily, but also flick them on as simply as self-switches (read: I did not want to manually set a switch for each and every event, as each map will have like 200+).

So, I made an extremely simple code edit to Game_Event.

def conditions_met?(page)
    c = page.condition
    if c.switch1_valid
      swi = c.switch1_id
      swi = 500 + @event.id if swi == 1
      return false unless $game_switches[swi]
    end
    ...

What this does is make the first "is switch x on?" condition on an event page check to see if it's set to switch 1. If so, it actually checks switch 500 + the event's ID. So, event 56 would check switch 556.

In an event, I just run this snippet to flip that event's "universal self switch" on (note that event_id works because this is run within Game_Interpreter, which defines that variable):

$game_switches[500+event_id] = true

Turning them off is as simple as running a quick for loop.

for i in 500..800 do $game_switches[i] = false end

My in-game switches are limited to the default 100 or so, although I might need more for story stuff later on. Maybe not, though; we'll see.


I have another switch-saving method in place that allows me to tag and store conditional dialogue that I only want to play once. For example, an exchange between Jesse and Carmilla after a normal battle could be stored in a giant array with the following script call:

$game_party.add_diag("JesCarPostBat01")

Later on, I can use the script option in Conditional Branch events to see if that event has already played with this call:

$game_party.diag?("JesCarPostBat01")

It's pretty simple and highly effective. Here's the entire script it runs on (includes my relationship-building calls for extra fun, I guess):

class Game_Party < Game_Unit
  
  alias initialize_gampat_condiag initialize
  def initialize
    initialize_gampat_condiag
    # Start with 30; empty slots for expansion pack characters
    zero_relat = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
    @battle_relationships = []
    @hq_relationships = []
    for i in 1..30 
      @battle_relationships.push(zero_relat)
      @hq_relationships.push(zero_relat) 
    end
    @con_diag = [] # Array for all conditional dialogues ever
  end
  
  # $game_party.diag?(str) "JesCarPostBat01" "ErzWerewolf01"
  def diag?(str); return @con_diag.include?(str); end
    
  # $game_party.add_diag(str)
  def add_diag(str); @con_diag.push(str); end
    
  # $game_party.build_relat("Jesse","Carmilla",5,"battle")
  def build_relat(actor1, actor2, amt=3, type="battle")
    for actor in all_members
      actor1 = actor.id-1 if actor1 == actor.name
      actor2 = actor.id-1 if actor2 == actor.name
    end
    if type == "battle"
      @battle_relationships[actor1][actor2] += amt
      @battle_relationships[actor2][actor1] += amt
    elsif type == "hq"
      @hq_relationships[actor1][actor2] += amt
      @hq_relationships[actor2][actor1] += amt
    end
  end
  
end # Game_Party

EDIT: Feel free to use either of these methods in your own games! I believe they'd work for all Ruby-based engines, and VX Ace at the very least. Here's a trimmed version of the conditional dialogue base script:

class Game_Party < Game_Unit
  
  alias initialize_gampat_condiag initialize
  def initialize
    initialize_gampat_condiag
    @con_diag = [] # Array for all conditional dialogues ever
  end
  
  # $game_party.diag?(str) "JesCarPostBat01" "ErzWerewolf01"
  def diag?(str); return @con_diag.include?(str); end
    
  # $game_party.add_diag(str)
  def add_diag(str); @con_diag.push(str); end
  
end # Game_Party
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
I was going to mention how I used self-switches for dynamically generated events, because there were a potentially infinite number of them and so normal switches wouldn't work, but decided, "No, that's too complex and crazy, they probably don't care." And then holy shit, Craze.
Craze
why would i heal when i could equip a morningstar
15170
My favorite part is that both methods took <5min to make, and that is why 2k3 is fucking terrible.
Pages: 1