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.

[FILLED] Enemy HP

Well, I'm kinda stuck. In my opinion you can't set the enemy's Max HP to a very high amount. (Ex. for a boss, I would really like to have it that the boss has about 5,000,000 HP.) So can anybody write a little piece of code to set the Enemy's Max HP for each individual enemy. Like :

Code:
  #Enemy ID => MaxHP
    1 => {3},
    2 => {9},
    3 => {24},

Or something like that?
Thanks in advance.;)
 
Here ya go:
Code:
module Bearcat_MaxHP
  MaxHP = {
  1 => 1
  }
end

module RPG
  class Enemy
    alias_method :bearcat_maxhp, :maxhp
    def maxhp
      return  Bearcat_MaxHP::MaxHP[id] != nil ?
      Bearcat_MaxHP::MaxHP[id] : bearcat_maxhp
    end
  end
end
It's not commented since it's so short, but in the hash, use "enemy_id => maxhp" and leave out any that you're defining via the database.
 

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