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,212
Reaction score
14,684
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,064
Reaction score
2,323
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


concept: zombie slayer fest.

Lag because of outdated hardware.

Lots todo:
-Terrax lightning should have another step for the flashlight, between up down left right.
-Also Online mv from Nelderson should emit the flashlight from the other player.
-Animation needed for killing the zombie...
Before adding it to #crypchania.
Working on a case. Get all the evidence to prosecute some bad guys. :kaojoy:
But, the game development schedule delayed. :kaoswt2:
The moral of the story: No good deed goes unpunished... I guess...
Except that, nothing to see here. :kaoswt2:
just beat ff7 original for the first time since 2010. having played remake last year, I have a much better appreciation for the original oddly enough. I still like some of the character presentation in remake more, but the original's got a lot going for it.
Ever reach that moment in your life when your juggling a dozen or more projects that you know will never be made but don't have the heart to delete them? Ugh, I hate those moments...
:kaosigh: Why must you hurt me so?

Forum statistics

Threads
111,451
Messages
1,061,206
Members
144,818
Latest member
OMEGASS
Top