How to force a dodge?

Yitzi Litt

Made Nepenthe — An RPG that's one giant dad-joke
Veteran
Joined
Jul 31, 2017
Messages
103
Reaction score
30
First Language
english
Primarily Uses
RMMV
Is there some sort of command I could use in a skill formula that will force the person being attacked to dodge/miss (preferably even if hit type is "certain hit")? for example:

if ( $gameActors.actor(1).level > 10 ) { b.forceDodge } else { a.atk * 2 };

If not, would this be easy to make a plugin for?
Thanks in advance,
Yitz
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
It should be along these lines (I'm using a state as an example)
Code:
(function(){
    var forceItemEva = Game_Action.prototype.itemEva;
    Game_Action.prototype.itemEva = function(target) {
        if (this.subject().isStateAffected(<PUT STATE ID HERE>)){return 1};
        return forceItemEva.call(this, target);
    };
})();
 

Yitzi Litt

Made Nepenthe — An RPG that's one giant dad-joke
Veteran
Joined
Jul 31, 2017
Messages
103
Reaction score
30
First Language
english
Primarily Uses
RMMV
It should be along these lines (I'm using a state as an example)
Code:
(function(){
    var forceItemEva = Game_Action.prototype.itemEva;
    Game_Action.prototype.itemEva = function(target) {
        if (this.subject().isStateAffected(<PUT STATE ID HERE>)){return 1};
        return forceItemEva.call(this, target);
    };
})();
I get that aspect of it, I'm asking specifically what's the code for forcing a dodge or a miss (they don't seem to be caused by states)? I was looking through the source code, and I couldn't easily find a reference to either of them...
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
This is the source code.
Code:
Game_Action.prototype.itemEva = function(target) {
    if (this.isPhysical()) {
        return target.eva;
    } else if (this.isMagical()) {
        return target.mev;
    } else {
        return 0;
    }
};
That tells you that you don't have a function to "force dodge". The dodge happens IF your evasion is 100% and if the skill is either physical/magical. No other way around.

Another code is this.
Code:
Game_Action.prototype.apply = function(target) {
    var result = target.result();
    this.subject().clearResult();
    result.clear();
    result.used = this.testApply(target);
    result.missed = (result.used && Math.random() >= this.itemHit(target));
    result.evaded = (!result.missed && Math.random() < this.itemEva(target));
    result.physical = this.isPhysical();
    result.drain = this.isDrain();
    if (result.i****()) {
        if (this.item().damage.type > 0) {
            result.critical = (Math.random() < this.itemCri(target));
            var value = this.makeDamageValue(target, result.critical);
            this.executeDamage(target, value);
        }
        this.item().effects.forEach(function(effect) {
            this.applyItemEffect(target, effect);
        }, this);
        this.applyItemUserEffect(target);
    }
};
Damage formula is evaluated in "makeDamageValue" which means the damage formula won't be executed unless if the item/skill hits the target. So your hypothetically damage formula is useless. Unless you want it to apply 0 damage if a certain condition is met and only specifically for that skill.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Profile Posts

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top