SRPG Engine - Plugins for creating Turn Based Strategy game

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
150
Reaction score
21
First Language
German
Primarily Uses
RMMV
@Flottos
>on your first Request: -it is possible to spawn events on random positions,but a random Thunder-hit?
i dont think so..atleast i got no clue where to start to make this.
>on your second Question: -that happens probably to every one i think its a "loading data" Issue and i allready thought about using the Plugin "SRD Preloader Core" to find out if that solves the Problem..but At The Moment i didnt test that Plugin and i also didnt solve that Problem yet.
 
Last edited:

Flottos

Villager
Member
Joined
Aug 5, 2019
Messages
21
Reaction score
6
First Language
English
Primarily Uses
RMMV
how do you add mini hp bars?
Are you asking me? If so, please send me a picture of how you would like it. I had to do alot of tweaking with the windows to make it look like the way it is.
 

Misappi

Veteran
Veteran
Joined
Apr 16, 2018
Messages
34
Reaction score
19
First Language
Japanese
Primarily Uses
RMMV
Also i would like to report another possible bug: When I initially click the unit to check their stats, the face picture does not show up:
View attachment 144471

Then when I click out and click again it does:

View attachment 144472

What is causing this?
@Flottos Like Dopan said, it's not a problem with the plugin, it's just that you need to cache it.

You can Use SRD preloader core and preload faces folder of your game (like Dopan said) and it will solve your problem (it did solved for me)
 

Flottos

Villager
Member
Joined
Aug 5, 2019
Messages
21
Reaction score
6
First Language
English
Primarily Uses
RMMV
@Flottos Like Dopan said, it's not a problem with the plugin, it's just that you need to cache it.

You can Use SRD preloader core and preload faces folder of your game (like Dopan said) and it will solve your problem (it did solved for me)
Hi, thanks for the reply. I thought it was that. I tried to use SRD preloader in the past to fix sound lag but it causes huge memory leaks and requires SRD update core which is incompatible with a lot of plugins i'm using. Any other preloaders that anyone knows that are good? I also tried GALV's preloader, also a huge memory leaker too...
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
150
Reaction score
21
First Language
German
Primarily Uses
RMMV
skill or item's note:
<addActionTimes: X>
# Increases the number of actions by X when the skill is used. If set to 1, the skill can re-act after the action.
I tested this also as ItemNote by now . And it only works on Item Note,not on Skill Note (even if the Description talks about Skills)
Has anyone an Idea how to fix this in order to make it also work on Skill Note?
-------
On the Preloader Issue: perhaps it would be better to add a Preloading function into the SRPG_Core,sooner or later ..
-only Preloading the needed data(=faces folder ) when SRPG Battle starts.. look into the next posting from Flottos for the right Timing Info

(and sry i didnt test any preloader Plugins yet,im busy on another Issue)
 
Last edited:

Flottos

Villager
Member
Joined
Aug 5, 2019
Messages
21
Reaction score
6
First Language
English
Primarily Uses
RMMV
I tested this also as ItemNote by now . And it only works on Item Note,not on Skill Note (even if the Description talks about Skills)
Has anyone an Idea how to fix this in order to make it also work on Skill Note?
-------
On the Preloader Issue: perhaps it would be better to add a Preloading function into the SRPG_Core,sooner or later ..
-only Preloading the needed data(=faces folder ) when SRPG Battle starts..
(and sry i didnt test any preloader Plugins yet,im busy on another Issue)
Hi guys, an update, I retried Galv's cache plugin again and the latest version works well without memory leaks. After looking at the SRPG_Core script, i realized that the Face files load ONLY at battle start and would erase after any Side view battle. The key is use galv's plugin script call for all files in your face folder in the event that calls <type:afterAction> and it will re-cache the face files after every actor/enemy's turn:

1590107516980.png
 
Last edited:

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
150
Reaction score
21
First Language
German
Primarily Uses
RMMV
I hope somebody is able to help me solve this..:
I need a Switch in the AOE-PLugin,that only triggers after All AOE hits are finished,but the Problem is the Switch triggers allways right after the first AOE-Hit.Best would be if this switch could be controlled in the Plugin Settings (but thats only to make this change usable for everybodys Purposes). Without the Setting Controll i would just make the default of the Switch "false" ,in that way it would be needed to edit the Plugin on your own if u need the Switch..
aoe setting.png
thats the Code for the Switch:
$gameSwitches.setValue(300, true);
it says make Switch 300 "true"

The Purpose of this Switch is a (common Event)chain -reaktion that disables the AOE-Skill-Type (="Magic").This is needed to improve the "new Battlestyle" shown in the UpdatedDemo and to make AOEs fully Compatible with it..
As long it triggers after the first Hit,the AOE will stop after the first Hit,..

I tryed to put that Switch Code somewhere at the End of :
// work through the queue of actions
-but that didnt work (it triggers after the first AOE-Hit)
-> Using a Common event Skill Trigger instead of the Switch-Code in the Plugin has the same result
-> Using "Post-Action" in a Common Event to controll the Switch Timing has the same result.
I think that there is a "Post-Action"-Phase after each AOE Hit and Not after the full AOE is Done.. thats the Main-reason here, why it allways triggers after the first Hit..
I dont know how to catch the timing after the last "Post-Action"-Phase of the AOE
Code:
//-----------------------------------------------------------------------------
// copyright 2020 Doktor_Q all rights reserved.
// Released under the MIT license.
// http://opensource.org/licenses/mit-license.php
//=============================================================================

