TAA_EnemyReinforcements - v1.2.2

TAA_EnemyReinforcements - v1.2.2
Created by taaspider

Terms of Use
Any plugins developed by taaspider are free for use for both commercial and noncommercial RPG Maker games, unless specified otherwise. Just remember to credit "taaspider".

Redistribution of parts or the whole of taaspider plugins is forbidden (which also includes reposting), unless it comes from the official website (linked within the post). You are allowed to edit and change the plugin code for your own use, but you're definitely not allowed to sell or reuse any part of the code as your own. Although not required to use my plugins, a free copy of your game would be nice!

Introduction

The plugin provides a flexible way for you to create skills or in battle cutscenes where enemies can call for backup! Use comments on troop event pages to setup reinforcement slots, and then note tags on skills or plugin commands to summon reinforcements into action!

Main Features
  • Prepare reinforcement slots that allows you to setup how large reinforcements can get. You can setup a single default set of placements, or customize it for a specific troop, or battle;
  • Create skills for enemies, so that they can cry for help and summon any enemy you want, or even multiple enemies, be they multiple copies of the same, or a selection of many;
  • Summoning skills can have success probability. That means you can setup a skill that has a chance of failing to summon one or more enemies;
  • Use Plugin Commands to change the plugin configurations midgame, setting things up for that special boss battle you designed!
  • Compatibility with TAA_EnemyLevels, so you can define a specific level or range of levels (to add some randomness) to summoned reinforcements;
  • Automatic management of summon order, to ensure that sprites will be given the proper priority (not have a back row enemy displayed over a front row one);

Screenshots

Spoiler
TAA_EnemyReinforcement_Sample_Small.gif


How to Use

WARNING: This plugin requires RPG Maker MV 1.5.0 or above! Please make sure your RPG Maker MV software is up to date before using this plugin.

First of, download the plugin here. There's a few parameters you use to setup default configs:
  • Enable Self State: This determines if main enemies on troop (usually those that are already there at the start of the battle) will free a reinforcement slot when defeated. That means, if another enemy can be summoned in its place or not after they're dead;
  • Play Summon Animation: Enable or disable animations on summoned reinforcements when they're called into action;
  • Summon Animation: The animation itself to be played;
  • Entrance Delay: Define a number of frames to wait before presenting the enemy at the screen after reinforcements are called. This is usefull if you want to time it just right to your summon animation 😉
  • Entrance Type: Defines how the summoned reinforcement will enter the battle:
    • Enter from Spot: Enemy start to fade in from a few pixels below its target position, as if it is comming out of the ground;
    • Enter from Left: Enemy slides from the left, from out of the screen;
    • Enter from Above: Enemy slides from above, from out of the screen;
    • Enter from Right: Enemy slides from the right, from out of the screen;
    • Enter from Below: Enemy slides from below, from out of the screen;
    • None: Enemy simply appears in its target position;
  • Entrance Duration: Defines how long reinforcements fade in will take in frames;
  • Enable Battle Logs: Enable or disable plugin specific battle logs;
  • Single Summon Message: Message displayed at the battle log when any number of a single enemy is summoned. Use %1 to substitute for the number of reinforcements summoned, and %2 for the enemy name;
  • Auto Plural: If enable, the plugin will automatically add an 's' at the end of the enemy name when more than one is successfully summoned. It has its limitations, but should work fine most of the time for games in english;
  • Multi-Summon Message: Defines a single generic message to display at the battle log when more than one enemy Ids are summoned at the same time;
  • Failed Summon Message: Defines a message to display at the battle logs when a reinforcement call fails, be it by having no reinforcement slots available or any other reason;

Spoiler: NOTE TAGS
Note tags can be applied to troops to customize reinforcement slots. For that, include them as commentaries into the troop's first page (regardless of how many pages you have setup). You can carefully set each slot position through its x and y coordinates, either as a single tag or as a collection of coordinates inside enclosing tags.

Code:
<TAA_ER: x1,y1; x2,y2; ... xn,yn>
      or
<TAA_ER>
x1,y1
x2,y2; x3,y3
...
xn,yn
</TAA_ER>

You can load slots from enemies position on another troop:
Code:
<TAA_ER: TROOP x>
     or
<TAA_ER>
TROOP x
TROOP y
</TAA_ER>

You can enable or disable self as reinforcement individually for each troop using the following tags:

