RPG Maker Forums

Remote Event Counting and Control
by Dahlys
Download Link
*Update 09/24: This plugin is dead. Please see my Universal Remote Control instead

Introduction:

Count number of events with Event Name = "insert_name" and store their event IDs into an array.
Remotely activate self-switches based on event names.

Features:
  • Count the number and log the IDs of Event Names containing the word(s) of interest.
    • e.g. If all NPCs have NPC in their event name, you can store their Event IDs in a variable as an array. The total number of NPCs on the map can also be stored into a variable.
    • An array of strings ["Tom", "Dick", "Harry"] can be used as input as well as individual strings "Tom", "Dick", "Harry"
  • Remote control Self-switches by matching Event Names, works for Yanfly's self-switch plugin!
    • e.g. If all children have "child" in their event name, you can turn on their self-switch to make them all flee from you at once in a game of tag. No need for a common event/global switch and parallel processes all over the place.
    • e.g. If you type a string or array of strings into a variable (via another plugin (http://biud436.tistory.com/58) or script call), you can drop a lightning bolt on "EnterNameHere" anywhere on the same map.
  • Set your own conditions to whether the Event ID will be included or not.
    • Some javascript knowledge required
    • Script calls from other plugins can be used in conditions. I have not yet found any conflicts with Yanfly, LTN, Galv, Hime, Khas, and Orange.
    • e.g. Choose to exclude dead NPCs who have self-switch "D" on.
  • Once Event IDs are stored in a variable, they can be used as a source array for further functions. This prevents having to loop through every single event on the map when you just want to activate/search through a subset of events.
  • More detail on plugin functions and usage is found in the plugin help box.
    • Please read carefully especially when using conditions involving Event IDs. e.g. Checking if their dead/alive self-switch is on. Also watch out for special javascript characters.
Screenshots:


How to use:

Dump the .js file in your project plugins folder and add it to your plugin manager. The order this plugin is loaded shouldn't matter.

Thanks to:

Soulpour777 for his scripting tutorial!

Author's Notes:

My script calls used to look like:
Code:
//On map entry
var npc = [];
for (i = 1; i < 999; i++) {
    if ($dataMap.events[i] == null) {
        break;
    }
    else if ($dataMap.events[i].name.includes("NPC") && !this.getSelfSwitchValue(this._mapId, i, 18)) {
        npc.push(i);
    }
}
$gameVariables.setValue(65, npc)
$gameVariables.setValue(64, npc.length)

//Parallel common event
var npc = $gameVariables.value(65);
var nearby = [];
for (i = 0; i < npc.length; i++) {
    if (Galv.DETECT.event(npc[i],$gameVariables.value(11),true) && $dataMap.events[npc[i]].name.includes("Policeman") && !this.getSelfSwitchValue(this._mapId, npc[i], 18)) {
        nearby.push(npc[i]);
    }
}
if (nearby.length > 0) {$gameVariables.setValue(83, nearby)}

for (i = 0; i < npc.length; i++) {
    if (Galv.DETECT.event(npc[i],$gameVariables.value(11),true) && $dataMap.events[npc[i]].name.includes("FBI") && !this.getSelfSwitchValue(this._mapId, npc[i], 18)) {
        nearby.push(npc[i]);
    }
}
if (nearby.length > 0) {$gameVariables.setValue(84, nearby)}

var victimfamilies = $gameVariables.value(85);
for (i = 0; i < npc.length; i++) {
    for (j = 0; j < victimfamilies.length; j++) {
        if (Galv.DETECT.event(npc[i], $gameVariables.value(11), true) && $dataMap.events[npc[i]].name.includes(victimfamilies[j]) && this.getSelfSwitchValue(this._mapId, npc[i], 18) == false) {
            nearby.push(npc[i]);
        }
}}
if (nearby.length > 0) {$gameVariables.setValue(86, nearby)}
...Okay, bad. And I do this OVER and OVER again?

What the script calls now look like:
Code:
this.countevent("NPC", 64, 65, "!this.getSelfSwitchValue(this._mapId, id, 18)");

this.counteventarray("Policeman", 0, 83, 65, "Galv.DETECT.event(sourcearray[id],$gameVariables.value(11),true) && !this.getSelfSwitchValue(this._mapId, sourcearray[id], 18)");

this.counteventarray("FBI", 0, 84, 65, "Galv.DETECT.event(sourcearray[id],$gameVariables.value(11),true) && !this.getSelfSwitchValue(this._mapId, sourcearray[id], 18)");

var victimfamilies = $gameVariables.value(85);
this.counteventarray(victimfamilies, 0, 86, 65, "Galv.DETECT.event(sourcearray[id],$gameVariables.value(11),true) && !this.getSelfSwitchValue(this._mapId, sourcearray[id], 18)");
Er... Somewhat better I guess!?

I hope this plugin will be helpful to some people! This has been super useful to me in shortening script calls in my "Police vs Thief" game.

If you look through the script, it's not the most elegant thing. I highly welcome any suggestions to improve. This is my first ever rpg maker plugin, and my first time writing in javascript (I used to use the monster called C++, that was 5 years ago when I was still in school). Perhaps the next update will add more functions such as the ability to activate multiple switches. I've been playing with rmmv for... 2 weeks?

Latest Threads

Latest Posts

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,450
Members
137,820
Latest member
georg09byron
Top