/*:
* @plugindesc SRPG area-of-effect skills
* @author Dr. Q + ?????
*
* @param AoE Color
* @desc CSS Color for AoE squares
* https://www.w3schools.com/cssref/css_colors.asp
* @type string
* @default DarkOrange
*
* @param Show One Square AoE
* @desc Show AoE indicator for single target effects?
* @type boolean
* @on Show
* @off Hide
* @default false
*
* @param Refocus Camera
* @desc Move the camera to each target as it's hit
* @type boolean
* @on Move
* @off Don't move
* @default false
*
* @help
* Allows you to define an area of effect for attacks
* Based on SRPG_AreaAttack.js by ?????
*
* When using an AoE skill, you can target an empty cell as long as there is at
* least one valid target within the area
* AI units won't make use of this, and will always try to target a unit
* directly, catching other targets by coincidence
*
* Skill / item notetags:
* <srpgAreaRange:x>    creates an AoE of size x
* <srpgAreaType:y>     changes the shape of the AoE
* type defaults to 'circle' if not specified
*
*
* The following shapes are available, shown at a size of 2.
*
* circle: hits a circle around the target cell
*      2
*    2 1 2
*  2 1 0 1 2
*    2 1 2
*      2
*
* square - hits a square around the target cell
*  2 2 2 2 2
*  2 1 1 1 2
*  2 1 0 1 2
*  2 1 1 1 2
*  2 2 2 2 2
*
* line - hits a straight line behind of the target cell
*
*      0
*      1
*      2
* (facing down)
*
* cone - hits a 90 degree cone behind the target cell
*
*
*      0
*    1 1 1
*  2 2 2 2 2
* (facing down)
*
* split - hits a v shape behind the target cell
*
*
*      0
*    1   1
*  2       2
* (facing down)
*
* arc - hits a v shape coming back from the target cell
*  2       2
*    1   1
*      0
*
*
* (facing down)
*
* side - hits a line to either side of the target cell
*
*
*  2 1 0 1 2
*
*
* (facing down)
*
* tee - hits behind and to the sides of the target
*
*
*  2 1 0 1 2
*      1
*      2
* (facing down)
*
* plus - hits a + shape around the target cell
*      2
*      1
*  2 1 0 1 2
*      1
*      2
*
* cross - hits an x shape around the target cell
*  2       2
*    1   1
*      0
*    1   1
*  2       2
*
*========================== Upgraded +10 AoE types added=====================
*
* 'star'_'sun'_'meteor'_'cata'_'canon'_'hammer'_'axe'_'lancer'_'moon'_'bomb'
*(For more information:Ask in Forum for the"Recommended AreaRange Help"-File)
*                                                            
*============================================================================
* Script calls for advanced users:
*  yourEvent.battlersNear(size, 'shape', [direction])
*  yourEvent.enemiesNear(size, 'shape', [direction])
*  yourEvent.actorsNear(size, 'shape', [direction])
*
* Returns a list of actors/enemies/both near the specified event, supporting
* the same AoE shapes listed above. If you use a directional AoE shape and no
* direction is specified, it will point where your event is facing
*/

