A downloadable MZ Plugin

Buy Now$12.99 USD or more

Use your shield to block, now available for RPGMaker MZ!

Using this plugin, actors and enemies alike can wield their shields defensively to block incoming damage from blockable attacks. The amount blocked is configurable, and the exact effect of a block can be configured as well.

By default, a successful block reduces incoming damage by x%, and then subtracts y from the remaining amount. Then a block animation is shown on the defender, and a block popup shows on him in place of the damage popup. If the attack still dealt damage, the damage popup will also still show.


Default Blocking

The default plugin values make it so that a successful block resists all damage, as you can see above. 

The actual chance to block is called block rate, and is stored on an actor in an xparam, like hit rate or critical rate. Block rate can be increased or decreased via note tags on equipment, actors, classes, states, or enemies. 

Even if an actor has a source of block rate, they still will not be able to block unless it is enabled. By default, any shield armor will enable blocking, but you can turn off blocking on individual shields via a note tag. You can also manually enable blocking with a note tag that can be used on classes, actors, equipment and states. Enemies will always have blocking enabled unless you specifically disable it for them via note tag.

When a blockable attack is determining its result, it makes a check against the defenders effective block rate. This check works very similarly to how the hit rate check works; the attacker's shield piercing value is subtracted from the defenders block rate, and then a random check is made to see if the defender succeeded in blocking. 

Shield Piercing is an attackers ability to get around a defenders block rate. It is provided via note tags on equipment, enemies, skills or states. An attackers piercing value is removed from the targets block rate, making them less likely to block the incoming attack. This number can actually also be negative, which causes a defender to be more likely to block the attack. Shield piercing can never cause a defender to block who does not have blocking enabled.

When a Block Happens:

When a block is determined to have happened, the following events occur:

  • The block effect occurs
  • The block animation occurs
  • The defender performs the block motion.
  • The block damage popup occurs
  • Damage is applied to the defender, if the adjusted damage value is not zero. A second popup shows for this damage if it isn't zero.
  • Effects from the attack apply (such as poison), but only if the damage value isn't zero, and only if the 'partial effects' plugin option is turned on.

Block Effects:

Block effects are configurable effects that happen when a block occurs. The default one multiplies the incoming damage by the defenders block percentage, and then subtracts the defenders block value from the result. The default values for these are set up in the plugin parameters, but individual equipment, states, classes, actors and enemies can have their own set by note tags. Multiple sources of block percentages are multiplied together, meaning two sources of 50% block value reduce incoming damage by 75%. Multiple sources of block value are additive, meaning that all sources are added together and removed from the remaining damage value after it has been modified by block percentage.

The default block effect uses the defenders block animation, and the default guard motion, but other block effects can override this and show a specific animation in place of the block animation, or cause the defender to make a different motion. I have included several block effects in the plugin parameters to choose from as well. You can also add more to the list and then reference them by note tag, or set them as the default.

value = Ramza.SB.make_damage_value.call(this, target, critical)
value = this.applyBlockDamageModifier(target, value)
The default block effect codebox

This enemy is using the 'thorns' block effect (with a comically undersized shield)

//target deals a percentage of blocked damage back to attacker
value = Ramza.SB.make_damage_value.call(this, target, critical)
var originaldmg = value
value = this.applyBlockDamageModifier(target, value)
var thornsdmg = originaldmg - value
thornsdmg *= 0.33
thornsdmg = Math.round(thornsdmg)
addedWait += 6
a.gainHp(-thornsdmg)
a.startDamagePopup()
The codebox for this thorns block effect

It is important to note that equipment that uses a non-default block effect will not enable that effect unless it also enables blocking. When a battler is checked to see which block effect to use, it is checked in the following order; states - oldest to most recent, equipment - highest slotId to lowest, class, actor, enemy. This means that a state can override the block effect, and equipment located further down in your actors equip slots can override the effect on a shield. If no armor is providing this, the weapon is also checked. If no equips or states are providing one, the class is checked, then the actor or enemy. If no priority effect is found, the default one will be used.

This is a departure from the MV version of this plugin. Block effects are a replacement for the block state that was used in the MV version of this plugin. In MV, in order to make different block effects, you'd need to edit the note tags on the block state to change the react effect when specific conditions were met. Now you can specify items that use specific block effects, and have those effects do different things entirely. A weapon can enable blocking, and cause the defender to melee attack the incoming hit instead of guarding it, or a buff spell can put a state that causes a magical shield to appear in front of the defender and block damage. The possibilities are endless.

Note Tags:

There are a ton of note tags available with this plugin which do a lot of different things. Rather than list them all here with an in depth explanation, I've included very detailed information about them in the help documentation.

