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,127
Reaction score
14,643
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
3,006
Reaction score
2,274
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 Posts

Latest Profile Posts

Screenshot-2021-05-02-at-15-07-54.png


Tivadar will help you travel to distant places in Eniko: Ghosts Of Grace

Finally done with the school project, here's the raw video of it. o_O :smile:
Can February March? No, but April May.

Forum statistics

Threads
111,173
Messages
1,058,959
Members
144,419
Latest member
harry30705
Top