OcRam MZ -plugins

● ARCHIVED · READ-ONLY
Started by OcRam 404 posts Page 21 of 21 View original ↗
  1. I am using RPG Maker MV. With the Events plugin is there a way to make an event spawn on a random region id like Galvs GALV_EventSpawner plugin can do? I have an event set up for Galvs_EventSpawner but I had to place it lower in the load order below OcRam_Events for it to work but it being under makes it so that OcRam_Events spawn plugin command or script call to spawn events not to work see error picture. If with OcRam_Events event spawning on a random won't work, could I make it with terrain tags instead?
  2. Beachsidey0 said:
    I am using RPG Maker MV. With the Events plugin is there a way to make an event spawn on a random region id like Galvs GALV_EventSpawner plugin can do? I have an event set up for Galvs_EventSpawner but I had to place it lower in the load order below OcRam_Events for it to work but it being under makes it so that OcRam_Events spawn plugin command or script call to spawn events not to work see error picture. If with OcRam_Events event spawning on a random won't work, could I make it with terrain tags instead?
    I think I can make new function to spawn on desired regionId. I'm very busy in life ATM, but I'll try to find time for this (shouldn't be big development, maybe 5-15 mins and it's tested and done).
  3. Ok @Beachsidey0 I have now written first version for this new function (just paste it to OcRam_Events near Game_Map.prototype.spawnEvent() function.

    Here's the JS snippet (it spawns only to free tiles easy to modify if multiple events should be allowed to same tile):
    JavaScript:
    // Spawn TEMPORARY event to DESIRED REGION (random FREE tile) from event bases!
    Game_Map.prototype.spawnEventToRegion = function (base, region_id) {
        if (!region_id || (region_id | 0) == 0) {
            _this.debug("REGION ID WAS NOT PROVIDED OR IT WAS NOT A NUMBER!"); return;
        } const xya = [];
        for (let x = 0; x < $gameMap.width(); x++) {
            for (let y = 0; y < $gameMap.height(); y++) {
                if ($gameMap.regionId(x, y) == region_id) {
                    if ($gameMap.eventsXyNt(x, y).length < 1) xya.push([x, y]);
                }
            }
        } if (xya.length < 1) {
            _this.debug("FREE REGION ID " + region_id + " NOT FOUND ON THIS MAP!"); return;
        } const xy = xya[Math.randomBetween(0, xya.length - 1)];
        _this.debug("SPAWNED EVENT (" + base + ") TO:", xy); this.spawnEvent(base, xy);
    };
  4. OcRam said:
    Ok @Beachsidey0 I have now written first version for this new function (just paste it to OcRam_Events near Game_Map.prototype.spawnEvent() function.

    Here's the JS snippet (it spawns only to free tiles easy to modify if multiple events should be allowed to same tile):
    JavaScript:
    // Spawn TEMPORARY event to DESIRED REGION (random FREE tile) from event bases!
    Game_Map.prototype.spawnEventToRegion = function (base, region_id) {
        if (!region_id || (region_id | 0) == 0) {
            _this.debug("REGION ID WAS NOT PROVIDED OR IT WAS NOT A NUMBER!"); return;
        } const xya = [];
        for (let x = 0; x < $gameMap.width(); x++) {
            for (let y = 0; y < $gameMap.height(); y++) {
                if ($gameMap.regionId(x, y) == region_id) {
                    if ($gameMap.eventsXyNt(x, y).length < 1) xya.push([x, y]);
                }
            }
        } if (xya.length < 1) {
            _this.debug("FREE REGION ID " + region_id + " NOT FOUND ON THIS MAP!"); return;
        } const xy = xya[Math.randomBetween(0, xya.length - 1)];
        _this.debug("SPAWNED EVENT (" + base + ") TO:", xy); this.spawnEvent(base, xy);
    };
    That works beautifully, thank you very much! Just used the script

    $gameMap.spawnEventToRegion('Honey1', [40]); and it works like it is supposed to.