SOLVED - Integrate a variable in weapon Note to be used in skill damage formula

● ARCHIVED · READ-ONLY
Started by mugen808 4 posts View original ↗
  1. Hello,


    I would like to have weapons in RMMV that modify the damage formula of skills.

    Like ultimate weapons in FF VII, Cloud’s sword damage formula is different depending on his current hp condition.


    I am not sure if what I need is just a proper syntax to type in my formula or really a dedicated plugin. However, I’m afraid it is the second one! ^^;;



    So in short, what I want to do:

    1-Input a variable (let’s call it Multiplier) in weapon’s note.

    2- Use this multiplier in skills' damage formula


    Let’s show screens, and thanks for your help!

    Screen Shots


  2. @JamesRyan: Thank you, that is indeed very smart! And also thanks to @Galv for the script!

    First of all, thanks because this is actually working.

    That being said, i don't want to sound ungrateful, but this is not perfect. I mean the effect is perfect, but the way to reach the effect is quite heavy.
    I have to set up a weapon proficiency for each weapons * each character in each actor note, and give for each weapon a different value from 1 to as many weapon as i have (150).
    And i end up with a damage formula in each skill looking like :

    if ( proficiency a.wProf() === 2 ) { damage * x * y + z / A - B }
    else if ( proficiency a.wProf() ===3 ) { damage * W * x * y + z / A - B }
    ( ... 147 lines ... )
    else if ( proficiency a.wProf() === 150 ) { damage + AK * x * y + z / A - B }
    else { damage * ZW * x * y + z / B - C }

    So... Well, if anyone comes by this post and see a better / easier way to reach my goal, pls share it!
    If not... I am motivated enought to type this long formula in each box for each character and weapons !! ((( >___<)))

    already grateful to have a solution, thanks
  3. hi, i got my problem solved at perfection by @LadyBaskerville, thanks a thousand to her!
    sharing the solution here in case someone finds it useful some day:


    add this code in a .js, add the modifier in the weapon note as <Modifier: x>, it works with a.param or b.param or numbers.
    then use wm in your skill damage formula, such as wm * (a.atk - b.def)

    CODE
    Code:
    //Author: LadyBaskerville
    
    Game_Battler.prototype.getWeaponModifier = function() {
       if (this.isActor()) {
           var w = $dataWeapons[this._equips[0]._itemId];
           if (w.meta.Modifier) {
               return w.meta.Modifier;
           } else {
               // edit the number here for a different default modifier
               return 1;
           }
       } else {
           // edit the number here for a different modifier on enemies
           return 1;
       }
     
    };
    
    Game_Action.prototype.evalDamageFormula = function(target) {
        try {
            var item = this.item();
            var a = this.subject();
            var b = target;
            var v = $gameVariables._data;
           var wm = eval(a.getWeaponModifier());
            var sign = ([3, 4].contains(item.damage.type) ? -1 : 1);
            var value = Math.max(eval(item.damage.formula), 0) * sign;
           if (isNaN(value)) value = 0;
           return value;
        } catch (e) {
            return 0;
        }
    };

    cya around! :)