how to add state to the user but on a damaging attack? what script to use? thanks for the help
how to add state to the user but on a damaging attack rpgmaker mv
Game Mechanics Designthis can be done through damage formula. a.addState(x);
the state will only be added if the attack hits.
if want state to be added even if it misses you could use yanfly action sequences plugin to add the state as part of the setup action or follow action stages.
the state will only be added if the attack hits.
if want state to be added even if it misses you could use yanfly action sequences plugin to add the state as part of the setup action or follow action stages.
thanks!! i tried that, it didnt work
i had this state that if my actor falls below 20 percent hp he would be invulnerable for two turns.
what i did was i used yanfly's passive state and put that state of invulnerability as a class " unique state " , it worked but now it activates even at 100 percent hp.
there is a function in engine isDying() it returns true if player's / enemy's HP drops below 25% so, to make work your idea with damage formula, it should be defined like this:
In the damage formula you can use the following variables:
a - refers to a battler who casts the spell/skill (or uses the item)
b - refers to the target of ability/item being used
earlier probably it didn't work for you, because the evaluation of damage formula must return number result, if you add a method AFTER actuall formula then skill won't apply damage.
But I have a tip for you - you can define damage formula inside a plugin and call it in game.
Save it as plugin (filename doesn't matter)
and iside skill formula type:
$gameSystem.myFirstSkillFormula(a,b);
with this method and yours self determination you can create more complex and effective spells for your heroes.
Or... If it's too complicated for you, then use battle events.
But I don't recommend this method, because you would need to copy this event for all troops in your database, and for all enemies in troop group.
Code:
b.isDying() ? b.addState(yourImmunityStateId); damageFormula : damageFormula
In the damage formula you can use the following variables:
a - refers to a battler who casts the spell/skill (or uses the item)
b - refers to the target of ability/item being used
earlier probably it didn't work for you, because the evaluation of damage formula must return number result, if you add a method AFTER actuall formula then skill won't apply damage.
But I have a tip for you - you can define damage formula inside a plugin and call it in game.
Code:
(function(){
'use strict';
Game_System.prototype.myFirstSkillFormula(caster, target){
//you can use all params available for actors and/or enemies
var damage = caster.atk * caster.mat - target.def;
if(target.isDying()){
target.addState(yourStateID);
}
return damage;
}
})()
Save it as plugin (filename doesn't matter)
and iside skill formula type:
$gameSystem.myFirstSkillFormula(a,b);
with this method and yours self determination you can create more complex and effective spells for your heroes.
Or... If it's too complicated for you, then use battle events.
But I don't recommend this method, because you would need to copy this event for all troops in your database, and for all enemies in troop group.
THANK YOU. I GOT IT! NOW MY PROBLEM IS HOW TO HAVE THE STATE TO COOLDOWN. IT ALWAYS ACTIVATES EVERYTIME IT REACHES THAT MARK.
Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-state-to-the-user-but-on-a-damaging-attack-rpgmaker-mv.147462/