Using note tags you can:

  • Make a non-physical skill blockable, or make a physical skill unblockable.
  • Modify the block percent and block amount of an armor, state, or enemy
  • Set the block effect bestowed by an equipment, state, class, actor or enemy
  • Enable blocking on non-shields, or disable it on specific items
  • Cause states to disable blocking
  • Change the block rate bestowed by an equipment, state, class, actor, enemy, etc.
  • Change the shield piercing value of the item, state, actor, enemy, etc

VisuStella MZ Compatibility:

This plugin is fully compatible with the VisuStella MZ library. Because of the differences in the way that battle flows when using the plugin , I had to design a couple of block effects differently depending on which system you're using. Fortunately you can check them in the plugin parameters to see what you might need to do to make your own.

The default block effect in VSBattleCore

One thing you might immediately notice is that that block animation (the shield coming up on top of Reid there) is not appearing over the 'block' text. This is a quirk in MZ that maybe they'll fix at some point, but because VisuStella Engine changed the way damage popups work, it isn't a problem here.

The enemy thorns effect in VSBattleCore.

You can see VSBattleCore includes something that stops damage popups from showing up on top of eachother. This causes the block and damage text to show on different lines. You can also see a slight delay before the reflected damage hits Reid. 

//target deals a percentage of blocked damage back to attacker
value = Ramza.SB.make_damage_value.call(this, target, critical)
var originaldmg = value
value = this.applyBlockDamageModifier(target, value)
var thornsdmg = originaldmg - value
thornsdmg *= 0.33
thornsdmg = Math.round(thornsdmg)
setTimeout(function(){
a.gainHp(-thornsdmg)
a.startDamagePopup()
}, 300)
addedWait += 16
The code box for the VSBattlecore version of the thorns effect

Looking at the codebox here, you can see that I used a setTimeout to cause the popup on Reid to happen a bit later than the rest of the block effect. You can use this function to more accurately time events during the block effect. This is an advanced use-case though.

Menu Display:

Unfortunately, the default menu system in RMMZ does not contain any way for a player to see an actors xparameters, such as hit rate or block rate. As such, this plugin does not contain any changes to the default menus to make that information available to the player. 

If you are making your own menu system, or are making use of a system that can show custom information on screen, such as a hud, the following information will be of use to you in displaying relevant blocking statistics:

Actors, Enemies:

battler.blk will return the float value for block rate, in the same way that actor.hit will return hit rate. This is the sum of all block traits on the battler.

battler.getTotalBlockResistFloat() returns the total of all block percent on the battler. If a block will reduce all damage to zero it will show 0. If the battler cannot block, or doesn't have any block percent, this should return 1.

battler.getTotalBlockValue() returns the battlers total block value. This number is subtracted from an incoming hit after the block percentage is factored in. 

battler.getShieldPiercing() returns the total shield piercing value of this battler. This value is subtracted from the targets block rate when an attack is made.

battler.getBlockEffect() returns the name of the block effect that the battler is using. This will return whatever your default is set to, or whatever the battler has his set to, via items, states, class, actor, enemy tags, etc.

Equipment, States:

item.blockPercent is equal to 1 - the block percent granted by this item. An item that has a tag for 70% block percent will show a float of 0.3 here. Enemies also have this parameter, but it refers to their base block percent, not their total. The total block percent on a battler is determined by multiplying all of the block percent values from all of his equipped items or states.

item.blockValue is the block value granted by this item. These are all added together to determine a battlers total block value above.

item.shieldPierce is the amount of shield piercing this item provides. This value is given as an integer, so it's divided by 100 before it is applied in the block calculation. 

Note: This plugin has no easy way to tell you what the block rate granted by an individual state or item is. The default engine does not appear to have a way to calculate this without using an actual battler object.

VisuStella CoreEngine:

The version 1.07 update of the VisuStella Core Engine plugin allows for you to now define custom parameters to show on a wide variety of their custom menu scenes. Version 1.03 of Shield Block contains improved help documentation, and a few functions to facilitate showing block rate, shield piercing, block percent, and block value as custom parameters. 

These parameters show up on scenes like the shop, item and equip scenes, as well as the parameters window pictured below (if you include them on the columns for that plugin).

Here's a screenshot of how that might look:


Required Plugins:

This plugin is 100% standalone and works with the base RPGmaker MZ experience.

Terms of Use:

  • This plugin may be used in commercial or non-commercial projects. With credit to me, Ramza. 
  • Purchase of this plugin allows you to use it in as many projects as you want. 
  • You may modify this plugin directly, for personal use only. 
  • Sharing this plugin, direct edits to it, or any demo projects that come with it is prohibited. 
  •  You may share edits to this plugin as extensions to this one. Extensions require the base plugin to function.
  • You can choose to sell extensions to this plugin for profit, crowdfunding, donations, etc, as long as the extension requires this base plugin to function.  
  •  Do not modify the header of the plugin file, and do not claim ownership of the plugin in your own projects.

