Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(2 edits) (+1)

That feature already exists.

The function you're making reference to is specifically designed to 'inject' the users weapon formula into the damage formula for any skill. The note tag <weaponskill> will completely replace the damage formula with that of the weapon, but eval(this.weaponFormula(altFormula)) should allow the other parts of the formula to modify it just fine. Although, I honestly haven't tested it since the last bug report that it wasn't working correctly with some formulas, so maybe that isn't the case anymore.


You might have to do something like 

var wpn = eval(this.weaponFormula(1)); a.mhp * 0.1 + wpn 

To get it to work correctly. I'll look into it. It's also important to note that enemies do not have weapons, so they will not have a weapon formula, unless you specifically gave them one via a note tag, and this.weaponFormula() has an argument to evaluate an alternate formula if there is no weapon formula present. In the above example it'll return 1 instead. If you don't use this, it'd come back undefined or NaN, which would cause the skill to do zero damage.

Edit:

I tested in a test project with the below formula 

a.mhp * 0.1 + eval(this.weaponFormula())

The weapon formula was set to a.atk, the actor has an atk of 57, and 450 hp. With the skill, he did 102 damage, as expected.

Keep in mind that these formulas don't work in the attack skill, or in any skill that is set as a weaponskill via note tag.

Ah, that's what was tripping me up!
Nothing was happening for the attack skill so I assumed it didn't work for anything else. Just tried it and it works just fine for skills!

I probably would've been confused if it was intended or a bug if I tried it for skills earlier.

Thanks for clearing it up, as it was a huge oversight on my behalf. Looking forward to future scripts!