ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
867
Reaction score
552
First Language
English
Primarily Uses
RMMV
Announcement:
This plugin, as well as my dual wield plugin have been moved over to my itch.io page as paid plugins from this point on. Anyone who was previously using these plugins can continue to do so, but no further updates will be posted tho this thread. The most up to date version will be available on my itch.io page at all times, and I'd recommend paying for the plugin to ensure you continue to get updates and bugfixes in the future.

This thread will remain here, as a place for users to discuss the plugin, and bring up any errors or problems they find with it, but download links to the plugin have been removed. If there is a ToS problem with this thread, I will do what I can to correct it.


Greetings. I come yet again with a new plugin. One that by itself doesn't do much, but allows other plugins to get a lot of use out of it.


TL;DR Shield block chance as an xparam download here. Free for commercial or non-commercial use with credit.


To explain what this plugin does, it's best to start from the beginning... As a few of you might know, I had/have a workshop topic where I often shared custom states that I'd made, for general use, to spice up other peoples game mechanics. The first state I released in the topic was a shield block state, where with a % chance, with a shield equipped, an actor could 'block' an incoming physical attack, displaying a quick little shield animation, and taking no damage. Right off, this was pretty basic, but quite in depth.


Perfection required me to set various shield types to have different block chances, it wouldn't make sense, after all, that a buckler and a tower shield would have the same chance to block, right? Well, with the state as it was, the only was to do this was to bloat the notebox up with if conditions. This was compounded when I later decided that shields should also look different, as each block now required a check to see which shield was equipped, and how much block chance that shield had. This became messy, and if I added any more shield later? More if conditions. And then it hit me. Why not store the block chance on the actor, as a parameter, and store the animation as values on the actual equipment. And thus, this plugin was born.

Updated to v2.21:

  • <SHIELD PIERCE: x> note tag added in v2.20 has been modified to allow a negative value. This will have the reverse effect in battle. A defender's block chance will be increased by x% when struck by an attacker that has a negative shield piercing value. If that defender couldn't normally block (he doesn't have a shield equipped/doesn't have the block state) this increased block chance has no effect.
Updated to v2.20:
  • Added the new note tag <SHIELD PIERCE: x> to weapons, enemies and states. When an incoming action is checked to see if a block has happened, the total shield pierce value of the attacker is subtracted from the total block chance value of the defender (to a minimum of 0%).
  • Added a function that will return the total shield pierce value of the actor that it is called from: Game_Actor.prototype.getPiercing()
  • Properly documented that YEP_BuffsStatesCore is a dependency for this plugin.
  • Revision a: The <BLOCK CHANCE: x> note tag has been modified to allow a negative value. <LOWER BLOCK CHANCE: x> is still functional, but has been effectively replaced.
  • Revision b: A crash error that happened when a target who has the block state is targeted by a skill that can be blocked has been corrected. This was introduced by the shield pierce effect, and was 100% reproducible.

Updated to v 2.17:
  • An issue was identified where devs using the YEP_ExtraParamFormula plugin together with this plugin were having block chance never properly be calculated. Despite an earlier patch rolled into the block plugin itself, which prevented the engine from outright crashing, an actor's block chance was simply being calculated as NaN, which would cause a block to never happen. This has been corrected, but in order for it to work, you need to be following the Yanfly recommended load order, specifically YEP_ExtraParamFormula needs to load before your battle plugins and before this plugin.
  • Revision a; fixed an issue where the parameters scene in the Status menu core would show NaN values for all exparams until the scene had been refreshed at least once (by switching actors).

Updated to v 2.16:
  • Aliased Game_ActionResult.prototype.clear() instead of overwriting it. This has no effect on the actual functionality of the plugin, but should make it more compatible with other plugins that also modify the ActionResult sequence.
Updated to v 2.15:
  • Equipment optimization will now take shield block chance into account when comparing shields, at a rate of 1% block chance == 1 param. As such, a shield with a higher chance to block will be equipped over another shield that is otherwise the same.
  • Added some backend compatibility changes to make this plugin more compatible with some of my other plugins.
Updated to v 2.11:
  • Added support for a new note tag on equipment, enemies and states, <Lower Block Chance: x>. Replacing x with a positive whole number will reduce the block chance of the battler with the state/item equipped by x percent.
