MV Plugin Script Call Questions

Hello everyone,

I have two Script Call questions for how to call & affect events on a map.

First question:
I know you can access specific events on the current map using this script call:
var target = $gameMap.event(i);

But can this be streamlined if the event I am calling is the current event? For example, I want to add an icon bubble to the current event via script call (I am using the Yanfly Icon On Event plugin). If the current event is Event ID 7, this would be:
var target = $gameMap.event(7);

But I would love it if it could just be:
var target = $gameMap.event(this);
(this call doesn't work but I hope it illustrates what I mean?)

This is because I want to have a number of events all do this same thing and it would be much easier to just use a general script call on them & copy paste the event, rather than having to amend the number in the brackets for each one.

Second Question:
Is there a script call that accesses events on a different map?

For example, if I am on Map 1 but want to change something on Map 2, or I use a common event to change something on Map 2, it could look like this:
var target = $gameMap.map(2).event(5);

I have searched and searched the RPG Maker MV Script Call Excel Sheet but wasn't able to find what I need. It would be great if someone could help me out. If the answer to either question is "that is not possible" at least I can stop looking. 🙂

Thanks a lot!
Lui
You can use
this.eventId() or this.character(0)

Is there a script call that accesses events on a different map?
You would have to load the other map too as by default only the current map is loaded. There are plugins like event spawners or tile copiers that will load another map. I don't know how you would edit the events on the that other map as I haven't tried it but it may be specific to the plugin
  1. Like AquaEcho said, either of these should work in a Script command (not in a move route):

    var target = this.character(0);
    var target = $gameMap.event(this.eventId());

  2. By default you can't reference events on a different map, because only 1 map is loaded at a time. Switches/variables can effect cross-map changes via event page conditions.
Thank you both! That seems to work like a charm for question 1, and I will find a workaround for question 2 somehow. 🙂
Thank you both! That seems to work like a charm for question 1, and I will find a workaround for question 2 somehow. 🙂
In the default engine with no plugins there is this script command that will let you change the self switch of an event on any map. So you could put the changes you want on a different event page and remotely toggle the self switch to set the event to that page

$gameSelfSwitches.setValue([map, event, selfswitch], value)

Original thread: https://forums.rpgmakerweb.com/threads/plugin-script-call-questions.160670/