Shoukang

Veteran
Veteran
Joined
Jan 28, 2021
Messages
98
Reaction score
104
First Language
Chinese
Primarily Uses
RMMV
Thank you very much again! It works perfectly.

Is it possible to make one of the skills (the unavailable one) gray (depending on the weapon equipped)?
You can do this with the third optional parameter. Try this code, and replace the skillId with your skill id number. If you want to correlate the skill with equipment, add the skill to the equipment effects should be an effective way.
this.addCommand('skill name', 'skill name', this._actor.canUse($dataSkills[skillId])); };
Or you can do a if check with this._actor.canUse($dataSkills[skillId]) first, if it's not usable don't add this command.
thnx for the hint i think i fixed the battleui issue. Can I change the canto into automatic? Cuz I'll sometimes forget to move them.
I updated my plugin to make it automatic. However, you can still press cancel to delay the canto (because the interaction logic is very long and I don't want to touch it).
If you can put it mostly in the class and states tag, it would be perfect for what I want.

I'm also trying to make the names of the skills used in the map battle appear above, like in the SV battle, but I haven't been successful so far.
I updated my plugin so now class, equips, and states tags work. I used some new note tags to make the logic clearer. You can replace the old note tags with the new ones.
I will think about how to show skill info on the map battle.
 
Last edited:

Adra

Villager
Member
Joined
Jun 14, 2021
Messages
18
Reaction score
5
First Language
Portugueses
Primarily Uses
RMMV
I updated my plugin so now class, equips, and states tags work. I used some new note tags to make the logic clearer. You can replace the old note tags with the new ones.
I will think about how to show skill info on the map battle.
Thanks, it worked perfectly.



Does anyone know if it is possible to check if a certain enemy has a status? If the conditional branch worked on enemies like it does on actors it would be easy.

I'm trying to make a system that shows in mapbattle the state inflicted on the enemy, but the plugin I use needs to indicate which event will have the sprite of the animated state.

I could use DRQ_EventMotions + SRPG_MapBattle_Motions as indicated in past comments, but it doesn't generate exactly the float effect I want.


I solved the problem using the SRPG_EnemyUnits.
 
Last edited:

Den_C

Veteran
Veteran
Joined
Jun 22, 2017
Messages
41
Reaction score
14
First Language
Russian
Primarily Uses
RMMV
You can do this with the third optional parameter. Try this code, and replace the skillId with your skill id number.

It works great, thank you very much! A great idea about «if», it looks even better than with graying out one of the lines.
 

hosercanadian

Veteran
Veteran
Joined
Jul 18, 2016
Messages
53
Reaction score
15
First Language
English
Primarily Uses
In doing on map battles, I cannot get Yanfly Battle Sequences to trigger common events.

Not sure if this is a limitation or an error on my part. Any help would be appreciated.

I am trying to use the QSprite plugin for on map battles as I am using different frame counts for different animations. I was unable to get the same functionality out of the SRPG plugins.
 

NoPiessadface

Veteran
Veteran
Joined
Feb 7, 2019
Messages
133
Reaction score
38
First Language
english
Primarily Uses
RMVXA
is there a possible way to make infinite reinforcements for like defense maps?
 

Adra

Villager
Member
Joined
Jun 14, 2021
Messages
18
Reaction score
5
First Language
Portugueses
Primarily Uses
RMMV
About the request of show the name of skill in mapbattle mode, I maked a solution using YEP_SkillCore and Galv's Timed Message Popups.

In skill note, I set using <Custom Execution> a variable with the name of skill and executed a common event with a mensage box showing the variable with the name of skill with the setting's of Galv's Timed Message Popups, so ever the actor or enemy use a skill, a popup mensagem appear in the screen.

<Custom Execution>
$gameVariables.setValue(varID, "skill name");
$gameTemp.reserveCommonEvent(eventID)
</Custom Execution>

My Popups config stayed:

RPGMV_B7sz9qnIEl.png
 

NatePlays

Veteran
Veteran
Joined
Dec 12, 2018
Messages
88
Reaction score
51
First Language
English
Primarily Uses
RMMV
OK, so I got back to the engine, doing a game prototype from the ground up.
There's this funny behavior happening, where enemies seem to prefer targeting actors with higher ID in the database.
So say, if Marsha is in melee range of a slime, and Harold is 3 spaces behind her, the slime will disengage Marsha to attack Harold.
I had this problem earlier this year and don't remember what solved it. They don't have any fancy AI outside <mode:normal>
 

Shoukang

Veteran
Veteran
Joined
Jan 28, 2021
Messages
98
Reaction score
104
First Language
Chinese
Primarily Uses
RMMV
OK, so I got back to the engine, doing a game prototype from the ground up.
There's this funny behavior happening, where enemies seem to prefer targeting actors with higher ID in the database.
So say, if Marsha is in melee range of a slime, and Harold is 3 spaces behind her, the slime will disengage Marsha to attack Harold.
I had this problem earlier this year and don't remember what solved it. They don't have any fancy AI outside <mode:normal>
I think it's in AI-Control, there's a parameter called target formula.
 

NatePlays

Veteran
Veteran
Joined
Dec 12, 2018
Messages
88
Reaction score
51
First Language
English
Primarily Uses
RMMV
I think it's in AI-Control, there's a parameter called target formula.
thanks for the reply! AIControl is set up like this:

1634673305866.png
if I put "nearestOpponent" inside the Target formula the game crashes. As of now, they consistently target the actor with *****lower ID in their range. All actors have the same Target Rate (MV default actors).


EDIT: I added <aiTarget: 1/distance> to the database enemy and it now targets the nearest actor. Yet, if a bunch actors are in the same distance, the enemy will again show exclusive preference to the one with ********lower ID.

I wonder why this happens... the enemy should pick the target with the highest TargetFormula*TargetRate value, yet, in case of draws, it gets the first one from the list? Shouldn't it choose randomly between those, as to not favor a specific actor over another?

I digress. Has any other plugin dealt with target rates? If not, I might try (probably fail) to patch this one.
 
Last edited:

Shoukang

Veteran
Veteran
Joined
Jan 28, 2021
Messages
98
Reaction score
104
First Language
Chinese
Primarily Uses
RMMV
thanks for the reply! AIControl is set up like this:

View attachment 204297
if I put "nearestOpponent" inside the Target formula the game crashes. As of now, they consistently target the actor with *****lower ID in their range. All actors have the same Target Rate (MV default actors).


EDIT: I added <aiTarget: 1/distance> to the database enemy and it now targets the nearest actor. Yet, if a bunch actors are in the same distance, the enemy will again show exclusive preference to the one with ********lower ID.

I wonder why this happens... the enemy should pick the target with the highest TargetFormula*TargetRate value, yet, in case of draws, it gets the first one from the list? Shouldn't it choose randomly between those, as to not favor a specific actor over another?

I digress. Has any other plugin dealt with target rates? If not, I might try (probably fail) to patch this one.
If you look into the code you will know why. Here is part of the code in Scene_Map.prototype.srpgAITarget:
$gameMap.events().forEach(function(target) { if (!target) return; var posList = $gameTemp.RangeMoveTable(target.posX(), target.posY()); for (var i = 0; i < posList.length; i++) { var pos = posList[i]; var priority = false; var score = target.targetScore(user, action, pos); // check priority target if (score >= 0 && $gameTemp.isSrpgPriorityTarget() == target) { priority = true; } // pick the best target if ((priority && !bestPriority) || (score > bestScore && priority == bestPriority)) { bestScore = score; bestPriority = priority; bestTarget = target; bestPos = pos; } } });
Basically, it loops over the events in ascending order of event id and calculates the target score.
If the target score is greater than the previous best target score, it will update the best target score and the best target. If the score is equal or less nothing will happen.
Therefore, if some targets have the same target score, the target with the lowest event id will be recorded as the best target.
Since SRPG adds actors to battle in ascending order of event id and actor id, the actor with lower id will be assigned to an event with lower event id.(unless you use <type:actor><id:x>, with x > 0 to break this order, you can try it to verify my assumption.) So actors with lower actor id will be preferred in AI targeting.

A simple way to address this issue is to add a small random value in your formula. like 1/(distance + Math.random()*0.01)
 
Last edited:

NatePlays

Veteran
Veteran
Joined
Dec 12, 2018
Messages
88
Reaction score
51
First Language
English
Primarily Uses
RMMV
I'm so glad I got this working. It just doesn't feel right otherwise.
Here's my take on that section of code:

JavaScript:
//line 512
var bestScore = 0;
var bestPriority = false;
var bestTarget = null;
var bestTargetPos = null;
var bestPos = null;

var bestTargetArray = [];
var bestPosArray = [];

if (!isAoE) { // targeting a single unit
    $gameMap.events().forEach(function(target) {
        if (!target) return;

        var posList = $gameTemp.RangeMoveTable(target.posX(), target.posY());
        for (var i = 0; i < posList.length; i++) {
            var pos = posList[i];
            var priority = false;
            var score = target.targetScore(user, action, pos);
            //console.log(score);
            // check priority target
            if (score >= 0 && $gameTemp.isSrpgPriorityTarget() == target) {
                priority = true;
            }
            // // pick the best target OLD CODE
            // if ((priority && !bestPriority) || (score > bestScore && priority == bestPriority)) {
            //     bestScore = score;
            //     bestPriority = priority;
            //     bestTarget = target;
            //     bestPos = pos;
            // }
            //   target has priority, others don't // new target has better score than the rest
            if ( (priority && !bestPriority) || (score > bestScore && priority == bestPriority) ) {
                bestTargetArray = []; bestPosArray = []; //clear options (as there is a better one)
                bestScore = score;
                bestPriority = priority;
                //bestTarget = target;
                //bestPos = pos;
                bestTargetArray.push(target);
                bestPosArray.push(pos);
            } //target has same score as the last ones
            else if (score == bestScore && score > 0 && priority == bestPriority) {
                bestTargetArray.push(target);
                bestPosArray.push(pos);
            }
        }
    });
    //console.log(bestPosArray,bestTargetArray);
    if (bestTargetArray.length != 0){
        //choose an option from the arrays randomly
        var randomIndex = Math.floor(Math.random()*bestTargetArray.length);
        bestTarget = bestTargetArray[randomIndex];
        bestPos = bestPosArray[randomIndex];
        //console.log(randomIndex, bestTarget, bestPos);
        bestTargetArray = []; bestPosArray = []; //clear options (as to not leave junk)
    }
//} else { // targeting an AoE effect
//    $gameTemp.moveList().forEach(function (targetPos) { etc etc etc


Basically, it makes an array with the targets, and the moment a target with greater score/priority comes, the array is cleaned. if a target has lower score it is ignored, and if it has the same score it is added to the array. Then I just choose the position and target with one random number.

The code actually looks over every position the AI can be so to target an enemy. This means, as of now, if a target has two sides exposed to the enemy, they have double the chances to be chosen. I actually like how that works, but to have all targets have equal chances, just test if target is in bestTargetArray already, and if so, don't push both target and pos to their arrays.

After an hour of debugging it works. Had this bug where enemies would target themselves and Object events (latter leading to crashes), but it was just a typo: targets with score of 0 and lower should be ignored, as per plugin description, and I forgot about that.
1634682565349.png
It's now fixed, but open to further testing. One could edit this into AIControl but I don't know if Dr.Q would like someone else posting their plugin, so I'm keeping the file to myself. The code is ready to paste in if someone wants it.
 

boomy

Veteran
Veteran
Joined
Jan 6, 2013
Messages
186
Reaction score
159
First Language
English
Primarily Uses
RMMV
is there a possible way to make infinite reinforcements for like defense maps?
How to do enemy reinforcements
  1. Create an empty event on the same map with stepping animation on. You can put it anywhere on the map. No need to set a character sprite. Just remember the eventId
  2. When you want to trigger the reinforcement (ideally using the <actorTurn> or <afterAction> event functionality that srpg_core.js introduces), run the following code:

    $gameMap.events()[eventId].locate(x,y);
    $gameMap._interpreter.addEnemy(eventId, enemyId)


  3. Make sure the event is not spawning on a square that is impassable or is occupied.
  4. If you want infinite spawn, you will need an event spawner plugin such as ones provided by Yanfly (paid) or Galv (free). Though if you put enough empty events on your map you should have more than enough reinforcements
Dr.Q would like someone else posting their plugin
Dr. Q's plugins are MIT licence so you can do whatever you want with them. You could release your edit as a full blown rewrite (fork) or you could put into a small plugin as a compatability fix thingy

As for your plugin, works fine. Probably worthwhile fixing AoE logic too while we're at it?
I personally used <aiTarget:formula> on all my skils to calculate targets but fixing AI globally is a much better fix.
 

NoPiessadface

Veteran
Veteran
Joined
Feb 7, 2019
Messages
133
Reaction score
38
First Language
english
Primarily Uses
RMVXA
How to do enemy reinforcements
  1. Create an empty event on the same map with stepping animation on. You can put it anywhere on the map. No need to set a character sprite. Just remember the eventId
  2. When you want to trigger the reinforcement (ideally using the <actorTurn> or <afterAction> event functionality that srpg_core.js introduces), run the following code:

    $gameMap.events()[eventId].locate(x,y);
    $gameMap._interpreter.addEnemy(eventId, enemyId)


  3. Make sure the event is not spawning on a square that is impassable or is occupied.
  4. If you want infinite spawn, you will need an event spawner plugin such as ones provided by Yanfly (paid) or Galv (free). Though if you put enough empty events on your map you should have more than enough reinforcements

Dr. Q's plugins are MIT licence so you can do whatever you want with them. You could release your edit as a full blown rewrite (fork) or you could put into a small plugin as a compatability fix thingy

As for your plugin, works fine. Probably worthwhile fixing AoE logic too while we're at it?
I personally used <aiTarget:formula> on all my skils to calculate targets but fixing AI globally is a much better fix.
ok thanks not to be greedy here but is it possible to make enemies interact some kind of an event for ex. thieves stealing your chests, bandits destroying village, etc.
 

boomy

Veteran
Veteran
Joined
Jan 6, 2013
Messages
186
Reaction score
159
First Language
English
Primarily Uses
RMMV
How to make an enemy thief like in Fire Emblem

The following code will make enemy Id of 'A' move to location of 'X, Y' where we put a treasure box and once the enemy reaches the treasure box it will move to escapeZone location of 'B, C' and disappear. The enemy will ignore all actors and not engage in battle. If you want to change it so enemy 'A' engages in battle if a nearby actor is present, then change all instances of 'absPositition' to 'position'
  1. Have the following scripts installed:
    1. SRPG_AIControl (Dr. Q)
    2. SRPG_MoveMethod (ShouKang)
  2. Make treasure box (or treasure boxes) with two pages (Second page activated with selfSwitch = A) and an event notetag of <aiFlag:Target> (or whatever you want to call it)
  3. Record X, Y location of treasure box
  4. Make an enemy (or enemies) with the following requirements:
    1. Unique enemyId (eg. <type:enemy><id:4>
    2. AI movement tag to X, Y location of treasure box: (eg. <mode:absPosition 12 12>)
    3. These 3 tags will be in the event notebox of the enemy
  5. Make a new event (somewhere random) with the event notetag <type:afterAction>
  6. Put a script call with the following code:

    var enemyId = 4;
    var escapeZone = [16, 0];
    var aiFlagName = "Target";
    for (var i = 0; i < $gameMap.events().length; i++) { if ($gameMap.events().aiFlag() == aiFlagName) { for (var j = 0; j < $gameMap.eventsXy($gameMap.events().posX() + 1, $gameMap.events().posY()).length; j++) { if ($gameMap.eventsXy($gameMap.events().posX() + 1, $gameMap.events().posY())[j].event().meta.id == enemyId) { $gameMap.eventsXy($gameMap.events().posX() + 1, $gameMap.events().posY())[j].setAiMove("\"absPosition " + escapeZone[0] + " " + escapeZone[1] + "\""); $gameSelfSwitches.setValue([$gameMap._mapId, $gameMap.events().eventId(), 'A'], true); } } for (var j = 0; j < $gameMap.eventsXy($gameMap.events().posX() - 1, $gameMap.events().posY()).length; j++) { if ($gameMap.eventsXy($gameMap.events().posX() - 1, $gameMap.events().posY())[j].event().meta.id == enemyId) { $gameMap.eventsXy($gameMap.events().posX() - 1, $gameMap.events().posY())[j].setAiMove("\"absPosition " + escapeZone[0] + " " + escapeZone[1] + "\""); $gameSelfSwitches.setValue([$gameMap._mapId, $gameMap.events().eventId(), 'A'], true); } } for (var j = 0; j < $gameMap.eventsXy($gameMap.events().posX(), $gameMap.events().posY() + 1).length; j++) { if ($gameMap.eventsXy($gameMap.events().posX(), $gameMap.events().posY() + 1)[j].event().meta.id == enemyId) { $gameMap.eventsXy($gameMap.events().posX(), $gameMap.events().posY() + 1)[j].setAiMove("\"absPosition " + escapeZone[0] + " " + escapeZone[1] + "\""); $gameSelfSwitches.setValue([$gameMap._mapId, $gameMap.events().eventId(), 'A'], true); } } for (var j = 0; j < $gameMap.eventsXy($gameMap.events().posX(), $gameMap.events().posY() - 1).length; j++) { if ($gameMap.eventsXy($gameMap.events().posX(), $gameMap.events().posY() - 1)[j].event().meta.id == enemyId) { $gameMap.eventsXy($gameMap.events().posX(), $gameMap.events().posY() - 1)[j].setAiMove("\"absPosition " + escapeZone[0] + " " + escapeZone[1] + "\""); $gameSelfSwitches.setValue([$gameMap._mapId, $gameMap.events().eventId(), 'A'], true); } } } } for (var i = 0; i < $gameMap.eventsXy(escapeZone[0], escapeZone[1]).length; i++) { if ($gameMap.eventsXy(escapeZone[0], escapeZone[1]).event().meta.id == enemyId) { $gameMap.eventsXy(escapeZone[0], escapeZone[1]).erase(); } }



    1. Change enemyId, escapeZone and aiFlagName
    2. enemyId will be 4 in this example (because we set enemy4 to move towards a treasure box)
    3. EscapeZone are the coordinates of where the enemy will move to once it has accessed the treasure box (and disappear)
    4. aiFlagName is set to target because thats the flag we set the treasure box to have
 
Last edited:

Shoukang

Veteran
Veteran
Joined
Jan 28, 2021
Messages
98
Reaction score
104
First Language
Chinese
Primarily Uses
RMMV
Big update here!

I uploaded a demo game on my Github web page. You can play it on a web browser!
https://shoukanghong.github.io/Shoukang_SRPG_plugin/ShoukangSRPGDemo/

Currently, the project is not open for download, as it may still have some bugs and it's not final.
I think it's a cool way to show you what my plugins can do and the current stage of SRPG Engine!
 
Last edited:

moldy

Veteran
Veteran
Joined
Nov 15, 2015
Messages
278
Reaction score
52
First Language
English
Primarily Uses
Haven't been around in quite a while but just wanted to say this plugin is amazing. It feels and performs so much more fluid than the other SRPG plugins.

Question about summons...I get the gist of how to event them (I think?), how would I go about saving the X and Y coordinate of the targeted tile I want my summon to occupy? That way I can move the placeholder event box to the tile of my choosing in battle?
 

NatePlays

Veteran
Veteran
Joined
Dec 12, 2018
Messages
88
Reaction score
51
First Language
English
Primarily Uses
RMMV
Dr. Q's plugins are MIT licence so you can do whatever you want with them. You could release your edit as a full blown rewrite (fork) or you could put into a small plugin as a compatibility fix thingy
Fixed AoE targeting as well, it's very similar. The pull request is up, should be public, as well as my patch1 branch.


Core version 1.34+Q (the one in the header post) tried to introduce a timer for the results screen, but it just broke it. Instead of waiting for input or waiting a couple of seconds, it just ends before you can even read how much exp your unit got. Functions were moved around, and now my old patch is also worthless.
1634817099827.png
_srpgBattleResultWindowCount is supposed to be a timer, and when that ends, it waits for you to press 'OK' (console still says that's the case), yet the demo just jumps ahead that step and ends battle anyways (without my plugins). That variable is initialized a bit earlier as 60 (fixed, no plugin variable) but when this function is called it starts already at 0, so that's not working...

I made a very crude patch but I'm not proud of it at all, just needed something to let me read the exp somehow. I will try something else later on, when I get my prototype game working. Here it is, anyway:
1634817417551.png
_battleResultsTimer is set by plugin either manually or plugin variable, in frames. It takes advantage of the writing exp timer, which is not advisable.
I will get back to this if this it's not fixed in a month or so. It looks like it should be simple (just initialize the Count in the right place), but it's not a priority for me. If anyone does fix that, please make it a plugin var as well, having to check both side and map battle for all 'magic numbers' is a hassle.



On a side note, NoPiessad's questions may sound obnoxious sometimes but now we have some posts to link to whenever someone has similar questions, so I'd say that's a win. Glad we can help.
 

boomy

Veteran
Veteran
Joined
Jan 6, 2013
Messages
186
Reaction score
159
First Language
English
Primarily Uses
RMMV
Haven't been around in quite a while but just wanted to say this plugin is amazing. It feels and performs so much more fluid than the other SRPG plugins.

Question about summons...I get the gist of how to event them (I think?), how would I go about saving the X and Y coordinate of the targeted tile I want my summon to occupy? That way I can move the placeholder event box to the tile of my choosing in battle?
I use yanfly skill core to run an <after eval> code after using a skill

Using the <cellTarget> skill tag allows a skill to target any valid square (i think its bundled with one of Dr Q's AOE plugin or position plugin)

When you use the skill, we can spawn/move a unit to $gamePlayer.posX(), $gamePlayer.posY()

My implementation of summons requires a paid plugin so I can't really help too much but I hope this guides you in the right direction.
 

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,003
Reaction score
524
First Language
German
Primarily Uses
RMMV
Using the <cellTarget> skill tag allows a skill to target any valid square (i think its bundled with one of Dr Q's AOE plugin or position plugin)
its the plugin "position effekts" from DrQ.
with that plugin its pretty simple to summon or to teleport Units.
Its one of the importent Plugins from DRQ which i suggest to use in any case.

Screenshot_1.png
 

moldy

Veteran
Veteran
Joined
Nov 15, 2015
Messages
278
Reaction score
52
First Language
English
Primarily Uses
I use yanfly skill core to run an <after eval> code after using a skill

Using the <cellTarget> skill tag allows a skill to target any valid square (i think its bundled with one of Dr Q's AOE plugin or position plugin)

When you use the skill, we can spawn/move a unit to $gamePlayer.posX(), $gamePlayer.posY()

My implementation of summons requires a paid plugin so I can't really help too much but I hope this guides you in the right direction.

You and dopan are my heroes. I managed to figure it out with your help. Thanks!! Another question....how well does this battle system handle reactive skills? Lets say I get attacked with a spell, and I want to copy that spell and throw it back at the enemy on that same turn. Do any of the extension plugins allow me to do that?
 

Latest Threads

Latest Posts

Latest Profile Posts

Sizzle sizzle sizzle...
zbf1dCZ.gif
Sharing my past was a mistake. Will delete the post when I get access to a working internet connection again.
TFW you get a plugin working correctly with your other plugins ♡\( ̄▽ ̄)/♡

(CW for minor gore - Einar's Y incision is gone for his test portrait)

Cs5kAbZ.png
Doing some winter related edits for a cozy cottage!
I think it's the third time I am changing my skill info plugin, but as I get better at programming, I want to fix the trash I made earlier :p

Streaming while I am programming the plugin. Join in if you wish :)

Forum statistics

Threads
116,981
Messages
1,103,496
Members
152,845
Latest member
Zynarith2
Top