Updated to v2.10
  • YEP_BattleEngineCore and YEP_BuffsStatesCore are now the only required plugin. Place this plugin directly below YEP_BattleEngineCore on your plugin manager.
  • Added new Note Tags for Armor and Enemies:
    • <Block Percent: x> Reduces incoming damage by x%. This is an integer value from 0-100.
    • <Block Value: x> Reduces incoming damage by x when an attack is successfully blocked. This value is removed from the remaining incoming damage after Block Percent is processed.
  • Added new plugin parameters:
    • Hide Damage Popup
      • The plugin will hide a damage popup that was successfully blocked and dealt zero damage
    • Flat Block Value
      • The default flat block value for all enemies and shields
    • Block Percent
      • The default block percentage for all enemies and shields
    • Partial Block Effect
      • When this is true, an attack that was blocked, but still dealt some damage will apply any effects it would've applied as if the attack had been successful.
  • Updated the block state paste code to use the blockPercent and blockValue values.

Updated to v2.00
  • Block success now happens as an action.result(). This means that react effects (or action sequences) can check if the result of their action was a block. This will return true under the following conditions:
    • The incoming skill is blockable (as set in the plugin parameters, all physical skills are blockable)
    • The defender is affected by the block state, allowing them to block (the default is 36)
    • A random percentile check is equal to or less than the target's .blk parameter (which comes from equipment, or states)
  • Successfully blocking an attack no longer causes that attack to apply states or debuffs/buffs that it would've applied on a successful hit.
  • Successfully blocking an incoming attack no longer removes states on the defender that would've been removed by a successful attack (ex: confusion)
  • Blocking an attack no longer shows a damage popup for zero damage
  • Added plugin param to set the id of your block state
    • Make sure that you set this, as if a target has block chance, but no block state applied, the action result will say a block happened, even when the user doesn't have a shield, if the block chance check succeeds.
  • Updated the exParam to be a value from 0-1 instead of 0-100. Note tags remain unchanged.
  • Yep_BattleEngineCore and YEP_BuffsStatesCore are now required dependencies
  • I have updated the YEP_StatusMenuCore edit I made for use with this plugin.
  • New block state paste below to make use of the action.result() change.

Updated to v1.1
  • Added a plugin parameter to set all physical skills as either blockable or unblockable by default
  • Added new note tags for skills only <BLOCKABLE>, <UNBLOCKABLE> which override the plugin parameter on a skill-by-skill basis, allowing non-physical skills to be blocked.
  • Added compatibility with the <BLOCK CHANCE: X>, <BLOCK ANIMATION: X>, and <SLAM ANIMATION: X> note tags so that they could be used on enemies. The default block/slam animations will play if these are not set on the enemy note box.
  • Modified the block state paste in the help file, and below to support monsters blocking, as well as the blockable/unblockable note tags.

Updated to v1.02:
  • Fixed compatibility with YEP_ExtraParamFormula, which was causing the block exParam to return a NaN value.

Updated to v1.01 to fix an engine crash on (possibly?) newest version of rpg maker. Links updated.


What it does:
This plugin gives you access to three notetags. The first can be on armor, enemy, or on a state (for easy increasing of player block values)
<BLOCK CHANCE: X>
Gives the actor a block chance of X% (do not put the % in the note tag). These values are additive, meaning if you have a state that adds 10% and a shield that adds 15% you have 25% total.
The other note tags are for armor and enemies only:
<BLOCK ANIMATION: X>
<SLAM ANIMATION: X>

The first tells the engine what animation to play on your actor when he successfully blocks. This is handled by our shield block state, which I will post below.

Slam animation is only used in an action sequence in which your character strikes with a shield. This is the animation that plays on your actor when they do that. For reference, this can be pulled from the actors equipment by doing an eval to user.equips()[1].slamAnimation which will give the animation Id you specified in the notetag.

Version 1.10 of the plugin also adds the following note tags for use on skills only:
<BLOCKABLE>
<UNBLOCKABLE>
These note tags can be used to denote a skill that can or cannot be blocked.

The State:
Add the following note tags to a passive state, and have that state on any shield that can be blocked with, and your actor will be capable of blocking.

May 9, 2017:
This state copy paste is useful only for version 2.00 (or higher) of the plugin.

Code:
<Custom React Effect>
var blockValue = (target.isEnemy() ? target.enemy().blockValue : target.equips()[1].blockValue)
var blockPercent = (target.isEnemy() ? target.enemy().blockPercent : target.equips()[1].blockPercent)
if (target.result().isBlocked()) {
    value -= Math.round(value * (blockPercent/100));
    value -= blockValue
    value = Math.max(value, 0)
    var blockAnim = (target.isEnemy() ? target.enemy().blockAnimation : target.equips()[1].blockAnimation)
      target.startAnimation(blockAnim, true, 0);
      target.requestMotion('guard')
}
</Custom React Effect>
<Custom Deselect Effect>
setTimeout(function () {
 target.requestMotion('walk')
}, 180);
</Custom Deselect Effect>


