Hello. I'm looking for a script for RPGmaker XP that allows you to turn on a switch of one object via an event of another object. Plain and simple. If I use control switches, it could get really jam packed with various global control switches, which will only be actually turned on and off once in game.
Script for XP that allows you to turn on another's self switch?
RPG Maker XP SupportYou should be able to use:
MAP_ID can be the ID of any map (e.g.
EDIT: Also, if there isn't enough space in the script call, you can do this:
Code:
$game_self_switches[[MAP_ID, EVENT_ID, KEY]] = true
# OR
$game_self_switches[[MAP_ID, EVENT_ID, KEY]] = false
1 for map 1). If you want to use the current map, use $game_map.map_id. Event ID is the ID of the event (e.g. 3 for event 3). KEY can be "A", "B", "C" or "D", whichever self switch you want to toggle.EDIT: Also, if there isn't enough space in the script call, you can do this:
Ruby:
key = [MAP_ID, EVENT_ID, KEY]
$game_self_switches[key] = true
# OR
$game_self_switches[key] = false
Remember that XP does not refresh the map within the Game_Self_Switches class (or in Game_Switches, or in Game_Variables), but within the Game_Interpreter class, so if it's an event on the current map, you're going to have to do that as well:
Code:
$game_self_switches[[MAP_ID, EVENT_ID, KEY]] = true
$game_map.need_refresh = true
Ok, and how do I check another event's self switch?
Literally the same script call, minus the equal sign and the value after it. No need to refresh either.
so, like Conditional Branch: Script: $game_self_switches[[MAP_ID, EVENT_ID, KEY]]
???
That throws an error
???
That throws an error
It needs to be
$game_self_switches, all lower case.Original thread: https://forums.rpgmakerweb.com/threads/script-for-xp-that-allows-you-to-turn-on-anothers-self-switch.121926/