Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[XP or VX] Paper Mario Battle Algorithms

Hello everyone!

I have a simple (more or less) script request.

Basically, it's the battle algorithm of Paper Mario. Never played? Well the damage system is always set depending what badge or equipment they have equipped. For example, Mario always does 2 damage with his hammer right? Well, let's say he gets his Super Hammer, now he does 3 damage!

So yea, basically I would like it if the damage was set so that whatever Str. + Weapon Attack = the damage, (so I may have a character with 0 strength, and a weapon with 3 attack for a Super Hammer for example) and for the enemies, their Str = their damage. The same thing with defense, only it minus exact damage off. For example, Mario hits a Goomba (with 0 defense) with his Super Hammer and does 3 damage defeating it. But an armored shell monster comes along with 2 defense, and Mario only deals 1 damage with his Super Hammer.

I think I can make a diagram:

Code:
(Str + Weap. Atk) - Enemy Def = Battle Damage

Something like that. And the same thing with skills, only that damage is based on the number given in the Power (XP) or Variance (VX):

Code:
Skill Power = Damage (override Enemy Defense unless physical skill)

Physcial Skill Power - Enemy Defense = Battle Damage

And for enemies it's the same thing, although enemy defense is replaced by Player's Defense.


The only thing I can do is mess around with some battle scripts and menus/windows, so battle algorithms are new to me, which is why I hope someone else may accomplish this. Credit will of course be given, and you may of course post this in the Submitted Scripts Archive. Also, if you still don't understand, then I'll see if I can find a picture or youtube vid depicting the algorithm.

Thank you for your time!
-Krobe
 
Critical hits are usually when the player presses a key at the moment Mario hits, and if that could be included in the algorithm then that could help, but if not, then no Critical Hit% please ^^. Hit% should be based on the Weapon's Hit ratio, whilst the Evastion% is based on enemies Evasion rate.

Also may I ask if you've played Paper Mario or Paper Mario and the Thousand Year Door?
Thanks!
-Krobe
 
No I haven't played any of those but I've played the one on GBA, Super Star Sage which I think if I remember correctly has pretty much the same system.
Now to get your desired algorithms in VX go to game battler and find this for regular attacks:

def make_attack_damage_value(attacker)
    damage = attacker.atk * 4 - self.def * 2        # base calculation
    damage = 0 if damage < 0                        # if negative, make 0
    damage *= elements_max_rate(attacker.element_set)  # elemental adjustment
    damage /= 100
    if damage == 0                                  # if damage is 0,
      damage = rand(2)                                    # half of the time, 1 dmg
    elsif damage > 0                                # a positive number?
      @critical = (rand(100) < attacker.cri)        # critical hit?
      @critical = false if prevent_critical        # criticals prevented?
      damage *= 3 if @critical                      # critical adjustment
    end
    damage = apply_variance(damage, 20)            # variance
    damage = apply_guard(damage)                    # guard adjustment
    @hp_damage = damage                            # damage HP
  end

and change it to:

def make_attack_damage_value(attacker)
    damage = attacker.atk  - self.def              # base calculation
    damage = 0 if damage < 0                        # if negative, make 0
    damage *= elements_max_rate(attacker.element_set)  # elemental adjustment
    damage /= 100
    if damage == 0                                  # if damage is 0,
      damage = 0                                    # half of the time, 1 dmg
    elsif damage > 0                                # a positive number?
      @critical = (rand(100) < attacker.cri)        # critical hit?
      @critical = false if prevent_critical        # criticals prevented?
      damage *= 1 if @critical                      # critical adjustment
    end
    damage = apply_variance(damage, 0)            # variance
    damage = apply_guard(damage)                    # guard adjustment
    @hp_damage = damage                            # damage HP
  end

Now for skills find this in Game_Battler just slightly below the attack algorithms:

def make_obj_damage_value(user, obj)
    damage = obj.base_damage                        # get base damage
    if damage > 0                                  # a positive number?
      damage += user.atk * 4 * obj.atk_f / 100      # Attack F of the user
      damage += user.spi * 2 * obj.spi_f / 100      # Spirit F of the user
      unless obj.ignore_defense                    # Except for ignore defense
        damage -= self.def * 2 * obj.atk_f / 100    # Attack F of the target
        damage -= self.spi * 1 * obj.spi_f / 100  # Spirit F of the target
      end
      damage = 0 if damage < 0                      # If negative, make 0
    elsif damage < 0                                # a negative number?
      damage -= user.atk * 4 * obj.atk_f / 100      # Attack F of the user
      damage -= user.spi * 2 * obj.spi_f / 100    # Spirit F of the user
    end
    damage *= elements_max_rate(obj.element_set)    # elemental adjustment
    damage /= 100
    damage = apply_variance(damage, obj.variance)  # variance
    damage = apply_guard(damage)                    # guard adjustment
    if obj.damage_to_mp 
      @mp_damage = damage                          # damage MP
    else
      @hp_damage = damage                          # damage HP
    end
  end

and change it to this:

def make_obj_damage_value(user, obj)
    damage = obj.base_damage                        # get base damage
    if damage > 0                                  # a positive number?
      damage += user.atk * 1 * obj.atk_f / 1      # Attack F of the user
      damage += user.spi * 1 * obj.spi_f / 1      # Spirit F of the user
      unless obj.ignore_defense                    # Except for ignore defense
        damage -= self.def * 1 * obj.atk_f / 1    # Attack F of the target
        damage -= self.spi * 1 * obj.spi_f / 1    # Spirit F of the target
      end
      damage = 0 if damage < 0                      # If negative, make 0
    elsif damage < 0                                # a negative number?
      damage -= user.atk * 1 * obj.atk_f / 1      # Attack F of the user
      damage -= user.spi * 1 * obj.spi_f / 1      # Spirit F of the user
    end
    damage *= elements_max_rate(obj.element_set)    # elemental adjustment
    damage /= 100
    damage = apply_variance(damage, obj.variance)  # variance
    damage = apply_guard(damage)                    # guard adjustment
    if obj.damage_to_mp 
      @mp_damage = damage                          # damage MP
    else
      @hp_damage = damage                          # damage HP
    end
  end

Now I'm not an expert scripter but this should do what you want it to, the only thing I'm not sure on is how to get it so when a button is pushed at a certain time it will be a critical hit, I'm sure someone else will know how to do it.  The way I have it it will still say Critical Hit when you get a critical but it will be normal damageTo completely disable critical hits find this in Game_Actor:

def cri
    n = 4
    n += 4 if actor.critical_bonus
    for weapon in weapons.compact
      n += 4 if weapon.critical_bonus
    end
    return n
  end

and change it to:

def cri
    n = 0
    n += 0 if actor.critical_bonus
    for weapon in weapons.compact
      n += 0 if weapon.critical_bonus
    end
    return n
  end

I hope this helps you out let me know if you need something else or if it doesn't work like you want it to.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top