Additional notes:


The more java-savvy of you guys might be able to figure out ways to bring this into other plugins. For those of you who aren't as good, I have modified Yanfly's StatusMenuCore plugin to allow block chance to be a value on the status menu's parameters screen. In your plugin settings, simply set one of the parameters to 'blk'. You can pick that up here.


That's all for now, and if you're following my state workshop topic, I promise I'll be around soon. Thanks for holding out.


Edit:


I'm feeling pretty good about this shield slam thing, so I made an action sequence you can use to make your own shield slam-like skill. Here's what it looks like in action.


Code:
<Setup Action>
display action
move user: target, front base, 20
wait for move
immortal: target, true
</Setup Action>
<Target Action>
wait: 15
motion spell: user
if (user.isActor())
  eval: user.startAnimation(user.equips()[1].slamAnimation, true)
end
if (user.isEnemy())
  eval: user.startAnimation(user.enemy().slamAnimation, true)
end
action effect: target
if target.result().isHit()
 se: hammer, 90, 100, 0
 action animation: target
 wait for animation
end
wait: 20
</Target Action>
<Finish Action>
clear battle log
perform finish
wait: 10
immortal: target, false
</Finish Action>


Enjoy.

Things you may do with this plugin:
  • Use it in your commercial or non-commercial project, with credit
  • Edit the state paste-code to better fit your project
  • Edit the plugin in any way necessary for your own use
  • Create and share add-ons to this plugin via your own plugin
You may not share direct edits to this plugin unless previously discussed with me
 
Last edited:

Lionheart_84

Veteran
Veteran
Joined
Oct 27, 2015
Messages
538
Reaction score
49
First Language
Italian
Primarily Uses
I can give you a tip ??? why not make sure that when a hit is blocked for a moment above the pg show the graphics of the equipped shield ???


Like Tankentai for Rpg maker vx ace???... you know ???
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
867
Reaction score
552
First Language
English
Primarily Uses
RMMV
This is how the state I posted works, you just have to make an animation for your shield yourself. I figured this was better than pulling an icon and showing that, as the default RMMV icons don't match the style of an actual worn shield.


See for yourself.
 

Lionheart_84

Veteran
Veteran
Joined
Oct 27, 2015
Messages
538
Reaction score
49
First Language
Italian
Primarily Uses
I see ... so it's a unique graphic for each type of shield ???
 

Rayhaku808

Chubbizard
Veteran
Joined
May 8, 2012
Messages
245
Reaction score
106
First Language
English
Primarily Uses
RMMV
This feels good to have with your TGR plugin!
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
867
Reaction score
552
First Language
English
Primarily Uses
RMMV

I'm not sure what happened there either. When did this error come up? It looks like it happened during boot, which is weird because I don't think this plugin does anything during boot. I'm not too sure if it matters, but I tested the plugin with yanfly's plugins (most of them anyway) and always loaded it at the end, so maybe that has something to do with it.

I see ... so it's a unique graphic for each type of shield ???

Yeah. The plugin parameters let you set a default animation for all shields, but you can use the <block animation: x> tag to make the block animation unique to each shield. The ones I used for the slam and block animations above were just a few frames of an RMVX shield icon moving around a bit. It could look better, but not bad for a few minutes work eh?
 

icomefordl

Villager
Member
Joined
Jan 20, 2013
Messages
5
Reaction score
0
Primarily Uses
I'm not sure what happened there either. When did this error come up? It looks like it happened during boot, which is weird because I don't think this plugin does anything during boot. I'm not too sure if it matters, but I tested the plugin with yanfly's plugins (most of them anyway) and always loaded it at the end, so maybe that has something to do with it.

it show up when i start the game


hope that you can release a demo i can load it for test, sorry about that . ;_;
 

Lionheart_84

Veteran
Veteran
Joined
Oct 27, 2015
Messages
538
Reaction score
49
First Language
Italian
Primarily Uses
Yeah. The plugin parameters let you set a default animation for all shields, but you can use the <block animation: x> tag to make the block animation unique to each shield. The ones I used for the slam and block animations above were just a few frames of an RMVX shield icon moving around a bit. It could look better, but not bad for a few minutes work eh?



Indeed, you have been very good !!! I liked very much is the animation with the attack with the shield !!! good idea!!!  ;)