(function(){

    var parameters = PluginManager.parameters('SRPG_AoE');
    var _oneSquare = !!eval(parameters['Show One Square AoE']);
    var _areaColor = parameters['AoE Color'];
    var _refocus = !!eval(parameters['Refocus Camera']);

    var coreParameters = PluginManager.parameters('SRPG_core');
    var _srpgPredictionWindowMode = Number(coreParameters['srpgPredictionWindowMode'] || 1);

//====================================================================
// Function names from SRPG_AreaAttack.js, for compativility
//====================================================================

    Game_Temp.prototype.isFirstAction = function() {
        return this.shouldPayCost();
    };
    Game_BattlerBase.prototype.srpgSkillAreaRange = function(item) {
        return Number(item.meta.srpgAreaRange);
    };

//====================================================================
// Get AoE data for the skill
//====================================================================

    // get AoE properties
    Game_Action.prototype.area = function() {
        if (this.item()) return Number(this.item().meta.srpgAreaRange) || 0;
        return 0;
    };
    Game_Action.prototype.areaType = function() {
        var type = '';
        if (this.item()) type = this.item().meta.srpgAreaType || '';
        type = type.toLowerCase();
        return type;
    };

    // (utility) find the direction to a fixed point, discounting obstacles
    Game_Character.prototype.dirTo = function(x, y) {
        var dir = 5;
        var dx = this.posX() - x;
        var dy = this.posY() - y;

        // account for looping maps
        if ($gameMap.isLoopHorizontal()) {
            if (dx > $gameMap.width() / 2) dx -= $gameMap.width();
            if (dx < -$gameMap.width() / 2) dx += $gameMap.width();
        }
        if ($gameMap.isLoopVertical()) {
            if (dy > $gameMap.height() / 2) dy -= $gameMap.height();
            if (dy < -$gameMap.height() / 2) dy += $gameMap.height();
        }

        if (Math.abs(dx) > Math.abs(dy)) {
            dir = dx > 0 ? 4 : 6;
        } else if (dy !== 0) {
            dir = dy > 0 ? 8 : 2;
        }
        return dir;
    };

    // (utility) find the distance to a fixed point, discounting obstacles
    Game_Character.prototype.distTo = function(x, y) {
        var dx = Math.abs(this.posX() - x);
        var dy = Math.abs(this.posY() - y);

        if ($gameMap.isLoopHorizontal()) dx = Math.min(dx, $gameMap.width() - dx);
        if ($gameMap.isLoopVertical()) dy = Math.min(dy, $gameMap.height() - dy);

        return  dx + dy;
    };

    // (utility) checks if a position is within the current skill's range
    Game_System.prototype.positionInRange = function(x, y) {
        var range = $gameTemp.moveList();
        for (var i = 0; i < range.length; i++) {
            if (range[i][0] == x && range[i][1] == y) return true;
        }
        return false;
    };

//====================================================================
// Game_Temp (store lists of multiple targets)
//====================================================================

    var _Game_Temp_initialize = Game_Temp.prototype.initialize;
    Game_Temp.prototype.initialize = function() {
        _Game_Temp_initialize.call(this);
        this._activeAoE = null;
        this._areaTargets = [];
        this._shouldPaySkillCost = true;
    };

    // easy access to the origin of the AoE
    Game_Temp.prototype.areaX = function() {
        return this._activeAoE ? this._activeAoE.x : -1;
    };
    Game_Temp.prototype.areaY = function() {
        return this._activeAoE ? this._activeAoE.y : -1;
    };

    // check if an event is in the area of the current skill
    Game_Temp.prototype.inArea = function(event) {
        if (!this._activeAoE || this._activeAoE.size <= 0) return false;

        var dx = event.posX() - this._activeAoE.x;
        var dy = event.posY() - this._activeAoE.y;

        if ($gameMap.isLoopHorizontal()) {
            if (dx > $gameMap.width() / 2) dx -= $gameMap.width();
            if (dx < -$gameMap.width() / 2) dx += $gameMap.width();
        }
        if ($gameMap.isLoopVertical()) {
            if (dy > $gameMap.height() / 2) dy -= $gameMap.height();
            if (dy < -$gameMap.height() / 2) dy += $gameMap.height();
        }

        return $gameMap.inArea(dx, dy, this._activeAoE.size, this._activeAoE.shape, this._activeAoE.dir);
    };

    // to attack multiple targets, you queue up a target list
    Game_Temp.prototype.clearAreaTargets = function() {
        this._areaTargets = [];
    };
    Game_Temp.prototype.addAreaTarget = function(action) {
        this._areaTargets.push(action);
    };
    Game_Temp.prototype.areaTargets = function() {
        return this._areaTargets;
    };

    // when repeating actions, the cost is only paid once
    Game_Temp.prototype.setShouldPayCost = function(flag) {
        this._shouldPaySkillCost = flag;
    };
    Game_Temp.prototype.shouldPayCost = function() {
        return this._shouldPaySkillCost;
    };
    var _paySkillCost = Game_BattlerBase.prototype.paySkillCost;
    Game_BattlerBase.prototype.paySkillCost = function(skill) {
        if (!$gameSystem.isSRPGMode() || $gameTemp.shouldPayCost()) {
            _paySkillCost.call(this, skill);
        }
    };

//====================================================================
// Check what's in an area
//====================================================================

    // get a list of battlers near another battler
    Game_Character.prototype.battlersNear = function(size, shape, dir, type) {
        var x = this.posX();
        var y = this.posY();
        dir = dir || this.direction();

        var battlers = [];
        $gameMap.events().forEach(function (event) {
            if (event.isErased() || !event.inArea(x, y, size, shape, dir)) return;
            var unitAry = $gameSystem.EventToUnit(enemyEvent.eventId());
            if (unitAry && (unitAry[0] === type || type === null)) battlers.push(unitAry[1]);
        });
        return battlers;
    };
    Game_Character.prototype.enemiesNear = function(size, shape, dir) {
        return this.battlersNear(size, shape, dir, 'enemy');
    };
    Game_Character.prototype.actorsNear = function(size, shape, dir) {
        return this.battlersNear(size, shape, dir, 'actor');
    };

    // check if a character is within a specified AoE
    Game_Character.prototype.inArea = function(x, y, size, shape, dir) {
        if (size <= 0) return false; // one-square AoEs don't count as AoEs
        var dx = this.posX() - x;
        var dy = this.posY() - y;

        // account for looping maps
        if ($gameMap.isLoopHorizontal()) {
            if (dx > $gameMap.width() / 2) dx -= $gameMap.width();
            if (dx < -$gameMap.width() / 2) dx += $gameMap.width();
        }
        if ($gameMap.isLoopVertical()) {
            if (dy > $gameMap.height() / 2) dy -= $gameMap.height();
            if (dy < -$gameMap.height() / 2) dy += $gameMap.height();
        }
        return $gameMap.inArea(dx, dy, size, shape, dir);
    };

    // check if a given position is within an area
    Game_Map.prototype.inArea = function(dx, dy, size, shape, dir) {
        var fx = [0, -1, 0, 1, -1, 0, 1, -1, 0, 1][dir];
        var fy = [0, 1, 1, 1, 0, 0, 0, -1, -1, -1][dir];

        switch (shape) {
            case 'line':
                if (dx * fy != 0 || dy * fx != 0) return false;
                if (dx * fx < 0 || dy * fy < 0 || dx * fx > size || dy * fy > size) return false;
                return true;

            case 'cone':
                if (dx * fx < 0 || dy * fy < 0 || dx * fx > size || dy * fy > size) return false;
                if (Math.abs(dx*fy) > Math.abs(dy*fy) || Math.abs(dy*fx) > Math.abs(dx*fx)) return false;
                return true;

            case 'split':
                if (dx * fx < 0 || dy * fy < 0 || dx * fx > size || dy * fy > size) return false;
                if (Math.abs(dx) != Math.abs(dy)) return false;
                return true;

            case 'arc':
                if (dx * fx > 0 || dy * fy > 0 || dx * fx < -size || dy * fy < -size) return false;
                if (Math.abs(dx) != Math.abs(dy)) return false;
                return true;

            case 'side':
                if (dx * fx != 0 || dy * fy != 0) return false;
                if (Math.abs(dx * fy) > size || Math.abs(dy * fx) > size) return false;
                return true;

            case 'tee':
                if (dx != 0 && dy != 0) return false;
                if (dx * fx < 0 || dy * fy < 0 || Math.abs(dx) > size || Math.abs(dy) > size) return false;
                return true;

            case 'plus':
                if (dx != 0 && dy != 0) return false;
                if (Math.abs(dx) > size || Math.abs(dy) > size) return false;
                return true;

            case 'cross':
                if (Math.abs(dx) != Math.abs(dy) || Math.abs(dx) > size) return false;
                return true;

            case 'square':
                if (Math.abs(dx) > size || Math.abs(dy) > size) return false;
                return true;
   
            case 'star':
                if (Math.abs(dx)+Math.abs(dy) > size) return false;
                if (Math.abs(dx) == Math.abs(dy) || dx == 0 || dy == 0) return true;
                if (Math.abs(dx) != Math.abs(dy) || Math.abs(dx) > size) return false;
                return true;

            case 'sun':
                if (Math.abs(dx) > size || Math.abs(dy) > size) return false;
                if (Math.abs(dx) == Math.abs(dy) || dx == 0 || dy == 0) return true;
                if (Math.abs(dx)+Math.abs(dy) > size - 3) return false;
                if (Math.abs(dx)+Math.abs(dy) - 3 > size ) return false;
                return true;

            case 'moon':
                if (Math.abs(dx)+Math.abs(dy) > size) return false;
                if (Math.abs(dx) == Math.abs(dy) || dx == 0 || dy == 0) return false;
                return true;

            case 'axe':
                if (Math.abs(dx) > size || Math.abs(dy) > size) return false;
                if (Math.abs(dx) == Math.abs(dy) || dx == 0 || dy == 0) return false;
                if (dx != 0 && dy != 0) return true;
                if (Math.abs(dx) > size || Math.abs(dy) > size) return true;
                if (Math.abs(dx) != Math.abs(dy) || Math.abs(dx) > size) return false;
                return true;

            case 'cata':
                if (Math.abs(dx) > size || Math.abs(dy) > size) return false;
                if (Math.abs(dx)+Math.abs(dy) < size) return false;
                if (dx != 0 && dy != 0) return true;
                if (Math.abs(dx) > size || Math.abs(dy) > size) return true;
                if (Math.abs(dx) != Math.abs(dy) || Math.abs(dx) > size) return false;
                return true;

            case 'canon':
                if (Math.abs(dx) > size || Math.abs(dy) > size) return false;
                if (Math.abs(dx)+Math.abs(dy) > size) return true;
                if (Math.abs(dx) != Math.abs(dy) || Math.abs(dx) > size) return false;
                return true;

            case 'lancer':
                if (Math.abs(dx)+Math.abs(dy) > size) return false;
                if (dx != 0 && dy != 0) return true;
                if (Math.abs(dx) > size || Math.abs(dy) > size) return true;
                if (Math.abs(dx) != Math.abs(dy) || Math.abs(dx) > size) return false;
                return true;

            case 'hammer':
                if (Math.abs(dx) > size || Math.abs(dy) > size) return false;
                if (dx != 0 && dy != 0) return true;
                if (Math.abs(dx) > size || Math.abs(dy) > size) return true;
                if (Math.abs(dx) != Math.abs(dy) || Math.abs(dx) > size) return false;
                return true;

            case 'meteor':
                if (Math.abs(dx+3)+Math.abs(dy+3) > size) return false;
                if (Math.abs(dx) == Math.abs(dy) || dx == 0 || dy == 0) return true;
                if (Math.abs(dx) != Math.abs(dy) || Math.abs(dx) > size) return false;
                return true;

            case 'bomb':
                if (Math.abs(dx)+Math.abs(dy) + 4 > size) return false;
                if (Math.abs(dx) == Math.abs(dy) || dx == 0 || dy == 0) return true;
                if (Math.abs(dx) != Math.abs(dy) || Math.abs(dx) > size) return false;
                return true;

            case 'circle':
            default: // circle is the default shape
                if (Math.abs(dx)+Math.abs(dy) > size) return false;
                return true;
        };
    };

//====================================================================
// Using AoE skills
//====================================================================

    // update the active AoE when you move the cursor
    var _startMapEvent = Game_Player.prototype.startMapEvent;
    Game_Player.prototype.startMapEvent = function(x, y, triggers, normal) {
        if ($gameSystem.isSRPGMode() && triggers.contains(1)) {
            if ($gameSystem.isSubBattlePhase() === 'actor_target' && $gameSystem.positionInRange(x, y)) {
                $gameTemp.showArea(x, y);
            } else if ($gameSystem.isSubBattlePhase() !== 'invoke_action' &&
            $gameSystem.isSubBattlePhase() !== 'battle_window') {
                $gameTemp.clearArea();
            }
        }
        if ($gameSystem.isSRPGMode() && $gameSystem.isSubBattlePhase() === 'actor_target' && $gameTemp.isSkillAoE()) {
            return;
        }
        _startMapEvent.call(this, x, y, triggers, normal);
    };

    // show the AoE when you start targeting
    var _startActorTargetting = Scene_Map.prototype.startActorTargetting;
    Scene_Map.prototype.startActorTargetting = function() {
        _startActorTargetting.call(this);
        var x = $gamePlayer.posX();
        var y = $gamePlayer.posY();
        if ($gameSystem.positionInRange(x, y)) {
            $gameTemp.showArea(x, y);
        }
    };

    // clear the AoE when you cancel targeting
    var _updateCallMenu = Scene_Map.prototype.updateCallMenu;
    Scene_Map.prototype.updateCallMenu = function() {
        if ($gameSystem.isSRPGMode() && $gameSystem.isSubBattlePhase() === 'actor_target' &&
        (Input.isTriggered('cancel') || TouchInput.isCancelled())) {
            $gameTemp.clearArea();
        }
        _updateCallMenu.call(this);
    };

    // check if the skill currently selected has an AoE
    Game_Temp.prototype.isSkillAoE = function() {
        var unit = $gameTemp.activeEvent();
        var actor = $gameSystem.EventToUnit(unit.eventId())[1];
        if (!actor) return false;
        var skill = actor.currentAction();
        if (!skill) return false;
        if (skill.area() <= 0) return false;
        return true;
    };

    // highlight the area of effect for an AoE
    Game_Temp.prototype.showArea = function(x, y) {
        var unit = $gameTemp.activeEvent();
        var actor = $gameSystem.EventToUnit(unit.eventId())[1];
        if (!actor) return;
        var skill = actor.currentAction();
        if (!skill) return;
        var size = skill.area();
        var shape = skill.areaType();
        var dir = unit.dirTo(x, y);
        this._activeAoE = {
            x: x,
            y: y,
            size: size,
            shape: shape,
            dir: dir
        };
    };

    // clear out the highlighted area
    Game_Temp.prototype.clearArea = function() {
        this._activeAoE = null;
    };

    // AoE skills can select empty cells
    var _triggerAction = Game_Player.prototype.triggerAction;
    Game_Player.prototype.triggerAction = function() {
        if ($gameSystem.isSRPGMode() && $gameSystem.isSubBattlePhase() === 'actor_target') {
            if (Input.isTriggered('ok') || TouchInput.isTriggered()) {
                var userArray = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId());
                var skill = userArray[1].currentAction();

                if ($gameTemp.selectArea(userArray[1], skill)) {
                    SoundManager.playOk();

                    var action = $gameTemp.areaTargets().shift();
                    var targetArray = $gameSystem.EventToUnit(action.event.eventId());
                    $gameTemp.setTargetEvent(action.event);
                    $gameTemp.setSrpgDistance($gameSystem.unitDistance($gameTemp.activeEvent(), action.event));
                    // special range isn't set, because the AoE will override it anyway

                    $gameSystem.clearSrpgActorCommandStatusWindowNeedRefresh();
                    if (_srpgPredictionWindowMode != 3) $gameSystem.setSrpgStatusWindowNeedRefresh(userArray);
                    $gameSystem.setSrpgBattleWindowNeedRefresh(userArray, targetArray);
                    $gameSystem.setSubBattlePhase('battle_window');
                    return true;
                }
            }
        }
        return _triggerAction.call(this);
    };

    // Clear AoE targets when cancelling the big target
    var _selectPreviousSrpgBattleStart = Scene_Map.prototype.selectPreviousSrpgBattleStart;
    Scene_Map.prototype.selectPreviousSrpgBattleStart = function() {
        _selectPreviousSrpgBattleStart.call(this);
        $gameTemp.clearAreaTargets();
    };

    // Apply AoEs for auto units as well
    var _srpgInvokeAutoUnitAction = Scene_Map.prototype.srpgInvokeAutoUnitAction;
    Scene_Map.prototype.srpgInvokeAutoUnitAction = function() {
        // set up the AoE if it hasn't already been prepared
        if (!$gameTemp._activeAoE) {
            var mainTarget = $gameTemp.targetEvent();
            if (mainTarget && $gameSystem.positionInRange(mainTarget.posX(), mainTarget.posY())) {
                var userArray = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId());
                var skill = userArray[1].currentAction();
                if (skill.area() > 0) {
                    $gameTemp.showArea(mainTarget.posX(), mainTarget.posY());
                    $gameTemp.selectArea(userArray[1], skill, mainTarget);
                }
            }
        }
        _srpgInvokeAutoUnitAction.call(this);
    };

    // Find all the targets within the current AoE
    Game_Temp.prototype.selectArea = function(user, skill, initialTarget) {
        this.clearAreaTargets();
        var friends = (user.isActor()) ? 'actor' : 'enemy';
        var opponents = (user.isActor()) ? 'enemy' : 'actor';

        // identify targets
        var targets = $gameMap.events().filter(function (event) {
            if (event.isErased() || event == initialTarget) return false;
            if ((event.isType() == friends && skill.isForFriend()) ||
            (event.isType() == opponents && skill.isForOpponent())) {
                return $gameTemp.inArea(event);
            }
        });

        // there are no targets!
        if (targets.length == 0 && !initialTarget) return false;

        // sort by distance
        targets = targets.sort(function (a, b) {
            var aDist = a.distTo($gameTemp.areaX(), $gameTemp.areaY());
            var bDist = b.distTo($gameTemp.areaX(), $gameTemp.areaY());
            return aDist - bDist;
        });

        // queue up actions on each target
        for (var i = 0; i < targets.length; i++) {
            this.addAreaTarget({
                item: skill.item(),
                event: targets[i]
            });
        }
        return true;
    };

    // work through the queue of actions
    var _srpgAfterAction = Scene_Map.prototype.srpgAfterAction;
    Scene_Map.prototype.srpgAfterAction = function() {
        if ($gameTemp.areaTargets().length > 0) {
            this.srpgBattlerDeadAfterBattle();
            var actionArray = $gameSystem.EventToUnit($gameTemp.activeEvent().eventId());
            nextaction = $gameTemp.areaTargets().shift();
            actionArray[1].srpgMakeNewActions();
            actionArray[1].action(0).setItemObject(nextaction.item);
            var targetArray = $gameSystem.EventToUnit(nextaction.event.eventId());
            $gameTemp.setTargetEvent(nextaction.event);
            if (_refocus) {
                $gameTemp.setAutoMoveDestinationValid(true);
                $gameTemp.setAutoMoveDestination($gameTemp.targetEvent().posX(), $gameTemp.targetEvent().posY());
            }
            $gameTemp.setShouldPayCost(false);
            $gameSystem.setSubBattlePhase('invoke_action');
            this.srpgBattleStart(actionArray, targetArray);
        } else {
            $gameTemp.clearArea();
            $gameTemp.setShouldPayCost(true);
            _srpgAfterAction.call(this);
        }
    };

    // AoE skills can be used as long as you're in the targeted area
    var _canUse = Game_BattlerBase.prototype.canUse;
    Game_BattlerBase.prototype.canUse = function(item) {
        if (item && $gameSystem.isSRPGMode() && this._srpgActionTiming != 1 &&
        Number(item.meta.srpgAreaRange) > 0) {
            if ($gameSystem.isSubBattlePhase() === 'invoke_action' ||
            $gameSystem.isSubBattlePhase() === 'auto_actor_action' ||
            $gameSystem.isSubBattlePhase() === 'enemy_action' ||
            $gameSystem.isSubBattlePhase() === 'battle_window') {
                return $gameTemp.inArea($gameTemp.targetEvent());
            }
        }
        return _canUse.call(this, item);
    };

