Script for XP that allows you to turn on another's self switch?

Brandon Thomason

Dragon Rearling
Veteran
Joined
Oct 21, 2017
Messages
34
Reaction score
6
First Language
English
Primarily Uses
RMMV
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.
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
606
Reaction score
405
First Language
English
Primarily Uses
RMVXA
You should be able to use:
Code:
$game_self_switches[[MAP_ID, EVENT_ID, KEY]] = true
# OR
$game_self_switches[[MAP_ID, EVENT_ID, KEY]] = false
MAP_ID can be the ID of any map (e.g. 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
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,130
Reaction score
12,404
First Language
English
Primarily Uses
RMMV
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
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
148
Reaction score
57
First Language
English
Primarily Uses
RMXP
Literally the same script call, minus the equal sign and the value after it. No need to refresh either.
 

Brandon Thomason

Dragon Rearling
Veteran
Joined
Oct 21, 2017
Messages
34
Reaction score
6
First Language
English
Primarily Uses
RMMV
so, like Conditional Branch: Script: $game_self_switches[[MAP_ID, EVENT_ID, KEY]]
???

That throws an error

error.png
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts


Can't believe I forgot to put an image of my drawing pad! It looks kinda like this, maybe I'll get a better pic tomorrow...
Backup tip: If you don't want to back up your whole project every day, at least back up everything *except* your Image and Audio folders, which you can do weekly/as needed/etc.
The final version of our game is already available both in English and Spanish! ^___^
Can't believe this day has finally come... T_T
Im so happy that Dead By Daylight is getting a Silent Hill chapter! Cant wait to play as pyramid head
I'm glad I found those fishies by @whtdragon so I had a proper base to start pixeling the first enemies in the game.
Such cuties... yeah.

Forum statistics

Threads
97,812
Messages
947,138
Members
129,029
Latest member
aLow62
Top