RPG MAKER VX SCRIPTING QUESTION

Posts

Pages: 1
Max McGee
with sorrow down past the fence
9159
REGRET! I regret structuring 500+ events as using "Self-Switches" when they should have used 500 individually denominated switches. Now there is no way to effect them with outside events.

My question is, is there anyway through scripting to effect the "self switches" of certain events? Otherwise I'm faced with the insur-fucking-mountable task of manually changing all 500+ events. D'oh!

The captcha for this topic was busybro, lol.
At work so I can't check it myself but iirc there is a global variable that has all of the self switch settings for everything. Probably $self_switches, you can manipulate it from an event->script call once the key format is known. I'll take a quick look later today if you can't find it.
Max McGee
with sorrow down past the fence
9159
Thanks, I'd really appreciate that GRS! My scripting skills are REALLY basic. I figure there's gotta be SOME way to do it, though.
Got it. Do this in an event->script:

$game_self_switches[[map_id, event_id, selfswitchletter]] = true / false

$game_map.need_refresh = true

Replace map_id with the map ID of the evente, event_id with the event ID (see the top of the edit event window), and selfswitchletter with "A", "B", "C", or "D".

ex:

$game_self_switches[[1,1,"A"]] = false

$game_map.need_refresh = true
Remember the double brackets otherwise it'll crash.

*edit*
For clarity, the '$game_map.need_refresh = true' is needed to propagate self switch changes during the next update cycle. If you're doing a lot of self switch changes you only need one need_refresh.
LouisCyphre
can't make a bad game if you don't finish any games
4523
For reference, you can call upon anything that starts with a "$" anywhere you can call on script functions.

A lot of valuable bits of information, like $game_party and $game_switches, can be called on this way. Monkey-see-monkey-do helps a lot with this.
Max McGee
with sorrow down past the fence
9159
Thanks GRS. Is it possible with that code to target multiple event IDs at once, or do I need a new $line for each event?
You can replace any of the numbers with a $game_variables if you want to integrate variables through events. You can also do a Ruby loop like so:

for i in 0..10
  $game_self_switches[[1,i,"A"]] = false
end

$game_map.need_refresh = true

To affect event IDs 0 to 10 (including both 0 and 10). Change that 0..10 accordingly to affect the range.

Combine both for more power!
for i in 0..$game_variables[100]
  $game_self_switches[[1,i,"A"]] = false
end

$game_map.need_refresh = true

To go from 0 to the value stored in variable 100.
Pages: 1