Only one thing

<Custom React Effect> if (value > 0 && this.isHpEffect() && this.isPhysical()) { var rnd = (Math.floor(Math.random() * 99 + 1)) var shd = target.blk if (rnd < shd){ value -= value; target.startAnimation(target.equips()[1].blockAnimation, true, 0); } } </Custom React Effect>



Where should I paste it ??? :unsure:
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
867
Reaction score
552
First Language
English
Primarily Uses
RMMV
You're going to need a couple of yanfly's plugins to fully make use of that. Buffs & States Core to be more specific. But also Auto Passive states will help you out a lot here as well.


You're going to make a state, which you will passively put on your shield items using the <Passive State: x> tag on the individual items, and then the paste code I gave in the OP will go on that state. It should look something like this:


blockchance.PNG


Of course, my personal code is slightly different than what I have in this thread, but you should get the idea.


Lunatic mode tags are special tags in the YEP plugins that allow experienced scripters to make all kinds of things happen. In this case, I'd stick to what I posted in here, but always know you can add or remove features on your own using these tags too.
 

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
Funny how sometimes, you need a specific feature, and someone did that only a few days prior !
I couldn't get it to work though. No errors, either, so i guess thats somthing !

I made the shield, added


<BLOCK CHANCE: 100>


<Passive State: 29>


