is it possible to call a common event through a script?

title

scripting is hard but a few of the plugins i use require it, so im wonderin if theres a workaround
Reserve common event ID 3:

$gameTemp.reserveCommonEvent(3)
The event will run at the next opportunity, when on a scene that supports running events, i.e. map or battle.

This example was taken from the MV / MZ Script Call List ("Events & Interpreters" section):
Also, to supplement the list that caethyril provided - because I know it can be daunting - Google is your friend. At this point, basically everything has been asked about MV 😉

So if I Google "RPG Maker MV common event script call" I get half a dozen threads with the function she gave you.

Good luck!
also to supplement even if he already stated this, but most people simply overread it:

that function is "reserve common event", not "call common event".
The difference as stated is that the common event will not be executed directly, but when the engine is next capable of executing a common event - they can't be executed anywhere or anytime.

and that can cause problems if you expect them to be executed at once.
Run a script:

$game_map.common_events[common_event_id].start
$game_map.common_events[common_event_id].start
None of that is valid. There's no $game_map object, the $gameMap doesn't have a common_events member variable, and the Game_CommonEvent data type doesn't have a start member either.

I don't know if that's relevant to the older RPG Makers that took Ruby scripting, but it won't work in MV.
Sorry for being an archeologist but I found the solution, if someone finds this in Google

If you want to execute the common event right now, instead of "at the next opportunity" like it was stated before, this is the code.
Where eventN is the number of the event you want to execute

JavaScript:
        const commonEvent = $dataCommonEvents[eventN];
        if (commonEvent) {
            const eventId = this.isOnCurrentMap() ? this._eventId : 0;
            this.setupChild(commonEvent.list, eventId);
        }
        return true;
For the record, the list I linked to has Common Event (Insert) - it's in the Events & Interpreters section, immediately above Common Event (Reserve). The examples are:
  • MZ:

    // MZ, anywhere: insert common event 5 into the map interpreter $gameMap._interpreter.command117([5]);
  • MV:

    // MV, in a Script command: insert CE with ID = variable 1's value this._params = [$gameVariables.value(1)]; this.command117();
These examples are shorter to write and stand a better chance of reproducing the same behaviour as the Common Event command, even with of plugins and/or core script updates.

Since this thread has gone a whole year with no activity...

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-call-a-common-event-through-a-script.148602/