Hello,
I came upon this snippet made by Tsukihime... It allows you to have a chance to inflict a status, in this case stun, on an enemy once you hit their weakness. What I want to add to the code is an else case, where if you hit them with a weakness they resist, you have a chance of stunning, or inflicting a state on yourself.
Essentially, both the enemy and player can benefit for hitting weaknesses, and can be punished for hitting resistances.
Here's the original thread:
and here's the code:
I came upon this snippet made by Tsukihime... It allows you to have a chance to inflict a status, in this case stun, on an enemy once you hit their weakness. What I want to add to the code is an else case, where if you hit them with a weakness they resist, you have a chance of stunning, or inflicting a state on yourself.
Essentially, both the enemy and player can benefit for hitting weaknesses, and can be punished for hitting resistances.
Here's the original thread:
and here's the code:
Code:
[COLOR=rgb(0,0,0)]var TH_GameAction_calcElementRate = Game_Action.prototype.calcElementRate;
Game_Action.prototype.calcElementRate = function(target) {
var rate = TH_GameAction_calcElementRate.call(this, target);
if (rate > 1) {
// random number between 0 and 1
if (Math.random() < 0.35) {
target.addState( 30 )
}
}
return rate;
};[/COLOR]