Purchase

Buy Now$12.99 USD or more

In order to download this MZ Plugin you must purchase it at or above the minimum price of $12.99 USD. You will get access to the following files:

Plugin Download 58 kB
Demo Project 98 MB

Development log

Comments

Log in with itch.io to leave a comment.

(1 edit)

How can I modify this so that my characters still take damage at normal and it doesn't negate damage? Intend it to be a flat damage reduction instead of a percentage that completely resists damage.

Good evening.

First of all, thanks for purchasing this plugin.

To answer your question: under the 'rules' heading in the plugin parameters, you will find 'Block Resistance' and 'Flat Block Value'. Block resistance is a number that the incoming damage is multiplied by when the defender blocks. By default, it is zero, meaning all damage from the incoming attack is blocked. Set this to 1 and all incoming damage will be left alone.

The second value is the flat amount removed from all successful blocks. It is also set to zero by default, but you'd want to change this, likely. You can also leave it at zero and set the <Block Value: X> note tag on your shields to make some shields block better than others.


~Ramza

Thanks!

(4 edits)

Hey Ramza,

Following the documentation and putting blkrt in custom parameters just shows nothing on status screens and throws an error in the equip scene: "user.getBlockRate is not a function."

Edit:  I didn't change anything other than the filename for the plugin back to the default naming and now it works.  Unsure if that would actually cause it, but seems to be working now so whogaf :D

Separately:  Is there any chance at getting this plugin to display the icon for whatever shield is equipped over the actor during battle either in place of, or in conjunction with the block animation?

Hello there.

Most plugins rely on the .js file having its original name in order to read the plugin parameters. Mine are also like this, so it would've failed loading very early in the load process, likely without throwing any crash errors, and simply would've acted as if the plugin wasn't installed at all. That means the error you were getting from the Visu plugin was correct, that function is not a function - because the plugin which defined it as a function was not loaded :)

For what it's worth, there is a way to make plugin parameters work when renaming the .js file, but it needs to be written in a specific way to allow that, and as it was simply the easier thing to do, I chose not to do that, like most people.

~Ramza

All good, lesson learned :D

On the other topic - would there be an easy way to display the icon used for whatever shield is equipped on top of battle actors when blocks occur?

There isn't currently an easy way to do that. I don't do enough work with sprites to know how to define and draw one like that, unfortunately. I used battle animations for that reason.

However, since every block effect is custom defined, you can modify the definition in the plugin parameters to do anything you want it to. So if you (or someone else) can figure out how to draw an icon at a specific battler's position on the battle scene, based on the iconId of the icon of the shield currently equipped, you can put that into the block effect and have it happen. I don't really have the slightest clue how easy or hard that would be, though, but it's a good place to start, or have someone else start for you.

~Ramza

Got it, thanks for the reply.

(2 edits)

The plugin doesn't work with MK_Core by Aerosys...

Greetings.

This error is happening because both of our plugins are using the constant 'params'. You can edit both of our plugins to use var instead of const and it should stop that from happening. If you swap the order the plugins are loaded in, you'll find his plugin probably throws the same error too.

In my plugin this line is line 627, I'm not sure about his.

~Ramza

Hi, I'm using a translator. Please understand if it reads weird. I tagged the actor <block chance: 100%> <block percent: 70%> and did the same to enemy. But enemy succeeds block and actor fails block. The same thing happens in the demo. Did I miss something?

Actors need something on them that enables block.

<Enables Block> needs to be on an actor, equipment, state, etc to enable to actor to block. Enemies don't have this requirement because they wouldn't normally have a block chance.

(+1)

It's working now! Thank you.

Maybe I am missing something but the motions are not working.

and that is with non chibi  battlers

The sample project has a couple of examples of this working. The default block effect causes the guard motion when the shield animation pops up.


The Parry one uses the attack motion, and specifically calls for it using the motionRequested variable in the codebox.

//makes a melee swing 
motionRequested = "attack" 
value = Ramza.SB.make_damage_value.call(this, target, critical) 
value = this.applyBlockDamageModifier(target, value)

Make sure that the motion request is in quotes as above, so the system knows it's a string.

~Ramza

No dice. Please check  the pics and video  i have here so you can see what I have going on, I  believe I have everything set  up as you stated it    . https://drive.google.com/drive/folders/1_qOA5zwblXDZCNxosQUdTQJ2nC9u6D_A?usp=sha...

If you haven't modified it, the Thorns VSBattleCore effect doesn't have a special battler motion associated with it, so it should use the guard motion. I tested myself in my test project (and found a bug associated with states, btw) and it does show the guard motion with the default battlers.

The picture of your golem battler is larger than a normal one, is it a dragonbones battler or something similar? The process for requesting a motion for one of those might use a different function than I use for a default battler. You might also need to add more wait time for the motion to have time to trigger? Does it work with any normal battlers for you?