To it (29 is my block stat with your piece of code.


Got into a fight.


Did not block 100%.


Died.


I'm sure i missed something though.


Potential idea : Adding a way for a parameter to add value to the block chance ; Exemple : My warrior has a stronger arm, or better reflexes, and adds +1% of his Agility


to block rate of any shields.


The wizard however... well, not so strong armed : Maybe he gets a malus.


I can code the formulas i would need, but i cant include them into your work ^^


Idea n° 2 : How about Parrying as a retooled block : A parrying dagger adding a small block value, and eventually a different animation


(Oooooooor.....I could just make a shield called parying dagger)
 

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
@icomefordl You need yanfly states and core and then some, setup action comes from action sequence i think, so you need that too, and probably battle core.


Reread the help section of the plugin.
 
Last edited by a moderator:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
867
Reaction score
552
First Language
English
Primarily Uses
RMMV
Okay, so I had to fix a scripting error that was apparently causing the plugin to cause the game to crash in the boot phase for some reason. It wasn't happening in my own project, but a brand new project with the latest version of RMMV caused the issue. I haven't seen this cause any problems yet, and have confirmed in the brand new project, that when set up correctly, blocking will work.


You can get that update here.


Also, since someone was looking for it, I have created a small demo project, which contains a couple of the yanfly plugins, a block state, a block and slam animation that uses an RMVX icon (which you can't legally use in a commercial game unless you also own VX), and the mangled modified statusmenu core plugin with the settings already set to show block chance on the menu. You can get that here.

only two script i am using .


View attachment 53496



You're going to need some other plugins to make use of this plugin. For now, with just the block plugin enabled, you can see that it's doing all it does by opening the console in-game and typing $dataArmors[x].blockAnimation which should return the ID you put in the note tag of the armor item Id X. Alternatively, you can type in $gameParty.members()[0].blk which will return the block chance of the actor in slot 1 of your party (or give an undefined message if the plugin isn't loaded).

Funny how sometimes, you need a specific feature, and someone did that only a few days prior !
I couldn't get it to work though. No errors, either, so i guess thats somthing !

I made the shield, added


<BLOCK CHANCE: 100>


<Passive State: 29>


To it (29 is my block stat with your piece of code.


Got into a fight.


Did not block 100%.


Died.


I'm sure i missed something though.


Potential idea : Adding a way for a parameter to add value to the block chance ; Exemple : My warrior has a stronger arm, or better reflexes, and adds +1% of his Agility


to block rate of any shields.


The wizard however... well, not so strong armed : Maybe he gets a malus.


I can code the formulas i would need, but i cant include them into your work ^^


Idea n° 2 : How about Parrying as a retooled block : A parrying dagger adding a small block value, and eventually a different animation


(Oooooooor.....I could just make a shield called parying dagger)


I'm not sure if it's a configuration issue or a compatibility issue with something else you have, but try copy+pasting out of my demo in this post and see if it works for you then.


I want to say it could be possible in the future for me to add the functionality of allowing other params to affect block chance, but as of right now, it puts the block values on the shields and states when the game first opens, and wouldn't be able to update a live value (ie: your ever changing strength score), so it wouldn't work at present.


You can probably set up some extra passive states that add to your block chance, and require a certain level of ATK to become active, as a workaround, I mean.


The parry thing is a good idea, and I also considered it myself, but I haven't figured out how to animate a battler from the state react effect, yet. It'd look weird showing the dagger but him just standing there. Maybe in the future,


Second Edit:


I will be adding this to the OP as well, but thanks to the folks in the JS Learning forum, I have figured out how to cause battlers to change motions when a block occurs.


In the default battle system, this looks just awesome. In the CTB system it doesn't quite look as good, but it gets the job done.


Here is the new state note tag to put on your block command:


<Custom React Effect>
if (value > 0 && this.isHpEffect() && this.isPhysical()) {
var rnd = (Math.floor(Math.random() * 99 + 1))
var shd = target.blk
if (rnd < shd){
value -= value;
target.startAnimation(target.equips()[1].blockAnimation, true, 0);
target.requestMotion('guard')
}
}
</Custom React Effect>
<Custom Deselect Effect>
setTimeout(function () {
target.requestMotion('walk')
}, 180);
</Custom Deselect Effect>


Here's how it looks in the Default system:


blockoriginal.gif



And here it is in the CTB (looks weird because they don't stand in their ready pose before getting hit I think):


blockCTB.gif
 
Last edited:

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
Copy pasted demo, didnt wokr in my project.


Most likely a compatibility issue
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
867
Reaction score
552
First Language
English
Primarily Uses
RMMV
Copy pasted demo, didnt wokr in my project.


Most likely a compatibility issue

I don't doubt that it is, but I don't think there'd be many plugins that would directly interfere with the blocking process.


If you open the console and type in $gameParty.members()[0].blk does it give you a value? Hopefully it should be the value of the block chance on the actor in slot 0's shield. If it doesn't work, something may be overwriting the Object.defineProperties(Game_BattlerBase.prototype function that I overwrote in this plugin. Any other plugins you have that add custom parameters might be using this function too, so try loading my plugin before them.


Alternatively, it could be that the attack you are testing block against simply isn't a physical attack. I've accidentally had my share of 'certain' hits messing me up when trying to test blocking before. XD
 
Last edited by a moderator:

icomefordl

Villager
Member
Joined
Jan 20, 2013
Messages
5
Reaction score
0
Primarily Uses
thank you so much Ramza, I can load yr demo and work fine ! 


it is a nice script , gdjob  :rock-left:
 

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
Tested for actor 0 and 1 (since i dont have an actor 0 ^^)


Actor 0 returns "undefined"


Actor 1 returns Uncaught TypeError: Cannot read property 'blk' of undefined


Tried it at the top of all those plugins, same thing (which is fairly odd and means it's probably on my end)

Sans titre-1 copie.png

Sans titre-1.png
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
867
Reaction score
552
First Language
English
Primarily Uses
RMMV
Hmm... The only YEP Plugins in your list I'm not sure of compatibility with are the parameter control ones. The rest of them I'm using in my own project. If you're going to end up turning off plugins to see which one is causing the problem, I'd start with those ones. Let me know if you figure it out, I might be able to scrape together a compatibility patch or something.
 

Nol

Veteran
Veteran
Joined
Oct 22, 2016
Messages
91
Reaction score
6
First Language
english
Primarily Uses
I tried to set it up in my base project, but deactivating plugins sent everything to hell : /


Started a debug project, got the boot error, used your fix, couldn't make it work with, or without the extra parameter


Will try adding it to your base blk project


Tested with extra parameter in your BLK project, works without, doesnt work anymore with it
 
Last edited by a moderator:

Latest Threads

Latest Profile Posts

anyone else 'round here gonna be doing the retro game jam that's starting in a few days on itch.io?
I also wanted to say that my bro brought back nostalgia and got me a GBA SP for my birthday! Ah, the memories of Pokémon Sapphire and LeafGreen! It came in a gray shell but he ordered a red one so it'd look like the one I had as a kid. It looks brand new!
qhE9zC8.jpg
LsluASM.jpg
It's minus 50 out today, ugh. I'm so freaking cold. =_=;
0YJJJiG.gif
kkSYWES.gif
0YJJJiG.gif

Working on some fan assets! I won't share them all just yet, but it's a fun practice! (So maybe keep an eye out for a thread for them in the future?) :kaohi: These boyos are Pink Slimes and a Tabby Slime from Slime Rancher.​

Forum statistics

Threads
108,930
Messages
1,040,723
Members
141,395
Latest member
MitchMann12
Top