//====================================================================
// Sprite_SrpgAoE
//====================================================================

    window.Sprite_SrpgAoE = function() {
        this.initialize.apply(this, arguments);
    };

    Sprite_SrpgAoE.prototype = Object.create(Sprite.prototype);
    Sprite_SrpgAoE.prototype.constructor = Sprite_SrpgAoE;

    Sprite_SrpgAoE.prototype.initialize = function() {
        Sprite.prototype.initialize.call(this);
        this.anchor.x = 0.5;
        this.anchor.y = 0.5;
        this._frameCount = 0;
        this._posX = -1;
        this._posY = -1;
        this.z = 0;
        this.visible = false;
    };

    Sprite_SrpgAoE.prototype.isActive = function() {
        return this._posX >= 0 && this._posY >= 0;
    };

    Sprite_SrpgAoE.prototype.update = function() {
        Sprite.prototype.update.call(this);
        if (this.isActive()){
            this.updatePosition();
            this.updateAnimation();
            this.visible = true;
        } else {
            this.visible = false;
        }
    };

    Sprite_SrpgAoE.prototype.setAoE = function(x, y, size, type, dir) {
        this._posX = x;
        this._posY = y;
        this.blendMode = Graphics.BLEND_ADD;

        if (this._size != size || this._type != type || this._dir != dir) {
            this._size = size;
            this._type = type;
            this._dir = dir;
            this.redrawArea(size, type, dir);
        }
    };

    Sprite_SrpgAoE.prototype.redrawArea = function(size, type, dir) {
        var tileWidth = $gameMap.tileWidth();
        var tileHeight = $gameMap.tileHeight();
        this.bitmap = new Bitmap(tileWidth*(1+size*2), tileHeight*(1+size*2));

        if (!_oneSquare && size <= 0) return;

        for (var x = 0; x < 1+size*2; x++) {
            for (var y = 0; y < 1+size*2; y++) {
                if ($gameMap.inArea(x-size, y-size, size, type, dir)) {
                    this.drawCell(this.bitmap, x*tileWidth, y*tileHeight, tileWidth, tileHeight);
                }
            }
        }
    };

    Sprite_SrpgAoE.prototype.drawCell = function(bitmap, x, y, tileWidth, tileHeight) {
        bitmap.fillRect(x, y, tileWidth, tileHeight, _areaColor);
    };

    Sprite_SrpgAoE.prototype.clearArea = function() {
        this._posX = -1;
        this._posY = -1;
    };

    Sprite_SrpgAoE.prototype.updatePosition = function() {
        var tileWidth = $gameMap.tileWidth();
        var tileHeight = $gameMap.tileHeight();
        this.x = ($gameMap.adjustX(this._posX) + 0.5) * tileWidth;
        this.y = ($gameMap.adjustY(this._posY) + 0.5) * tileHeight;
    };

    Sprite_SrpgAoE.prototype.updateAnimation = function() {
        this._frameCount++;
        this._frameCount %= 40;
        this.opacity = (40 - this._frameCount) * 3;
    };

