08-19-2007, 01:00 PM
Script switch management
by GubiD
Aug 19, 2007
This is so you can flip exiting switches or self switches with script to make it easier for some mapping situations.
You can call the script by doing the following...
To true a switch, $game_map.switches(switch_id, true) to false $game_map.switches(switch_id)
To true a self switch $game_map.switches(1, true, 1, "B"), to false it $game_map.switches(event_id, false, 1, "B")
The "B" is the desired self switch. The self switch must be text so be sure to use "A" or whatever switch you want.
If there are any problems with the script let me know.
by GubiD
Aug 19, 2007
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given.
No support is given.
This is so you can flip exiting switches or self switches with script to make it easier for some mapping situations.
Code:
class Game_Map
def switches(id = 0, value = false, type = 0, switch = "A")
if id > 0
if type == 0 #for use of main switches
#id is switch_id and value should set to true or false
$game_switches[id] = value
elsif type == 1 #For use of self switches
#id is event.id and switch is the desired selfswitch. It must be text!
#value is true or false
key = [$game_map.map_id, id, switch]
# Updates self switch
$game_self_switches[key] = value
end
# Refresh map
$game_map.need_refresh = true
return true
end
end
end
You can call the script by doing the following...
To true a switch, $game_map.switches(switch_id, true) to false $game_map.switches(switch_id)
To true a self switch $game_map.switches(1, true, 1, "B"), to false it $game_map.switches(event_id, false, 1, "B")
The "B" is the desired self switch. The self switch must be text so be sure to use "A" or whatever switch you want.
If there are any problems with the script let me know.