RPG Maker Forums

Due to my damage formula being complicated and not fitting in the editor text box, I've created methods for the damage formulas in the script. They've worked exactly as intended.


I have decided that, rather than a critical hit being a multiplier on the final damage, I would have it multiply the damage inflicted before defensive stats are factored in. I knew that whether a critical was scored was determined before the damage formula was calculated from prior testing, so I thought using "@result.critical" as the base scripts do, as in the code that factors in the critical multiplier—


value = apply_critical(value) if @result.critical


—would work perfectly fine. So this is the script for the (physical) damage formula with the code for critical damage added:


def calc_phys(b)
a = self
damage = a.atk ** 0.500 * 2 / 3 * a.xstat.dam
damage *= (1.00 + a.luk * 0.01) if @result.critical
reduce = 1.000 - (b.def ** 0.900 * 0.01)
damage = damage * reduce - b.xstat.abs
return damage
end


However, "@result.critical" does not work here. The formula will only do standard damage when a critical hit is scored. The multiplier works if the "if @result.critical" is removed.


What is the issue here, and if I cannot use "@result.critical" here, how can I work around this?

Latest Threads

Latest Profile Posts

Frostorm wrote on Featherbrain's profile.
Hey, so what species are your raptors? Any of these?
... so here's my main characters running around inside "Headspace", a place people use as a safe place away from anxious/panic related thinking.
Stream will be live shortly! I will be doing some music tonight! Feel free to drop by!
Made transition effects for going inside or outside using zoom, pixi filter, and a shutter effect
I have gathered enough feedback from a few selected people. But it is still available if you want to sign up https://forums.rpgmakerweb.com/index.php?threads/looking-for-testers-a-closed-tech-demo.130774/

Forum statistics

Threads
105,992
Messages
1,018,189
Members
137,771
Latest member
evoque
Top