It would probably CTD if not for the default 0 damage rescue on bad formulas.
Rpg maker vx ace damage formula code#
You can execute plain code in formula bars because I've done it before but it kinda disables use of the skill for actually doing damage. Damage formulas are evaluated in the context of Game_Battler and design wise it's silly to rely on class inheritance for a method that only exists in the child class. Been a while since I poked through that code. So far as where it should go, I looked into it a little bit more. class Game_Battlerĭef zzlifestealer(a, b) # Some kind of easy to type prefix eliminates most worries of naming collisions that could cause problems if you accidentally redefine a method you need.ĭamage *= $game_variables # Difficulty multiplier!Įlsif a.is_a? Game_Actor # Plain else fine, just demonstrating code for checking a player.ĭamage /= $game_variables # Divides it by that, too? Ouch! Here's an updated version of the 5 HP per MP version showing what I'm talking about. If you do want to do some fancy scripting that depends on whether the target (or user for that matter, or either combination of both) is friend or foe you can actually check what types a and b are. As is, it's a skill that works exactly the same for both players and monsters. All that stuff is handled in Game_Battler from the looks of it. From what I can see, players and enemies have identical implementations of all their parameters, states, buffs and everything else that you're going to be interested in for your battle skills. I've been trying to think of anything battle related that would differentiate a skill between player or monster and I'm coming up empty. You'd have to build it into the method for absolute accuracy to that degree. Of course, that won't hold 100% true with skill window based damage variance. Now you're stealing 5 HP per MP of damage. You can change that, make it so the HP gain is based on the remaining MP. Nothing fancy on all that, right?Įdit again: Of course, it will always drain the maximum amount like that even if the enemy has no MP to convert to health.
![rpg maker vx ace damage formula rpg maker vx ace damage formula](https://yanflychannel.files.wordpress.com/2011/12/ldmg.jpg)
![rpg maker vx ace damage formula rpg maker vx ace damage formula](https://static.wikia.nocookie.net/rmvxace/images/0/0c/Longdivision.png)
If you want to hit mp, you can always use b.mp -= or some such.
![rpg maker vx ace damage formula rpg maker vx ace damage formula](https://vignette.wikia.nocookie.net/rmvxace/images/7/78/ScriptEditor.png)
Rpg maker vx ace damage formula free#
If you can't make heads or tails of that, feel free to say so. Then you return the damage at the end of the method. Then you can set a local variable to the HP absorb amount, add to the skill's user with an accessor method on HP. You can do more when you stick a method in there. Formulas just RETURN a number to RM, which is the damage result. I do believe you need to set up a method then execute it in the formula bar.