How do I change an event's self switch through a script command?

Drako King

Villager
Member
Joined
Jun 8, 2016
Messages
5
Reaction score
0
First Language
English
Primarily Uses
I've set up an event; within the event there are move routes for multiple events. I would like to know how to use JavaScript in a Script command from one of the move routes to change a different event's self switch so that it can display text messages on the screen. 


Right now I'm looking through the rpg_core rpg_objects and the other .js files and am currently lost as to what command I would use. I'm looking for any suggestions. 


I'm messing with
 


$dataMap.event(17).command123[1];



but it's still giving me a type error saying that undefined is not a function. I'm not that great with JavaScript, so I'm not sure how close I am to figuring it out. I found that command123 is a Game_Interpreter command meant to change the self switch, and I see that the Game_Event prototype has a Game_Interpreter as a property. Can anyone maybe give some advice?
 
 
Last edited by a moderator:

Drako King

Villager
Member
Joined
Jun 8, 2016
Messages
5
Reaction score
0
First Language
English
Primarily Uses
Hey!


Please see this google doc for the official list of script calls equivalent of event commands:


https://docs.google.com/spreadsheets/d/1-Oa0cRGpjC8L5JO8vdMwOaYMKO75dtfKDOetnvh7OHs/edit?pref=2&pli=1#gid=0


The particular command you want is:



$gameSelfSwitches.setValue(key, true/false); // key = [mapId,eventId,name]

Thank you so much!!! That command did exactly what I was looking for. Also, this document you have provided me is a huge deal to me, so thank you for that!. 
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,101
Reaction score
14,636
First Language
English
Primarily Uses
RMMV
There's also an Outer Self Switch plugin that comes with the engine (it's one of the Kadokawa plugins) that lets you do this through a plugin call.


Personally I'd just use the command above too, as you've got to either add a plugin command or a script call, and going with the script call means one less plugin that's required.  I just wanted to put it out there though :)
 

seyfer110

Veteran
Veteran
Joined
Jan 9, 2014
Messages
46
Reaction score
4
Primarily Uses
Sorry for the necro, but my question is Close-related to this thread, so...
Is it possible to change self-switches of Multiple events with a single script call?
So that instead of doing this:
bandicam 2021-04-14 18-41-37-206.jpg
which turn on self switch A for three consecutive events, I can use a single script to change all three of them at once.
I've tried something like this
Code:
$gameSelfSwitches.setValue([43, 9, 11, 'A'], true)
but of course it doesn't work =(
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,994
Reaction score
2,268
First Language
English
Primarily Uses
RMMV
Sorry for the necro, but my question is Close-related to this thread, so...
Is it possible to change self-switches of Multiple events with a single script call?
So that instead of doing this:
View attachment 186123
which turn on self switch A for three consecutive events, I can use a single script to change all three of them at once.
I've tried something like this
Code:
$gameSelfSwitches.setValue([43, 9, 11, 'A'], true)
but of course it doesn't work =(
You really should have started your own post for this, but since we're here anyway:

JavaScript:
[9, 10, 11].forEach(eventId => $gameSelfSwitches.setValue([43, eventId, 'A'], true));
 

seyfer110

Veteran
Veteran
Joined
Jan 9, 2014
Messages
46
Reaction score
4
Primarily Uses
You really should have started your own post for this, but since we're here anyway:

JavaScript:
[9, 10, 11].forEach(eventId => $gameSelfSwitches.setValue([43, eventId, 'A'], true));
Thanks! :LZSjoy:
 

Latest Threads

Latest Profile Posts

Daz3D has the weirdest number scheme for model generations...
Genesis 4 is the 4th generation and oldest currently available, Genesis 1 is the 5th generation, Genesis 2 is the 6th, 3 is the 7th.... And then it goes Genesis 8. So 4, 1, 2, 3, 8. So when looking through there store you have to remember that sometimes they'll say 6 but they mean 3, and vice versa. :kaoswt:
Would opening a topic with the tutorial be interesting?

Forum statistics

Threads
111,112
Messages
1,058,373
Members
144,326
Latest member
orionalu
Top