//====================================================================
// Spriteset_Map
//====================================================================

    // add the AoE sprite to the list
    var _Spriteset_Map_createTilemap = Spriteset_Map.prototype.createTilemap;
    Spriteset_Map.prototype.createTilemap = function() {
        _Spriteset_Map_createTilemap.call(this);
        this._srpgAoE = new Sprite_SrpgAoE();
        this._tilemap.addChild(this._srpgAoE);
    };

    var _Spriteset_Map_update = Spriteset_Map.prototype.update;
    Spriteset_Map.prototype.update = function() {
        _Spriteset_Map_update.call(this);
        if ($gameSystem.isSRPGMode()) {
            this.updateSrpgAoE();
        }
    };

    // refresh the AoE sprite
    Spriteset_Map.prototype.updateSrpgAoE = function() {
        var aoe = $gameTemp._activeAoE;
        if (aoe) {
            this._srpgAoE.setAoE(aoe.x, aoe.y, aoe.size, aoe.shape, aoe.dir);
        } else {
            this._srpgAoE.clearArea();
        }
    };

})();
 
Last edited:

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
793
Reaction score
487
First Language
English
Primarily Uses
RMMV
@Dopan You know the AoE is finished if $gameTemp.areaTargets().length is 0- that is, there are no further targets waiting on the queue to be processed.
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
150
Reaction score
21
First Language
German
Primarily Uses
RMMV
@Dopan You know the AoE is finished if $gameTemp.areaTargets().length is 0- that is, there are no further targets waiting on the queue to be processed.
i couldnt find that code in the AOE Plugin:
if ($gameTemp.areaTargets().length = 0);
so asume it has to be added aswell?
-like this?
Code:
if ($gameTemp.areaTargets().length = 0);
    $gameSwitches.setValue(300, true);
