MV - SRPG Engine MV - Plugins for creating Tactical Battle System

● ARCHIVED · READ-ONLY
Started by RyanBram 3313 posts Page 139 of 166 View original ↗
  1. noted.. I will try it...
    dopan said:
    my plugin SRPG_UnitGroups.js ..
    adapted a script which i found in the srpg core, with different variations, including this minimum variation for own edit usage: (img is from UnitGroups-plugin)
    ..
    this is able to trigger a group of units, in this case its all alive units ,actors and enemys..
    (your method should work aswell, this is just another method)

    View attachment 253609
    --> i used a game-interpreter function , so that the script can be triggered via scriptcall
    ...
    i also made a little github tutorial, where i show this script and other basic srpg scripts..
    ( i used github in order to better show the js code )
    Srpg-plugins/$ScriptCallList_SRPG.js at main · DopanPlugins/Srpg-plugins ---
    script for unit groups ect is already explained a few times in this thread^^
    ---

    edit
    - SRPG_UnitGroups.js is in my demo & i reuploaded it to my github mainpage ..
    and I failed to make same like your template..
    I finish make this

    MV/SRPGgearMV_JP/js/plugins/SRPG_Custom.js · main · G. Wibisono / Rpgmaker · GitLab
    how to use

    HltHUzy4uf.jpg
    plugin setting
    var id mp is for variable you use to recover mp (default on variable id 7). Insert the number first before execute recover MP
    001.jpg
    Battle start state
    on Battle start put Plugin command
    Code:
    SRPGStartNoMP
    to make all character and enemy MP = 0. This is include AI
    QWRuf4tc6d.jpg
    Turn end State
    since MP must recover during turn.. added number on your variable (default 7) then use plugin command
    Code:
    SRPGGainMP

    if you want to recover all character use
    Code:
    SRPGRecoverAll
    any suggestion for the name?

    JavaScript:
         Game_System.prototype.SRPG_recoverAll = function() {
            console.log($dataSystem );
            $dataSystem.partyMembers.forEach(function(actorId) {
                var actor = $gameActors.actor( actorId);
                if (actor) {
                    actor.recoverAll();
                    //console.log("recover all battler");console.log(actor, actorId );
                }
    
            });
            
         } 
         
         Game_System.prototype.SRPG_startMP0 = function() {
            //recoverAll friend
            this.SRPG_recoverAll();
            $dataSystem.partyMembers.forEach(function(actorId) {
                var actor = $gameActors.actor(actorId);
                if (actor) {
                    actor.gainMp( -actor.mmp );
                    //console.log("decrease mp");console.log(actor,  actorId);
                }
            });
        //only enemies and AI
            $gameMap.events().forEach(function(event) {
              var eventId=event.eventId();
              var battlerArray = $gameSystem.EventToUnit(eventId);
            //----------------
              if (battlerArray && (battlerArray[0] === 'actor' || battlerArray[0] === 'enemy')) {
                var mpUnit = battlerArray[1].mmp;//max mp
                if (battlerArray[1].isAlive()) battlerArray[1].gainMp( -mpUnit);
              }
            //----------------
            });
            
        }
    this is the code you can make mp turn 0.. fyi.. I make sure all character is heal then make mp turn 0

    since you make mp 0. you need function to recover the mp
    JavaScript:
         Game_System.prototype.SRPG_gainMP = function() {
             
        //only enemies and AI
            $gameMap.events().forEach(function(event) {
              var eventId=event.eventId();
              var battlerArray = $gameSystem.EventToUnit(eventId);
            //----------------
              if (battlerArray && (battlerArray[0] === 'actor' || battlerArray[0] === 'enemy')) {
                var mpUnit =  $gameVariables.value( SRPG_Custom.varIdMP );
                if (battlerArray[1].isAlive()) battlerArray[1].gainMp(  mpUnit );
              }
            //----------------
            });
            
         };
    hope this help you
    Aurawhisperer said:
    This works. After playing with it though, it seems like the increase method won't work either. So like, when all MP is 0'd, per turn both sides have a MP regen of +10 per passing turn. Such an example: player phase, everyone gets a +10 on MP. Enemy phase, same thing. That way, either side can use magic one the appropriate amount is available to use.

    Edit: Figuring an alternative (Something I want to remove eventually) I made a state called MP Regen and force it under the actor and enemies. This works after turn 1, for it does not work right away on the same turn. What I can do if there's no solution is after SRPG Battles, I can remove the state from the actor so that it doesn't apply in the dtb mode (seeing this game will be dtb/srpg based.) and MP can be used normally when in dtb.

    Update on edit: Find out enemies MP won't regen, and state doesn't exist.

    Final Update: For adding the id, I created the script that Dopan provided and explained to me. For right now, maybe it is best for me to use the state MP Regen. Added the solution in pics.

    View attachment 253647
    I'm focus on making into plugins.. and not read this..
    hope the plugins works

    * added new quote (not added new reply)
    * I forgot about the state.. sory
  2. gundambison said:
    * I forgot about the state.. sorry
    with your solution, no state is needed..
    ( sidenote: just as info, your script will affect all Units not just AI & Enemy, like you wrote it in the plugin "//"-infos )

    but as i sayed that is not required.. the plugin "UnitGroups",
    already gives scriptcalls to change mp on groups, to recover groups and much other solutions..
    the only issue with "unitGroups-plugin" would be to set mp to 0, because we cant insert max mp, the same way you did..
    (we could use-999, that should work .. or whatever the max mp in your game is)
    -> i think removing more mp than an Unit has should be no bug issue and ending in 0

    2023-02-19 00_05_58-Storage-old-plugins-_SRPG_UnitGroups.js at main · DopanPlugins_Storage-old...png

    "UnitGroups" also gives different options/scriptcalls for only actors affected, only enemys or both ..
    ---

    you can use these scriptcalls the same way you used your plugin commands, ..
  3. JavaScript:
    for (var i = 1; i <= $gameMap.events().length; i++)
    I'm testing on this situation
    I have 10 event on map. event no 5 is deleted ( manual). total event on the map are 9 (5 is delete). It mean, event id 10 is not check or process.. that's why I'm using
    JavaScript:
    $gameMap.events().forEach(function(event) {
    		  var eventId=event.eventId();
    
    });
    I know.. there no way someone deleted the event manual
    edit: Already tried on SRPG Gear MV. and it fail not read the last person

    After review my own code and compare to you.. I think some just need plugins, other need full script..

    Should be Plugins, because no parameter must send
    • turn all mp to 0.
      Code:
      this.allUxGainMp(-9999);
      if the character have more than 999 mp example this game.
      disgaea
      ss_newsystem02_02.png
    • Recover all
    • Etc
    Should be as function like you mention
    • increase MP all
    • count enemy in map (On progress). count all, only alive or only defeat?
    • count character in map (On progress). . count all, only alive or only defeat?
    • Etc
  4. dopan said:
    with your solution, no state is needed..
    ( sidenote: just as info, your script will affect all Units not just AI & Enemy, like you wrote it in the plugin "//"-infos )

    but as i sayed that is not required.. the plugin "UnitGroups",
    already gives scriptcalls to change mp on groups, to recover groups and much other solutions..
    the only issue with "unitGroups-plugin" would be to set mp to 0, because we cant insert max mp, the same way you did..
    (we could use-999, that should work .. or whatever the max mp in your game is)
    -> i think removing more mp than an Unit has should be no bug issue and ending in 0

    View attachment 253651

    "UnitGroups" also gives different options/scriptcalls for only actors affected, only enemys or both ..
    ---

    you can use these scriptcalls the same way you used your plugin commands, ..
    Thx for your input.. I try to fix my own plugins to work better.
    fyi..

    you are forgeting to update your function name like
    allAxLearnSkill => allAxAddSkill
  5. gundambison said:
    you are forgeting to update your function name like
    allAxLearnSkill => allAxAddSkill
    about the name of a plugin function
    you are correct the name in the plugin description was not correct, the script in the plugin is "allAxAddSkill"
    i will fix it , also in the demo, which means i need to reupload the demo on itchio
    done
    ---------
    about messed up event ids
    I have 10 event on map. event no 5 is deleted ( manual). total event on the map are 9 (5 is delete). It mean, event id 10 is not check or process.. that's why I'm using
    you are right, if you mess up your event ids on a map because you deleted some, resulting in the last id beeing to high and any smaller id beeing missing ect.
    In such case "forEach" works better..
    but i recommend to avoid mess up your event ids on any map..
    because the srpg core uses "for" and you will get bugs, if the event ids on the map are not correct. Its just a matter of time..

    -> as soon any event is deleted (not erased) in the editor, this event id gets free, the solution is to use/copy the last-event(means event with the highest id), delete it and put it back, so that it gets the leftover, smaller event id.
    ---
    about forEach & the UnitGroups plugin
    infact i use forEach often myself its a good method for lot of things, but when i made the unitgroups plugin i didnt know "forEach" it was one of my first (noobisch) plugins.
    I just figured out the small script from the srpg-core and tried to build as much variations, as i could imagine at the point..
    (i am not trying to argue which method is better, they are both usefull..)
    ----
    about the max-mp thing..
    i know thats why i sayd "whatever the max mp in your game is"
    ----
    about building a plugin for the "MP-Reset/MP-Regen":
    i dont plan to build any plugin for this, or to edit any plugin, i just wanted to show that there is allready a plugin doing these things and even more.
    And in my oppinnion no plugin is needed at all for this, because it can be solved with small scripts, which can be adjusted to do exactly what is needed ..
    but in some cases the unitGroups plugin makes it easier, thats why i showed it.
    (also some new users dont know any script and they can easy make their first steps in learning some scripts, from reading "simple scripted" -plugins..
    ..thats basicly what the unitgroups plugin is good for)

    ---

    about check if unit is alive/death
    if i remember correct, the "isAlive" script is part of the YEP-plugins,
    while "isDeath" is basic.. thats why i use "isDeath", with "!" to check if "not death", instead of using "isAlive" like you do..
    its better in cases where other users dont use/have YEP plugins..

    ---
    about double posting
    pls avoid it (forum rules)
  6. dopan said:
    about the name of a plugin function
    you are correct the name in the plugin description was not correct, the script in the plugin is "allAxAddSkill"
    i will fix it , also in the demo, which means i need to reupload the demo on itchio
    done
    ---------
    about messed up event ids

    you are right, if you mess up your event ids on a map because you deleted some, resulting in the last id beeing to high and any smaller id beeing missing ect.
    In such case "forEach" works better..
    but i recommend to avoid mess up your event ids on any map..
    because the srpg core uses "for" and you will get bugs, if the event ids on the map are not correct. Its just a matter of time..

    -> as soon any event is deleted (not erased) in the editor, this event id gets free, the solution is to use/copy the last-event(means event with the highest id), delete it and put it back, so that it gets the leftover, smaller event id.
    ---
    about forEach & the UnitGroups plugin
    infact i use forEach often myself its a good method for lot of things, but when i made the unitgroups plugin i didnt know "forEach" it was one of my first (noobisch) plugins.
    I just figured out the small script from the srpg-core and tried to build as much variations, as i could imagine at the point..
    (i am not trying to argue which method is better, they are both usefull..)
    ----
    about the mp thing..
    i know thats why i sayd "whatever the max mp in your game is"
    ----
    about building a plugin for the "MP-Reset/MP-Regen":
    i dont plan to build any plugin for this, or to edit any plugin, i just wanted to show that there is allready a plugin doing these things and even more.
    And in my oppinnion no plugin is needed at all for this, because it can be solved with small scripts, which can be adjusted to do exactly what is needed ..
    but in some cases the unitGroups plugin makes it easier, thats why i showed it.
    (also some new users dont know any script and they can easy make their first steps in learning some scripts, from reading "simple scripted" -plugins..
    ..thats basicly what the unitgroups plugin is good for)

    ---

    about check if unit is alive/death
    if i remember correct, the "isAlive" script is part of the YEP-plugins,
    while "isDeath" is basic.. thats why i use "isDeath", with "!" to check if "not death", instead of using "isAlive" like you do..
    its better in cases where other users dont use/have YEP plugins..

    ---
    about double posting
    pls avoid it (forum rules)
    Do you updated the plugins? I will download it again
    .
    About using for..
    I'm suggest to keep using the for.. Inside the "for "need adjustment.
    I will update the fix in this reply.

    The fix (19 Jan 2023)
    since you type the script like this
    JavaScript:
    for (var i = 1; i <= $gameMap.events().length; i++) {
       var battleunit = $gameSystem.EventToUnit([i]);
       var eventunit = $gameMap.event([i]);
    //----etc
    }
    I suggest change into this
    JavaScript:
    //---start here
    for (var num = 0; num <  $gameMap.events().length; num++) {
       let event = $gameMap.events()[num];
       var i = event.eventId();
    //---end here
       var battleunit = $gameSystem.EventToUnit([i]);
       var eventunit = $gameMap.event([i]);
    //----etc
    
    }
    //end for
    Update:
    * already done.. waiting for new comment.
    * I tried to avoid DRY (Don't repeat yourself)..
    * I think to change my plugin name into other.. or proper one.
  7. gundambison said:
    Do you updated the plugins? I will download it again
    yes thats why my post says "done".. and i only updated the one plugin-description mistake ,in the UnitGroups Plugin
    ( on all github links and in the itchio-demo )
  8. Is there a way to check to see if a tile is empty before adding reinforcements? Some ideas I have, but not sure how to implement:
    1. Conditional Branch with a script call
    2. Toggle a Switch if a unit stands on the tile, thus using that as the condition.
    I can use Advanced Interactions for #2, but would like the switch to only be on if the unit is currently standing on the space.

    Anyone solved this dilemma?
  9. e463gx said:
    Is there a way to check to see if a tile is empty before adding reinforcements? Some ideas I have, but not sure how to implement:
    1. Conditional Branch with a script call
    2. Toggle a Switch if a unit stands on the tile, thus using that as the condition.
    I can use Advanced Interactions for #2, but would like the switch to only be on if the unit is currently standing on the space.

    Anyone solved this dilemma?
    create the map first.. then explain the scenario..
    ex:
    team of 5 man defending fortress​
    5 enemies marching into your position from bottom.​
    after defeat 3 and end your turn​
    suddenly show up more enemy in bottom​

    based on this scenario.. you don't need to add checking position

    If you make something like SRW L final stage
    copy from gamefaq
    Starting Allies:

    -Minerva (Talia, Arthur)
    -Macross Quarter (Jeffery, Bobby)
    -Daiku-Maryu (Lulu, Rosa)
    -Up to 22 squads

    Starting Enemies:
    (bla bla nah you don't want to see al list)
    Enemy Reinforcements

    [1] Gartdeus is attacked:
    (bla2)

    [2] All Core Fortresses destroyed:
    (bla2)

    [3] Less than 20 enemy squads remain:
    (bla2)
    that's where you need to check. My solution
    • pick the position to show up.. put in one line like on Y=10
    • collect all event position on Y
    • use the empty position to show reinforcement
    Better see what scenario you have, before make the solution.
  10. e463gx said:
    Is there a way to check to see if a tile is empty before adding reinforcements? Some ideas I have, but not sure how to implement:
    1. Conditional Branch with a script call
    2. Toggle a Switch if a unit stands on the tile, thus using that as the condition.
    I can use Advanced Interactions for #2, but would like the switch to only be on if the unit is currently standing on the space.

    Anyone solved this dilemma?
    there is a much easier way^^

    How to know if any specific map-position has any battleUnit located ? :

    in the srpg core help info there is a scriptcall:

    this.isEventIdXy(VariableID, X, Y);
    # Stores the event ID of the specified coordinates (X, Y) in the variable.


    2023-02-19 18_15_32-SRPG_core.js - Editor.png

    what the info doesnt say, is that to avoid bugs, it first set the variable to 0..
    and this only checks battleUnits no normal events..


    This script should be called: "this.isUnitXy(VariableID, X, Y); " instead^^
    (because it doesnt check normal events and that can be confusing, if not knowing & not reading the code)

    however if you use this scriptcall, than check the variable, and the variable value returns 0, than you know there is no battleUnit on this position..
    If the number is higher than 0, than its the event id of the BattleUnit which is located on that position
  11. dopan said:
    there is a much easier way^^

    How to know if any specific map-position has no battleUnit located ? :

    in the srpg core help info there is a scriptcall:

    this.isEventIdXy(VariableID, X, Y);
    # Stores the event ID of the specified coordinates (X, Y) in the variable.


    View attachment 253722

    what the info doesnt say, is that to avoid bugs, it first set the variable to 0..
    and this only checks battleUnits no normal events..


    however if you use this scriptcall, than check the variable, and the variable value returns 0, than you know there is no battleUnit on this position..
    If the number is higher than 0, than its the event id of the BattleUnit which is located on that position

    Perfect!

    Thank you Dopan!
  12. e463gx said:
    (..)
    old posting:
    Spoiler
    i am not sure if you missunderstood me or if i missunderstood what you want..

    If you want to make sure that the "reinforce-position" has no battleUnit on it , before trigger the reinforcement.. than you can use my solution.
    you only need to use the scriptcall & add an if condition that checks if the variable value is 0 or not higher as 0..
    and if its 0 the reinforcement is allowed..
    ------------
    if thats not what you want, than i missunderstood what you want..
    --
    And if you use a spawner plugin, than it might have an option to not spawn if the position has already any event..
    edit:
    however if you need help on using the script or on building the if condition, just let me know
  13. Hi, played the demo and if useAgiAttackPlus is on (which is default) while using Mapviewbattle, Alex's skill pierce would freeze the game when agility is high enough to cause 2 attacks. Happens in both 2nd and 3rd map.

    Searched through several pages but haven't found anything, is it just me?
  14. Getting a weird error. When attempting attempting to save the game I get the buzzer sound and can't save my file. When then exiting I get the attached error:

    Code:
    Type Error: this._events.filter is not a function

    Here's the weird part - I've found out that it only happens after i've started a battle. Any solutions or thoughts?
  15. e463gx said:
    Code:
    Type Error: this._events.filter is not a function
    if you get an error, then it also show which plugins are involved, and where in these plugins that happens..
    i mean the line-number in the plugin ect..
    without these infos nobody can know ,what the problem could be..
    -----
    @miragewolf
    i didnt ignored you, i just dont use or support agi-att+..sry,
    but perhaps someone else has any idea..
  16. Figured it was a long shot, because it doesn't give me any other information.

    Capture.PNG


    At first I thought it was Yanfly's Save Core - but it happens with that disabled as well.

    Edit: the conflict appears to be from xabileug's SRPG_UnitMapInfo. Once deactivated, I can save just fine.
  17. e463gx said:
    Figured it was a long shot, because it doesn't give me any other information.

    View attachment 253802


    At first I thought it was Yanfly's Save Core - but it happens with that disabled as well.

    Edit: the conflict appears to be from xabileug's SRPG_UnitMapInfo. Once deactivated, I can save just fine.
    open the console by hit F8, and screenshot the red error text^^

    and which version of the plugin (xabileug's SRPG_UnitMapInfo) do you have (where did you get it ? )
    in the plugin version in my demo this script part doesnt exist:
    "this._events.filter"
    .. it could also be a conflict betwen several plugins, ..
  18. dopan said:
    open the console by hit F8, and screenshot the red error text^^

    and which version of the plugin (xabileug's SRPG_UnitMapInfo) do you have (where did you get it ? )
    in the plugin version in my demo this script part doesnt exist:
    "this._events.filter"
    .. it could also be a conflict betwen several plugins, ..
    I'm using version 1.5

    Appreciate the assistance, here's the error messages it's pulling
  19. e463gx said:
    I'm using version 1.5

    Appreciate the assistance, here's the error messages it's pulling
    you seems to have a few erros, the last one was just the gamebreaking one..

    however i cant see on this img that any script part of "xabileug's SRPG_UnitMapInfo" is involved..

    if you use the same rpg objects version like i do, than i guess the gamebreaking error happens here:
    2023-02-20 23_14_25-rpg_objects.js - Editor.png


    it probably has something to do with the sprite of an event..thats what the error-info below indicates (on your error img)
    it could also be related on your terrainlighting plugin, i dont know that plugin but it seem to have effect on sprites aswell
    2023-02-20 23_17_30-SRPG Engine MV - Plugins for creating Tactical Battle System _ Page 139 _ ...png

    ----

    I think its perhaps an incompatiblety betwen terrainlighting & SRPG_UnitMapInfo,
    but thats just the best guess i have.. i could be totally wrong
    -> but it is for sure a sprite related problem
  20. Thanks Dopan, thats weird that it culminates in breaking the Save feature!