clitvin

Veteran
Veteran
Joined
Oct 26, 2015
Messages
108
Reaction score
15
Primarily Uses
Hi Ramza, I have 2 requests.

1: Would be nice if the block amount was not 100% but adjustable per item or per actor.
2: Is a bit more complex but would it be possible to make skills, for instance shield slam only activate after a successful block, and then disable after being used?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
874
Reaction score
557
First Language
English
Primarily Uses
RMMV
Regarding your first suggestion, I can definitely make a <block amount: x> tag that can be used on shields, and incorporate that into the plugin.

Your second request is actually 100% doable right now. Because the block still relies on an actual state on the blocking target, you can add a new state to the target in the block state, when they block. Using YEP_SkillCore, you can set a custom requirement on your shield slam skill that requires that state.

Block Success -> add 'blocked' state -> activate shield slam for one turn

I can post some actual code to do that ina bit, if you'd like.
 

HasdrubalBarca

Veteran
Veteran
Joined
Feb 4, 2015
Messages
162
Reaction score
56
First Language
English
Primarily Uses
Hey Ramza, I have a very minor suggestion.

Maybe you could add the ability to add a higher block chance based on the skill type? Like say you have a perk which adds a 15% chance to the current block chance if attacked by a projectile.
 
Last edited:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
874
Reaction score
557
First Language
English
Primarily Uses
RMMV
Hey Ramza, I have a very minor suggestion.

Maybe you could add the ability to add a higher block chance based on the skill type? Like say you have a perk which adds a 15% chance to the current block chance if attacked by a projectile.
I think that's already doable with the current system as well, tbh.
Using a <Custom Select Effect> on the block state, you can detect the stype of the incoming attack, and add a state to the defender. The state you add can increase block chance, like any other state, with the <block chance: x> tag. It might look something like this:

Code:
<Custom Select Effect>
if (target.isStateAffected(38) && this.item().stypeId == 4){
 //if target has improved missile block (passive) and incoming attack belongs to skill type 4
 target.addState(39)
 //add state 39 improved missile block (active) to defender
}
</Custom Select Effect>
<Custom React Effect>
if (target.result().isBlocked()) {
 value -= value;
 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>
target.removeState(39)
//remove the improved missile block (active) effect
setTimeout(function () {
 target.requestMotion('walk')
}, 180);
</Custom Deselect Effect>

For this example, state id 38 is a passive state that doesn't actually do anything, but should be positioned to the player as if it increases block chance versus skill type 4 (which we're calling missile type). state id 39 is the actual active effect from this passive state, which will have a simple <Block Chance: 15> tag in it's note box. Set it to be removed after battle, but since in the deselect effect it's removed, it shouldn't be an issue.

The select effect tags should run before the action result is determined, so the change to the target's block chance should be taken into account before the attack is successful.