but i dont know where to put it ,i tryed the end of // work through the queue of actions OR
adding a new Section at the end of the Plugin
>> that had the same result ,Aoe stops after the first Hit,but i would preffer the "new Section" ..
Screenshot_11111111.png
Screenshot_1222222222222222.png
 
Last edited:

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
793
Reaction score
487
First Language
English
Primarily Uses
RMMV
@Dopan Using = like that will just break things, because that's for assigning a value. If you want to compare, used == in JavaScript.
Also, don't use a semicolon right after the if (), it stops it from seeing the second line as conditional.
Also-also, as it stands you never set the switch back to false that I can see.

Why are you trying to set a switch within the code itself? I'd strongly recommend just using a script call inside an event or common event, since that's less likely to break things.
 

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
150
Reaction score
21
First Language
German
Primarily Uses
RMMV
@Dopan Using = like that will just break things, because that's for assigning a value. If you want to compare, used == in JavaScript.
Also, don't use a semicolon right after the if (), it stops it from seeing the second line as conditional.
Also-also, as it stands you never set the switch back to false that I can see.

Why are you trying to set a switch within the code itself? I'd strongly recommend just using a script call inside an event or common event, since that's less likely to break things.
Answer:
The Off Switch is within a Common event (=enemy turn)
Because the "Common event Skill trigger" doesnt catch the timing i need and i didnt know that this can be handled with scriptcalls outside of the Plugin
I just tryed this as Scriptcall in a Common Event (Skilltriggert) , and still ,it triggers after the first HIt
Code:
if $gameTemp.areaTargets().length == 0
   $gameSwitches.setValue(300, true)
