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

mugen808

Villager
Member
Joined
Jun 27, 2013
Messages
14
Reaction score
2
First Language
french
Primarily Uses
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!



 
Last edited:

mugen808

Villager
Member
Joined
Jun 27, 2013
Messages
14
Reaction score
2
First Language
french
Primarily Uses
@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
 
Last edited:

mugen808

Villager
Member
Joined
Jun 27, 2013
Messages
14
Reaction score
2
First Language
french
Primarily Uses
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:
//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! :)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I apparently need to send photo ID to Blizzard to change my phone number. I don't even need to do this to change my number with my bank or PayPal

Hi there please listen to my newest original music.
Hi, there.
I'm Creta Park, as Software engineer and Indie game developer.

Profile : creft.me/cretapark
GitHub : github.com/creta5164
Blog : creta5164.tumblr.com


My stuff

Who shares/sells their scripts/plugins on itch.io? Can I pick your brain?

Forum statistics

Threads
98,172
Messages
950,008
Members
129,466
Latest member
AncestralGuitarist
Top