@clitvin Here is what your modified state would look like:
Code:
<Custom React Effect>
if (target.result().isBlocked()) {
 value -= value;
 target.addState(40)
//add state 40 to the defending target on successful block
 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>
We're using state Id 40 as the 'just blocked' state. Set it to expire after one action (or turn, whatever), and have your shield slam skill have the following note tag on it:
Code:
<Custom Requirement>
value = user.isStateAffected(40)
</Custom Requirement>
This tag will disable the skill if the user doesn't have the state, which means it will only be enabled immediately following a block.
 

HasdrubalBarca

Veteran
Veteran
Joined
Feb 4, 2015
Messages
162
Reaction score
56
First Language
English
Primarily Uses
Just tried it and it works fine. You rock, man!
 

clitvin

Veteran
Veteran
Joined
Oct 26, 2015
Messages
108
Reaction score
15
Primarily Uses
Fyi, the latest version breaks compatibility with yanfly row formation if it's below it in the plugin list. For some reason <Pull Forward User Row: 1> and other tags that move the user in battle do not work when this plugin is enabled.

It seems to work when it's between damage core and element core in priority. If there is a specific place that it should be installed to maximize compatibility you should mention it in the installation instructions.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
874
Reaction score
557
First Language
English
Primarily Uses
RMMV
I was unaware of that, and I think I know the reason for the incompatibility. I'm not sure when I will be able to fix it though. I'll get back to you.

I have just updated the plugin to v2.10:
Changelog:
  • Added the ability for a shield to block both a % of incoming damage (default is 100%) and a flat value (default is zero) via new note tags on armor (and enemies).
  • New plugin parameter to enable/disable damage popups on a successful block that also dealt zero damage
  • Updated compatibility with YEP Plugins. Place this plugin directly below YEP_BattleEngineCore, and above all other battle engine plugins from Yanfly. Make sure that all YEP plugins are in the correct order according to yanfly.moe
  • Added a plugin parameter to enable/disable 'partial damage' blocks adding their added effects as if a hit was completely successful (EX: poisoned bite being partially blocked will still have the same chance to poison as if it had been a normal hit).
  • Updated state paste code to use the new blockPercent and blockValue parameters.
 
Last edited:

HasdrubalBarca

Veteran
Veteran
Joined
Feb 4, 2015
Messages
162
Reaction score
56
First Language
English
Primarily Uses
I think I found a bug.
I was testing out some skills and noticed that one state didn't reduce the blocking chance for an enemy. I set the block chance on the state but it didn't effect the blocking chance of the enemy. So for another test I had an enemy with a 90% block chance and I had another state that had the tag <BLOCK CHANCE: -90> to test it out. So hitting the enemy with the state didn't seem to do anything. He could still block almost all physical attacks despite having a state that takes away all his block chance.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
874
Reaction score
557
First Language
English
Primarily Uses
RMMV
@HasdrubalBarca Thanks for the report.

The truth is, I never considered a negative block chance value at all, and the plugin wasn't designed to take a negative value in that way. Until I read this post, I didn't even consider that there would be a need for negative block chances.

I have updated the plugin to v2.11 to resolve this issue. For a state (or equipment) that bestows a negative block chance, you can now use the tag <Lower Block Chance: x>. As block chance is an exParam, if an actor has a negative total, it will show up on the menu as a negative value, not 0%.

I have attached the updated plugin to this post. The link in the first post has also been updated to the new version.
 
Last edited:

HasdrubalBarca

Veteran
Veteran
Joined
Feb 4, 2015
Messages
162
Reaction score
56
First Language
English
Primarily Uses
Oh man, I didn't realize that :kaoswt2: But man, thanks for the update. Really appreciate it.
 

Tatsumaro

Veteran
Veteran
Joined
Aug 11, 2016
Messages
205
Reaction score
40
First Language
Portugues
Primarily Uses
RMMV
Hi after reading all the notes and explanations i´m rely confuse :D.
  • i don´t need to and a passive state in the notes of the shield.
  • but i need to update the state notes
  • then add <Block Percent: 5> in the note off the shield
But now:
  • the statistics don´t reflect the Block Percent in StatusMenuCore
  • and the SRD_EquipCompareUpgrade value in the equip menu for the actor.blk are now missing
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
874
Reaction score
557
First Language
English
Primarily Uses
RMMV
Hi after reading all the notes and explanations i´m rely confuse :D.
  • i don´t need to and a passive state in the notes of the shield.
  • but i need to update the state notes
  • then add <Block Percent: 5> in the note off the shield
But now:
  • the statistics don´t reflect the Block Percent in StatusMenuCore
  • and the SRD_EquipCompareUpgrade value in the equip menu for the actor.blk are now missing
I'm not really sure what the problem is here?
The plugin parameters require you to have a passive state set up for blocking, that contains the paste code in the OP of this topic, or from the help documentation on the plugin itself. The default ID for the state is listed as 36, but change that value to whatever your state is. This passive state doesn't necessarily need to be on your shields, but it works best if it is, as any hit that is tested for blocking will fail to be a block unless the target has the state on them.

The <Block Percent: 5> note tag will make it so that a successful block reduces the damage of the incoming attack by 5%. Without a block state, this has no effect on blocking at all.
The block percent isn't shown in StatusMenu core because block percent isn't block chance. Block chance is set with the note tag <Block Chance: x>, and effects how often the actor blocks.
I'm not familiar with this other plugin, but if it worked before, the reason it doesn't now is because you effectively don't have any block chance on your shield to begin with.

Here's a list of all equipment/state note tags:
  • <Block Chance: x>
    • The chance this item or state has to cause a block
  • <Lower Block Chance: x>
    • Reduces block chance on the item or state by x%
  • <Block Percent: x>
    • Reduces the incoming damage of a blocked attack by x%. The default value of this is 100%, so that a successful block will reduce ALL damage from an attack
  • <Block Value: x>
    • Reduces the incoming damage from a blocked attack by x. This is calculated after the block percent value is removed from the incoming damage. Use this in combination with the above tag to reduce incoming damage by x% + y
It appears that in your case, you need a <Block Chance: x> note tag on your shield, or state. You also still require the block state, which for simplicity sake, should be a passive on an equipped shield (or on whatever other equipment you're using to block). Also worth noting, enemies that can block also need to have the block state on them as well, and since they don't wear equipment, you'll need to apply it to them manually.
 
Last edited:

Tatsumaro

Veteran
Veteran
Joined
Aug 11, 2016
Messages
205
Reaction score
40
First Language
Portugues
Primarily Uses
RMMV
I'm not really sure what the problem is here?
The plugin parameters require you to have a passive state set up for blocking, that contains the paste code in the OP of this topic, or from the help documentation on the plugin itself. The default ID for the state is listed as 36, but change that value to whatever your state is. This passive state doesn't necessarily need to be on your shields, but it works best if it is, as any hit that is tested for blocking will fail to be a block unless the target has the state on them.

The <Block Percent: 5> note tag will make it so that a successful block reduces the damage of the incoming attack by 5%. Without a block state, this has no effect on blocking at all.
The block percent isn't shown in StatusMenu core because block percent isn't block chance. Block chance is set with the note tag <Block Chance: x>, and effects how often the actor blocks.
I'm not familiar with this other plugin, but if it worked before, the reason it doesn't now is because you effectively don't have any block chance on your shield to begin with.

Here's a list of all equipment/state note tags:
  • <Block Chance: x>
    • The chance this item or state has to cause a block
  • <Reduce Block Chance: x>
    • Reduces block chance on the item or state by x%
  • <Block Percent: x>
    • Reduces the incoming damage of a blocked attack by x%. The default value of this is 100%, so that a successful block will reduce ALL damage from an attack
  • <Block Value: x>
    • Reduces the incoming damage from a blocked attack by x. This is calculated after the block percent value is removed from the incoming damage. Use this in combination with the above tag to reduce incoming damage by x% + y
It appears that in your case, you need a <Block Chance: x> note tag on your shield, or state. You also still require the block state, which for simplicity sake, should be a passive on an equipped shield (or on whatever other equipment you're using to block). Also worth noting, enemies that can block also need to have the block state on them as well, and since they don't wear equipment, you'll need to apply it to them manually.
Im rely sorry it must have bean the lat hours what a simple nooby mistake. Sorry for bothering you, and thanks
 

HasdrubalBarca

Veteran
Veteran
Joined
Feb 4, 2015
Messages
162
Reaction score
56
First Language
English
Primarily Uses
Hmm. I don't know if I did anything wrong but the Reduce Block Chance tag isn't working anymore.
I could've swore it was fine before but now I'm stumped because it's no doing anything anymore. I had an attack that gave a state which reduced it and it's not doing anything. Even tried it on a new project.

Here's a small demo if you want to check it out:
link removed by moderator at request of content creator
Maybe I made an oversight.
 
Last edited by a moderator:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
874
Reaction score
557
First Language
English
Primarily Uses
RMMV
Your demo is still using v2.10, which doesn't have the <reduce block chance: x> tag support. Update to v2.11 and it should work.

Scratch that, apparently I didn't change the version number at the top of the plugin info, so at a quick glance I saw it still said v2.10 and made an assumption.

I looked at the test demo briefly before I left for work this morning, and I don't see anything wrong with it, but I can confirm that the tag doesn't seem to be working. Like you, I know it was definitely working before, in my own project, I had a shield with <Reduce Block Chance: 1> on it, and was able to see it reduce the exParam value to -1%, and to 9% with a state that buffed block chance by 10% applied after the fact.

I'll dig into it a bit more later today, and get back to you.
 
Last edited:

Farr

Veteran
Veteran
Joined
Feb 16, 2014
Messages
247
Reaction score
93
First Language
Portuguese
So I'm trying to create an passive state similar to Yanfly's Weapon Mastery
but I can't recreate the process.

My idea is that once the mastery is learned and you have a shield equipped, your block chance/dmg reduction increases by a X amount.
The code to Yanfly`s Weapon Mastery goes like this;

<Custom Passive Condition>
// Get all currently equipped weapons for the user.
var weapons = user.weapons();
// Set the swords variable.
var swords = 2;
// Set the initial condition to be false.
condition = false;
// Loop through each of the weapons.
for (var i = 0; i < weapons.length; ++i) {
// Get the currently looped weapon.
var weapon = weapons;
// Check if the weapon exists and if the weapon type ID matches the sword ID.
if (weapon && weapon.wtypeId === swords) {
// Set the condition to be true.
condition = true;
// Break the loop.
break;
}
}
</Custom Passive Condition>

Could you give me a hand here?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
874
Reaction score
557
First Language
English
Primarily Uses
RMMV
Well, I sure feel dumb, despite documenting it as <Reduce Block Chance: x> the actual note tag was <Lower Block Chance: x>, so uhh, change that and it should work again. XD

@Farr I don't think block amount can be increased in this way, I only made block value and block percent viable on armor or enemies, as the block state only checks the equipped shield or the target for those variables at present.

You can definitely use a custom passive condition to increase block chance when a shield is equipped.

Code:
<Custom Passive Condition>
var offhand = user.equips()[1];
if (offhand != null && offhand.atypeId != undefined){
 condition = true;
}else{
 condition = false;
}
</Custom Passive Condition>
That should work to only make it active if the offhand is holding an armor (which can probably be assumed to be a shield) As is, I'll need to come up with a way to make states capable of increase block value and block percent for the rest of your request to work.

Edit: attached v2.11a with updated documentation to include the correct note tag for <Lower Block Chance: x> and also edited all posts in this topic that contained the previous incorrect tag.

Second edit:
@Farr , thinking about it further, you can modify the actual block state to increase the blockValue and/or blockPercent values it gets from the equipped armor/enemy based on whether the above passive condition is active or not.

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 + (target.isStateAffected(x) * 10))/100));
    value -= (blockValue + (target.isStateAffected(x) * 100))
    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>

The above would add 100 blockValue and an extra 10% blockPercent if the target was affected by state x.
 
Last edited:

Farr

Veteran
Veteran
Joined
Feb 16, 2014
Messages
247
Reaction score
93
First Language
Portuguese
@ramza

Whoa thanks, but I get a syntax error;

SyntaxError: Unexpected token } {stack: (...), message: "Unexpected token }"}
YEP_SkillLearnSystem.js:1900 PASSIVE STATE CUSTOM CONDITION ERROR
YEP_SkillLearnSystem.js:1901 var offhand = user.equips()[1];
if (offhand != null && offhand.atype != undefined)
condition = true;
}else{
condition = false;
}

Edit: Fixed the { } problem, im dumb, but the passive states doesnt seem to trigger.


I guess that`s all that I`m looking for, hopefully it will help other people in need.
Thanks a lot dude.
 
Last edited:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
874
Reaction score
557
First Language
English
Primarily Uses
RMMV
Both of those problems were my bad. I edited the state above to fix them. (I was missing a { and the if check should've been looking for atypeId, not atype)
 

Latest Threads

Latest Posts

Latest Profile Posts

I just lost an hour plus of time to trying to modify the _battlefield sprite... when in reality MZ calls it _battleField ;_;

Even when debugging for the "undefined value", it looked exactly the same to my 20/60 eyesight.

I really prefer this_naming_convention rather than thisNamingConvention !!
hmm... I just solved one of the more annoying sideview battler problems in MV.. Passive States and Visual States can make it so when your character is in crisis HP, they don't go back to normal walk/wait when it's their turn. they stay in the crisis motion... neat.
Apparently all of LGBT reddit hates me. I posted a simple question and only got hate mail. What's the deal? The doompost was literally 6 months ago and I've changed my views since then and apologized.
MOD NOTE: See second response before replying to this. - Wavelength
Amazing. Simply amazing...

JRPG Browser - Playlist:

Forum statistics

Threads
109,105
Messages
1,042,109
Members
141,592
Latest member
JegueAvapor
Top