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.

Add to variables for each monster killed

For my game I want AP to be gained from enemies. Usually it is 1 AP from each. I am making my own skill-learning system via events, so I need the AP to go to variables (I have a separate variable set up for each character). So far I made it so after the encounter a " 
 
Also you can't search for 2 letter words in the search thing so yeah, I couldn't search for AP, and I didn't know how else to word it really.

Well, if you can find one I would appreciate it if you could link me to it. Or at least link me to another forum, cuz this is the best one I know of. All the others I know about are inactive and not as big as this one.
 
You can use this:
Code:
class Game_Enemy
  # enemy_id => { variable_id => increase, ... }
  Variable_Drops = {}
  Variable_Drops.default = {}
  alias_method :seph_variableenemydrops_gmenmy_hp=, :hp=
  def hp=(hp)
    if hp <= 0
      Variable_Drops[@enemy_id].each do |id, n|
        $game_variables[id] += n
      end
    end
    self.seph_variableenemydrops_gmenmy_hp=(hp)
  end
end

Just modify your Variable_Drops = { enemy_id => { variable_id => n, ... }, ... }.

Let me know if you need any help.
 

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