The battler I am  using is a  regular sprite sheet (3 frames)

so what I  see, it works with  the playable characters, but not with enemies.....  I upped the SV frames from 12 to 30  for testing

and that is with the  test  project

(+1)

Alright, so the issue is actually that there is no provision in the plugin for animated enemies to request a motion at all, so they never do. I believe this was a compatibility concern, as attempting to call a motion on an ordinary battler would cause a crash. I'll have to look into how to enable this for animated enemies, that might take me a bit, but I'm on it.

I added another video to that folder for you to check out

Hi Ramza, just wondering, will the Parry Chance be ported over as well?

Hey there.

The plan is to port it over at some point, but I don't have a timeframe for when. I haven't even tested to see how much changing from the MV version needs to be done to make it work in MZ at this point. I expect it should be relatively easy to port, since it didn't inherently rely on any of the yanfly plugins like the old MV Block Chance plugin did.

Sorry I don't have a better answer for you right now, I have a lot of things on the go at the moment.

~Ramza

(1 edit)

Thanks! Just wanted to check.

Hi Ramza! First of all, amazing plugin! Just what i've been searching for the blocking mecanic!!

Unfortunately when used with the latest VisuStella BattleCore v.1.04 (and with v1.03) it keeps crashing on battle scene, just when the "Block" popup and animation should appear. I tested this updating only the Visus BattleCore in your blocking Demo project and it crashes too. 

Also regarding to show the block rate or pierce in other scenes, just like in the Status window with the VisuStella plugins, I don't know if those params can be made recognizable with the Visus CoreEngine->Extended parameters and Displayed parameters wich draws the Ex-params on other scenes like Equipment for example. I tried to put the 'BLK' or 'SHDPRC' on those just like in the  ElementStatusCore in my ignorance, and it draws the Ui rectangles but nothing shows. 

Hope it can be updated! But other than the VisuStella plugins compatibility,  without them the block feature works perfect (Also congratulations for the Dualwield plugin, purchased both!).

Greetings.

It is unfortunate that the block popup is now causing a crash in the latest version of BattleCore. TBH I had some trouble getting it to play nicely in version 1.0 as well. I had an issue where it would cause an infinite loop instead of perform the block popup. I managed to get around this, but it appears they changed something in a later version for which my fix no longer works. I will look into this once work cools down tonight and get back to you. I should have no issue fixing it on my own, but I might need to get the VS team involved in some sort of compatibility patch.

As for your other suggestion, I honestly had no idea that options to show exparams on other menus existed! I'll see what I can do about getting blk and shdprc added to that. I wonder if this was something that was added in an update.

Thanks,


-Ramza

(1 edit)

Hello again.

I got a chance to look into this just now, and I am baffled as to why it suddenly doesn't work anymore. I enlisted the aid of the VS team, as it's obvious something they changed with how damage popups display in the last couple of version is causing this problem, as it works without BattleCore, and it worked on at least v1.00, honestly I hadn't tested on anything later than that, and I can't seem to access any files between 1.00 and 1.04. 

I tried several things to find where the crash actually happens, or what my plugin specifically is doing to interfere with the popup in BattleCore, but everything points towards an issue in BattleCore itself causing this, as as you know, that plugin is obfuscated.

Yanfly advised that he made a change in an upcoming patch which will come on out Sunday, that may resolve this, or at least stop it from crashing entirely so I can troubleshoot it better. So I will leave it with him for and follow up when that update is out to make sure it's resolved.

As for your other suggestion about the showing of BLK and SHDPRC on the equip scene via the CoreEngine plugin parameters:

I managed to get BLK and SHDPRC to show up correctly on the default equip scene in ItemsEquipsCore, meaning when you have the 'use updated layout' parameter set to false, but it doesn't seem to show on the updated scene. Also, my change apparently causes a crash in the item scene when viewing any item at all, whether the updated scene option is used or not.  (This turned out to be an issue with updated plugins having blank parameters, whoops)

I will continue working on this and get back to you.

Hi again!

Thank you so much for the  quick response and troubleshooting, let's hope that the update from Yanfly and the VS team make this awesome blocking work together again!

Also regarding the BLK and SHDPRC showing on the equipment scene, thanks again for taking a look at it! It will be a great feature if can be shown, but like I said in my first post, VS plugins compatibility apart, your plugin works perfect! Making these updates if possible will made it more amazing :D

Hello again.

I just confirmed that the block popup no longer crashes the project if you update the BattleCore plugin to version 1.05. It now shows a '0' damage popup in addition to the block popup though, which isn't what it does on the default MZ engine, so I will be working on getting that back to working correctly again in the meantime.

Hello again Ramza!

Saw the update too, now is working all together again yay! Thank you so much!