Autostart one Parallel Common Event

Murakui

Warper
Member
Joined
May 1, 2019
Messages
2
Reaction score
3
First Language
German
Primarily Uses
RMMV
Hello Guys,

i needed to build a plugin to start one common event parallel, when a map is loaded.
When you need something similar you can download the plugin or see how it works in the spoiler.

Code:
//=============================================================================
// MURA_RunParalell.js v1
//=============================================================================
"use strict";
var Imported = Imported || {};
Imported.MURA_RunParalell = true;

var Murakui = Murakui || {};
Murakui.RunParalell = Murakui.RunParalell || {};

//=============================================================================
// Plugin Parameters
//=============================================================================
/*:
 * @plugindesc process one common event anytime
 * @author murakui
 *
 * @param Event ID
 * @desc 1-9999
 * @default 1
 *
 * @help This plugin runs one of the common events globally at any map.
 *
 * Please select one common event that contains the trigger: 'Paralell'
 * and select a switch.
 *
 * When the map is loaded the gameengine updates the switch to true,
 * that will trigger the common event permanently as long the game is running.
 *
 */
(function ($rp) {

    $rp.parameters = PluginManager.parameters('MURA_RunParalell');
    $rp.eventId = $rp.parameters['Event ID'];

    Game_CommonEvent.prototype.isActive = function () {
        $rp.changeSwitchForEvent(this.event());
        return $rp.isTriggerParalell(this.event().trigger) && $rp.isSwitchOn(this.event().switchId);
    };
 
    $rp.changeSwitchForEvent = function (event) {
        if (!$rp.isSwitchOn(event.switchId) && $rp.isEventIdEqual(event.id)) {
            $rp.setSwitch(event.switchId, true);
        };
    };

    $rp.isSwitchOn = function (switchId) {
        return $gameSwitches.value(switchId);
    };

    $rp.isTriggerParalell = function (trigger) {
        return trigger == 2;
    };

    $rp.isEventIdEqual = function (eventId) {
        return $rp.eventId == eventId;
    }

    $rp.setSwitch = function (switchId, bool) {
        $gameSwitches.setValue(switchId, bool);
    }

})(Murakui.RunParalell);

regards,
Mura

Terms of Use: Can be used freely.
 

Attachments

Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Managed to find a way to hang a bed cover over my window. So no more being toasted alive in the afternoon!:kaoswt2:
So, uh, has anyone tried buying any resources from KokoroReflections? Because I've been looking for a 'buy' button on the site for like 10 minutes now and can't find one.
Any also thought it's too cringy to put the word "and you" in your credit as a special thanks?
Cause that's what I thought...
Everyone in the US right now: Please stay safe.
Symphony Celestia: Prophecy of the Falling Stars RPG Maker music pack WIP. Symphony Celestia is a new series that focuses on symphonic and orchestrated music to tell a story. Each story will include compositions that make up that story from beginning to end. Themes include: Battles, adventures, character themes, etc. Below is a video preview to the first story.

Forum statistics

Threads
97,980
Messages
948,329
Members
129,246
Latest member
Flaminguex
Top