i tryed different versions with and without ";" at the end of each line,it didnt make a difference in this Case.
I think i am ready to give up on this and just dont use the "new battlestyle" in my Project and take it out of the next version of the Updated Demo aswell.. I wasted 4 days on this problem and i just cant get any further..
Sry for bothering and thx for trying to help.
Edit.
i just found out that AOEs are Not Compatible* with "<ImmediateSkill:true>" and because Skill\item-Note:"<addActionTimes: X>" (=from the SRPG-Core) isnt working on SkillNotes like its supposed to
(only item-notes are working),..
..it makes no sence to work on this Problem anymore.

(because the "new Battlestyle" needs something to add "ActionTimes" one way or another)
*that was causing the "stop- after first Hit" Issue on AOEs
Perhaps ill try this again if "<addActionTimes: X>" will work with Skillnotes,
somewhere in the Future but this has no priority for me..

____________
Edit2. @ All

Updated SRPG_demo to 0.9:
-took out the "new battlestyle" and everything related to it (cos of incompatiblety with AOEs atm)
-improved a few things (added 100%Counterrate to all actors and enemys cos its needed for "Q_Statcounter"-Plugin)
-I did Not took out any Plugins and the new "SkillType" -"Wait" is still part of the Demo..
-added the "Recommended AreaRange Help" -Folder (=for the Upgraded AOE Plugin)
again to the Zip.. i forgot that in the last Versions.
-->If somebody recognizes any problem on the Updated-Demo pls let me know, i will change or Fix it ASAP
.. on The Preloader Issue,: i didnt add a Preloader Plugin because im not sure if it will be solved in the SRPG_Core in the Future and i dont want to rush on this, its just a Visual Issue and all work for SRPG is
Free and voluntary.If u want to use a Preloader Plugin just follow Flottos EG (#567)
 
Last edited:

maliyana

Villager
Member
Joined
Jun 6, 2017
Messages
15
Reaction score
1
First Language
English
Primarily Uses
RMMV
Is it possible to make this function with MV3D? Particularly, to make the movement grid and selection box 3d:
 

Attachments

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
793
Reaction score
487
First Language
English
Primarily Uses
RMMV
Is it possible to make this function with MV3D? Particularly, to make the movement grid and selection box 3d:
In theory, you could somehow make a modified version of SRPG_UX_Range.js that is built to work with MV3D, but you'd have to bring it to the developers of MV3D, as I have no idea how that plugin works, and am not inclined to learn its inner workings for one compatibility patch..
 
Last edited:

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
150
Reaction score
21
First Language
German
Primarily Uses
RMMV
to prevent this to be a necro tread,..
I am trying to implement SPRG_FloorDamage into the updated Demo..
But I think I am Doing something Wrong.Does anybody use this Plugin and can tell me what I am Missing?
floor1.png
Floor2.png
floor3.png


Test FloorDMG-not working_ Demo EG (download)

EDIT
@Doktor_Q
that
solved it thx! (@ Doktor_Qs next Posting)

@ All
I will update the Updated-SRPG Demo to 1.0 with SPRG_FloorDamage included ,as soon "Gofile" has finished the Maintenance, I am just waiting for that, to upload it ..
 
Last edited:

Doktor_Q

I'm not a real doktor, but I am a real Q
Veteran
Joined
Aug 1, 2016
Messages
793
Reaction score
487
First Language
English
Primarily Uses
RMMV
@Dopan Two questions to help diagnose:
  1. Can you hit F8 and make sure there's no error messages in the console?
  2. How much HP does the fairy have? The formula you're using on that map is "20% of current HP", so if they have < 5 HP it won't do any damage.
  3. Where did you put the plugin relative to the others? It's possible there's a plugin order problem I wasn't aware of before.
EDIT: Just did some testing on my own, apparently you need to use the tag <floorDamage> on the event, not <damageFloor> like the documentation says, that's my bad. I'll have the updated version using <damageFloor> correctly, along with some other things like properly handling KO via damage tile, once I get all these version updates done.
 
Last edited:

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
150
Reaction score
21
First Language
German
Primarily Uses
RMMV
@ Doktor_Q
Again, Thank you very much and sry for Bothering^

@ ALL
I just Updated the SRPG_Demo to 1.0 :(Link in the Signature)
- Implemented SRPG_FloorDamage into the updated SRPG_demo.1.0
- changed the Help Info about EventNotetag from "<damageFloor>" into "<floorDamage>" .That works correctly
- I did not use every SRPG_FloorDamage-setup like "Elemental floor dmg" ,but it should work fine just use the Help Section fron the Plugin for more Informations..
- Added Map Nr.5 "FloorDmG"
--> I think Now we got Finally every important SRPG_Plugin included, others are Incompatible or Unnecessary in this Plugin Setup, if u Recognize any Problems or know about a working and compatible SRPG_Plugin that I might have forgot ,pls let me Know..
->Pls Note: Not all Plugins are Explained well,but every Plugin is in the Right Position and should work fine.
>> the next Update will be as soon any Plugin gets Updated ,in order to keep everything up to date.
 
Last edited:

Zephydra

Villager
Member
Joined
Feb 20, 2013
Messages
7
Reaction score
2
First Language
English
Primarily Uses
Long time thread lurker here! The work you guys are doing to create and improve plugins for this engine is amazing. It's literally the perfect engine for the game I've always wanted to make.

That said, I have a bit of an issue at present. I recently updated the srpgcore and doktor_q's srpg_aoe plugins to the most recent versions as I was having some issues with 0 range AoE attacks not being able to be used even with targets in range (this is now fixed).

Since then however I've noticed that when casting an AoE spell that hits multiple targets it's actually consuming MP for every target hit. This was not the case before I updated plugins so I'm curious as to if this is a bug or if there's a subtle change in how you are supposed to set up AoE abilities now that I've missed. I thoroughly read the instructions to see if there was a new script tag I needed to include and then skimmed the thread before posting and didn't see anyone else mentioning this problem.

It's very possible that the answer is just that I've completely missed something obvious, but I figure it didn't hurt to ask. For reference, here's a screenshot of the editor window showing the skill as it is.

1591317757661.png

Any help would be extremely appreciated as I'm currently finalising a demo to release for playtesting now that a considerable chunk of the game is done.
Thanks in advance!
Zeph~
 
Last edited:

Dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
150
Reaction score
21
First Language
German
Primarily Uses
RMMV
Long time thread lurker here! The work you guys are doing to create and improve plugins for this engine is amazing. It's literally the perfect engine for the game I've always wanted to make.

That said, I have a bit of an issue at present. I recently updated the srpgcore and doktor_q's srpg_aoe plugins to the most recent versions as I was having some issues with 0 range AoE attacks not being able to be used even with targets in range (this is now fixed).

Since then however I've noticed that when casting an AoE spell that hits multiple targets it's actually consuming MP for every target hit. This was not the case before I updated plugins so I'm curious as to if this is a bug or if there's a subtle change in how you are supposed to set up AoE abilities now that I've missed. I thoroughly read the instructions to see if there was a new script tag I needed to include and then skimmed the thread before posting and didn't see anyone else mentioning this problem.

It's very possible that the answer is just that I've completely missed something obvious, but I figure it didn't hurt to ask. For reference, here's a screenshot of the editor window showing the skill as it is.

View attachment 146604

Any help would be extremely appreciated as I'm currently finalising a demo to release for playtesting now that a considerable chunk of the game is done.
Thanks in advance!
Zeph~
That doesnt happen in the Updated SRPG_Demo1.0,-link in the Signature
pls try it and use the Plugins* from there, (they are all up to date and in the right order),in order to find out if your bug still happens..

* i advise to take the SRPG_core and the SRPG_AOE
(i think its a problem of older Plugin Versions)

 
Last edited:

Zephydra

Villager
Member
Joined
Feb 20, 2013
Messages
7
Reaction score
2
First Language
English
Primarily Uses
Thanks for the quick response! Updating to the Core and AoE plugins from your demo totally solved my problem. I wonder what cause it in the first place though, how strange!

I took a look at the extra AoE patterns you added in, they seem neat although I don't think I personally will make use of them. I really like that you included screenshots for how each pattern looks, but you might want to consider retaking some of them on a map without the see-through glass floor as it makes some of them a little hard to identify.

Zeph~
 

Users Who Are Viewing This Thread (Users: 2, Guests: 5)

Latest Threads

Latest Profile Posts

*when the One Map Challenge is the only time you can finish a game*
Drifty wanted to make sure the default MV spark animation lived on, so he made it in Effekseer for the contest :guffaw::guffaw::guffaw:
Thanks to a post in a forum thread we can better create MV/MZ plugins in Haxe.
Latest video of my adventures in Kingdom Hearts 3~
Imagine every unfunny joke gets a laugh track, and it doesn't top until you genuinely laugh at that unfunny joke.

Forum statistics

Threads
99,565
Messages
966,775
Members
131,199
Latest member
TheFaz
Top