Code:
<TAA_ER: Self on>
<TAA_ER: Self off>
     or
<TAA_ER>
Self on|off
</TAA_ER>

You can also mix and match tags using both the single line and multiline tags. Just separate each command with a semicolon (😉:

Code:
<TAA_ER: x1,y1; TROOP n;Self off>
     or
<TAA_ER>
x1,y1
TROOP n
self on
x2,y2;TROOP n2
</TAA_ER>

Finally, you can add note tags to skills to make it call for reinforcements. Be advised though, that calling for reinforcements without any available slots will result in, well, nothing. Also, this tag only applies for enemies calling for reinforcement. You can have an actor with the same skill, but using it will still summon troop reinforcement. The plugin cannot be used to summon new allies.

To make a skill call for reinforcements, use the following note tags:

Code:
<TAA_ER: id1,n1;id2,n2; ... idn,nn>
    or
<TAA_ER>
id1,n1
id2,n2
...
idn,nn
</TAA_ER>

"id" is the enemy id you want to summon, while n is the number of enemies to summon (so you can have a skill that calls one bat, and another that calls two, for example). You can have as many enemies listed as you want, just remember that reinforcements will be summoned as long as there are slots available. For instance, if you create a skill that calls 3 bats, and the current troop has only two available slots, only two bats are summoned. Every other summon listed for the skill after that will result in nothing. Likewise, if player party kill one of the enemies clearing one slot, that means the next time the skill is used only the first enemy listed on the tag will be summoned and so forth.

Still on skill note tags, you can also add additional notes to define how likely a reinforcement call is to succeed, or a specific level / level range the summoned reinforcement is going to have (YEP_EnemyLevels or TAA_EnemyLevels is needed for this feature):

Code:
<TAA_ER: id1,n1,rX,lvY;id2,n2,lvY2:W2>
[INDENT]or[/INDENT]
 <TAA_ER>
 id1,n1,rX,lvY
 id2,n2,lvY2:W2
 ...
 </TAA_ER>

To add randomness to a reinforcement call, set the tag with the enemy id to be summoned, the number of times it will happen, and then add another comma followed by the letter 'r' and the probability of the summoning succeeding, in a number between 0 and 100 (the higher the number, the most likely it is to succeed). For example: <TAA_ER: 1,1,r85>

If the summon specifies more than one summon for a given enemy the probability will be applied for each individual summon. Take the example below:
Code:
<TAA_ER: 1,2,r85>

Enemy 1 will be summoned two times, and each time has 85% chance of succeeding. That means the skill can summon from zero to two enemy reinforcements.

To define levels for the summoned enemies, add the letters 'lv' followed by the specific level wanted, or a level range separated by ':'. Here's some examples:
Code:
<TAA_ER: 1,1,lv10>
<TAA_ER: 2,1,lv2:5>
<TAA_ER: 5,2,r87,lv5>
<TAA_ER: 1,2,lv8,r95>

Random and Level clauses can appear in any order, as long as the id and number of summons comes first.

Spoiler: PLUGIN COMMANDS
Reinforcement Self Enable
Reinforcement Self On
Enable the use of enemy placement on the current troop as available reinforcement slots after they're defeated.

Reinforcement Self Disable
Reinforcement Self Off
Disable the use of enemy placement on the current troop as available reinforcement slots after they're defeated.

Reinforcement Self Reset
Returns self state to the default config defined in the plugin parameters.

Reinforcement Animation Enable
Reinforcement Animation On
Turn on animation display when a reinforcement is called into the battlefield.

Reinforcement Animation Disable
Reinforcement Animation Off
Turn off animation display when a reinforcements is called into the battlefield.

Reinforcement Animation Set animationId
Change the animation to use when an enemy reinforcement is called into the battlefield.

Reinforcement Animation Reset
Restore default configured animation to play when a reinforcement is called.

Reinforcement Entrance Delay Set delayFrames
Update configured delay in frames with the provided value. You can use a variable to set delay by using the tag \v[variableId].

Reinforcement Entrance Delay Reset
Restore default delay value as configured in the plugin parameters.

Reinforcement Entrance Duration Set durationFrames
Updates the currently configured entrance duration. The parameter 'duration' must be a number greater or equals to zero.

Reinforcement Entrance Duration Reset
Resets entrance duration to its default value, as configured in the plugin parameters. You can use a variable to set duration by using the tag \v[variableId].

Reinforcement Entrance Type Set type
Update the currently configured entrance type. The "type" argument is case insensitive and must be one of the following supported values:
Spot, Left, Above, Right, Below, None

Reinforcement Entrance Type Reset
Reset entrance type to default value, set in the plugin parameters.

Reinforcement Add enemyId lowerLevel upperLevel
Can only be used during a battle scene. Calls the specified enemyId into battle using the first reinforcement slot available. You can use a variable to set enemyId by using the tag \v[variableId].
lowerLevel and upperLevel are used to define the summoned enemy level range. They can be omitted if you don't use enemy levels, or if you want the default enemy level calculation to take place. They can also be variables using the tag \v[variableId].

Reinforcement Reset
Resets all configs to default values.

Spoiler: SCRIPT CALLS
$enrConfig.selfAsReinforcement()
Returns true if the option to turn each enemy position on the current troop available for a reinforcement (after the original enemy is killed). Returns false otherwise.

$enrConfig.enableSelfState()
Enable the use of enemy placement on the current troop as available reinforcement slots after they're defeated.

$enrConfig.disableSelfState()
Disable the use of enemy placement on the current troop as available reinforcement slots after they're defeated.

$enrConfig.resetSelfState()
Returns self state to the default config defined in the plugin parameters.

$enrConfig.isAnimationEnabled()
Returns true if animations on calling a reinforcement is enabled, or false if it's not.

$enrConfig.enableAnimation()
Turn on animation display when a reinforcement is called into the battlefield.

$enrConfig.disableAnimation()
Turn off animation display when a reinforcemente is called into the battlefield.

$enrConfig.resetAnimationEnabled()
Reset to default parameters config if animation on reinforcement call is enabled or not.

$enrConfig.summonAnimation()
Returns the animation ID configured to run when a reinforcement is called into the battlefield.

$enrConfig.setSummonAnimation(animationId)
Change the animation to use when an enemy reinforcement is called into the battlefield.

$enrConfig.resetSummonAnimation()
Restore default configured animation to play when a reinforcement is called.

$enrConfig.entranceDelay()
Returns the configured time (in frames) to wait after calling a reinforcement and it actually starting to appear on the battlefield.

$enrConfig.updateEntranceDelay(delay)
Update configured delay in frames with the provided value.

$enrConfig.resetEntranceDelay()
Restore default delay value as configured in the plugin parameters.

$enrConfig.entranceType()
Returns the current entrance type configured. See plugin help for the list of possible values.

$enrConfig.updateEntrance(type)
Update the currently configured entrance type. The provided type is case sensitive and must be spelled exactly like displayed in the plugin parameters.

$enrConfig.resetEntrance()
Reset entrance type to default value, set in the plugin parameters.

$enrConfig.entranceDuration()
Returns the number of frames it takes for the summoned enemy to appear on the screen (turning from full transparent to full opaque).

$enrConfig.updateEntranceDuration(duration)
Updates the currently configured entrance duration. The parameter 'duration' must be a number greater or equals to zero.

$enrConfig.resetEntranceDuration()
Resets entrance duration to its default value, as configured in the plugin parameters.

$enrConfig.resetAll()
Resets all configs to default.

Demo

You can also test the plugin using my sample demo project. It was built with MV, but you can open it with MZ as well (just open the game.rmmzproject file and you're good to go).

Spoiler: CHANGE LOG
  • Version 1.2.2:
    • Fixed a bug that could cause the game to crash upon summoning an enemy;
    • Added an error handling check to prevent issues with VisuMZ_2_BattleSystemOTB;
  • Version 1.2.1:
    • Fixed a bug in MZ plugin commands that could cause game crash;
    • Fixed a bug that could cause reinforcements to not issue any action in MZ's TPB mode;
  • Version 1.2.0:
    • Added MZ compatibility;
    • Added compatibility and specific features related to TAA_EnemyLevels;
    • Fixed a bug when a summon were performed with no slots configured for the troop;
  • Version 1.1.0:
    • Reinforcements now are layered according to its coordinates, preventing a back row enemy from appearing over a front row one;
    • Included some randomness on skill tags, allowing you to set a probability that a reinforcement summon can succeed;
    • Added a feature to skill note tags allowing you to specify a level, or level range for the enemy reinforcements. YEP_EnemyLevels is needed for this feature;
    • Added the option to use multiple single summon messages when more than one enemy ID is summoned, or keep using the grouped Multi-Summon Message;
  • Version 1.0.0:
    • Initial release;
Any chance you might be able to show some screenshots of what this looks like in the troop section and what it looks like in skill notetags? Some simple examples would help. Thank you!
Any chance you might be able to show some screenshots of what this looks like in the troop section and what it looks like in skill notetags? Some simple examples would help. Thank you!
Hello!

It's quite simple, really.
In the troop section, you can use battle events to add comment tags to determine the reinforcement slots (basically, how many enemies can be summoned, and where they will be placed in the battle scene). You can use either a direct coordinate (like 100,200, to place the enemy at x=100 and y=200 position), or copy positions from another troop. The image below shows both methods (it's from my sample project).
1668448101700.png

Conditions and other events in the troop configuration are irrelevant, as the plugin will always look for the comment tags in the first page and ignore everything else.

As for the skill note tags, just add it to the note section, like the example below (also from my sample project):
1668448239356.png

Please take a look at the plugin help section to check the meaning and dependencies of tag values!

Hope this is of some help! 🙂
Absolutely needed a Plugin like this! But I did run into an issue where the enemy sprites would be on top of the actor battler when spawning in. Is there a way I can refresh the Priorities and or force the actor sprites to always be on top?
Absolutely needed a Plugin like this! But I did run into an issue where the enemy sprites would be on top of the actor battler when spawning in. Is there a way I can refresh the Priorities and or force the actor sprites to always be on top?
Hello!

Can you show me a printscreen as an example?

I tried to have the enemy sprites be dynamically ordered, so they would be stacked based on their position in the screen and not the order they are summoned. It worked well in MV, but for some reason it did not work as expected on MZ... I have it in my backlog to debug it, but I've been having little time to work on plugins lately 🙁
EnemiesOnTop.png

Yep here's a screenshot. Thanks for getting back with me, so soon!
Hello!

Can you show me a printscreen as an example?

I tried to have the enemy sprites be dynamically ordered, so they would be stacked based on their position in the screen and not the order they are summoned. It worked well in MV, but for some reason it did not work as expected on MZ... I have it in my backlog to debug it, but I've been having little time to work on plugins lately 🙁
View attachment 253349
Yep here's a screenshot. Thanks for getting back with me, so soon!
Sorry, I'm not sure I understand what is going in the image... Those large gray things are the enemies, and the weapons drawn right above the actor parameters are the actor battler sprites, right?

When you say they spawn on top of the actor, you mean they appear too low on the screen (behind the battler sprites)?

If so, you just need to alter the reinforcement slots coordinates, as that is what defines where the spawned enemy sprite can appear. In that case, just edit the manual coordinates or the reference troop so the enemies are placed a bit higher in the screen.

But if what you mean is that the summoned enemy sprite appears above the battler sprite, then I'll need to check the code and see what can be done (but that does not seem to be your case if I understood your print correctly).
Sorry, I'm not sure I understand what is going in the image... Those large gray things are the enemies, and the weapons drawn right above the actor parameters are the actor battler sprites, right?

When you say they spawn on top of the actor, you mean they appear too low on the screen (behind the battler sprites)?

If so, you just need to alter the reinforcement slots coordinates, as that is what defines where the spawned enemy sprite can appear. In that case, just edit the manual coordinates or the reference troop so the enemies are placed a bit higher in the screen.

But if what you mean is that the summoned enemy sprite appears above the battler sprite, then I'll need to check the code and see what can be done (but that does not seem to be your case if I understood your print correctly).
Sorry, The large gray things are the Actor Sprites (Weapons) which are supposed to look like a first person perspective. I'm rendering them in Side View, but I've moved the Actor Sprites to look like their in a front view formation. The Head Crab creatures are the enemies and when spawned appear on top of the gray things Actor Sprites (Weapons).
Sorry, I'm not sure I understand what is going in the image... Those large gray things are the enemies, and the weapons drawn right above the actor parameters are the actor battler sprites, right?

When you say they spawn on top of the actor, you mean they appear too low on the screen (behind the battler sprites)?

If so, you just need to alter the reinforcement slots coordinates, as that is what defines where the spawned enemy sprite can appear. In that case, just edit the manual coordinates or the reference troop so the enemies are placed a bit higher in the screen.

But if what you mean is that the summoned enemy sprite appears above the battler sprite, then I'll need to check the code and see what can be done (but that does not seem to be your case if I understood your print correctly).

I highlighted the enemy sprites in Red and the Actor sprites in Green.
EnemiesOnTop_2.png
Is there a way I could disable the "Automatic management of summon order" function? I tried to find where it's located in the script so I could turn it off, but I'm having some trouble finding it.
Is there a way I could disable the "Automatic management of summon order" function? I tried to find where it's located in the script so I could turn it off, but I'm having some trouble finding it.
Nevermind! I just found a quick fix! I just set line: 1594 var battlefieldIndex = 0;
I'm entirely sure what this did, but the Enemies are now spawning behind the Actor Sprites!
Sorry, The large gray things are the Actor Sprites (Weapons) which are supposed to look like a first person perspective. I'm rendering them in Side View, but I've moved the Actor Sprites to look like their in a front view formation. The Head Crab creatures are the enemies and when spawned appear on top of the gray things Actor Sprites (Weapons).
Ahhh... I thought the head crab creatures were part of the large gray thing on the left. I get it now! 🙂

Nevermind! I just found a quick fix! I just set line: 1594 var battlefieldIndex = 0;
I'm entirely sure what this did, but the Enemies are now spawning behind the Actor Sprites!
Currently there is no parameter to simply disable the ordering of summoning sprites. What it does is try to prevent a summoned enemy that is placed higher in the screen to appear on top of another placed in a lower position.

The line you changed is actually what determines how the sprites are ordered. The original code calls a function that checks the sprite Y coordinate and tries to determine how to order all enemy sprites to stack them correctly. By changing it to always use 0 you're telling the plugin that new summons are always placed at the bottom of the stack, regardless of their position on the screen. So new enemies are always placed below all others.
Ahhh... I thought the head crab creatures were part of the large gray thing on the left. I get it now! 🙂


Currently there is no parameter to simply disable the ordering of summoning sprites. What it does is try to prevent a summoned enemy that is placed higher in the screen to appear on top of another placed in a lower position.

The line you changed is actually what determines how the sprites are ordered. The original code calls a function that checks the sprite Y coordinate and tries to determine how to order all enemy sprites to stack them correctly. By changing it to always use 0 you're telling the plugin that new summons are always placed at the bottom of the stack, regardless of their position on the screen. So new enemies are always placed below all others.
Lol, all good. Thanks for getting back and letting me know! Unfortunately I don't have another way of solving the issue at the moment.
Hi @taaspider ! Great plugin and everything seems to work as expected. But there is one minor issue.

When enemy reinforcements in called in, I cannot see their names. Unsure if it's a compatibility issue with VS plugins. Their health bar shows up, but not their name.

I tried running SceneManager._scene._spriteset.update(); to see if that works, but no avail. Any thoughts on this?
Hi @taaspider ! Great plugin and everything seems to work as expected. But there is one minor issue.

When enemy reinforcements in called in, I cannot see their names. Unsure if it's a compatibility issue with VS plugins. Their health bar shows up, but not their name.

I tried running SceneManager._scene._spriteset.update(); to see if that works, but no avail. Any thoughts on this?
Hey there!

Sorry for the long silence... my day job has been driving me crazy :dizzy:

Hmm... that seems to be some compatibility issue. My guess is that there may be some tweaking needed on the VS plugin, maybe. When I run my test project the summoned enemies are correctly named in the enemy selection window. I don't know how their code retrieves the enemy name to display, but if it is through the default enemy functions and properties, there shouldn't be any problems

If you didn't do that already, I sugest checking if they can help you 🙁
Hi there! I wanted to let you know of a compatibility error I was having with your plugin. If I also the the Visual State Effects plugin by Yanfly, I get this error.

YEP_CoreEngine.js:1094 TypeError: Cannot read property 'addChild' of null at Sprite_Enemy.Sprite_Battler.initStateAnimationSprite (YEP_X_VisualStateFX.js:384) at Sprite_Enemy.Sprite_Battler.startStateAnimation (YEP_X_VisualStateFX.js:395) at Game_Enemy.Game_Battler.refreshStateAnimation (YEP_X_VisualStateFX.js:334) at Game_Enemy.Game_Battler.refresh (YEP_X_VisualStateFX.js:293)

Removing or disabling Yanflys plugin lets yours work perfectly as far as I can tell.

Original thread: https://forums.rpgmakerweb.com/threads/taa_enemyreinforcements-v1-2-2.124658/