Good morning,
I need help making two plugins compatible with each other.
I'm reaching the end of the combat part of my project, and I realize that there are some slight bugs due to the various origins of certain plugins. Most come from yanfly but not all.
You will probably need to master javascript to resolve this problem.
Here are the two incompatible effects (I give the codes and sources at the end):
1)
I created a state which allows an actor to protect another actor by absorbing part of the damage suffered in the form of reduced MP loss.
For example, actor A places the state on actor B. If B takes 1000 damage, then he will take 800 damage instead, but A will lose 20 MP.
2)
I also created a parry system using another plugin. It works pretty much like dodging. A parried attack will not inflict any damage. There's not much else to say.
My problem :
When a character parries an attack while he has the state that I described in 1), he does not suffer any damage but he transfers 20% of the damage to the other actor in loss of MP. Which is not supposed to happen.
Here are the codes:
Damage transfer (the annotations are not necessarily accurate because there has been some modification to the base code, but everything works):
The parry:
The sources :
forums.rpgmakerweb.com
The solution I would like if possible:
I don't know if it is possible to solve my problem, but can we consider an if/else condition in the damage transfer code?
I have another damage transfer state in my game, this will allow me to solve all my problems at once. I would really like to keep my parry system.
Thanks to those who will help me.
(translation by google, please ask me to rephrase if necessary)
I need help making two plugins compatible with each other.
I'm reaching the end of the combat part of my project, and I realize that there are some slight bugs due to the various origins of certain plugins. Most come from yanfly but not all.
You will probably need to master javascript to resolve this problem.
Here are the two incompatible effects (I give the codes and sources at the end):
1)
I created a state which allows an actor to protect another actor by absorbing part of the damage suffered in the form of reduced MP loss.
For example, actor A places the state on actor B. If B takes 1000 damage, then he will take 800 damage instead, but A will lose 20 MP.
2)
I also created a parry system using another plugin. It works pretty much like dodging. A parried attack will not inflict any damage. There's not much else to say.
My problem :
When a character parries an attack while he has the state that I described in 1), he does not suffer any damage but he transfers 20% of the damage to the other actor in loss of MP. Which is not supposed to happen.
Here are the codes:
Damage transfer (the annotations are not necessarily accurate because there has been some modification to the base code, but everything works):
Code:
<Custom React Effect>
// Check if the action dealt HP damage
if (this.isHpEffect() && value > 0) {
// Get the target's allies
var members = target.friendsUnit().aliveMembers();
// Get the Aura's Origin State ID
var auraOriginId = 102;
// Make the origin user undefined
var auraOriginUser = undefined;
// Loop through each member
for (var i = 0; i < members.length; ++i) {
// Get the currently looped member
var member = members[i];
// Check if the member exists, isn't the target, and is the aura holder
if (member && member !== target && member.isStateAffected(auraOriginId)) {
// Set the origin user to that member
auraOriginUser = member;
// Break the loop
break;
}
}
// Check if the origin user exists
if (auraOriginUser) {
// Calculate the amount of reduction
var reduction = Math.ceil(0.08 * value);
// Set the damage to the target to 0.
value = value * 0.8;
value = Math.round(value);
// Make the origin user take damage instead.
auraOriginUser.gainMp(-reduction);
// Display an animation on the origin user.
auraOriginUser.startAnimation(271);
// Make the origin user display a damage popup.
auraOriginUser.startDamagePopup();
// Check if the origin user is dead
if (auraOriginUser.isDead()) {
// Collapse the origin user if dead
auraOriginUser.performCollapse();
}
// Clear the origin user's results
auraOriginUser.clearResult();
}
}
</Custom React Effect>
The parry:
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()) {
target.addState(164);
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>
The sources :
Ramza's Shield Block Plugin -UPDATED APRIL 3 2019-
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...
forums.rpgmakerweb.com
The solution I would like if possible:
I don't know if it is possible to solve my problem, but can we consider an if/else condition in the damage transfer code?
I have another damage transfer state in my game, this will allow me to solve all my problems at once. I would really like to keep my parry system.
Thanks to those who will help me.
(translation by google, please ask me to rephrase if necessary)