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.

Increase variable at lvl up

Status
Not open for further replies.
i need a very simple script for my project. a script that increases a variable of my choice when i level up. (for my event based diablo level system)

Also, I'd like to be able to edit the number increased.

from what i know it should look like this:

on_lvl_up : gamevariable: "Variable number" + "increase number"

i know how it works, i just don't know the right names for this and where to put it.
 
Use this:
Code:
class Game_Actor < Game_Battler
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      $game_variables[A] += B # Edit A for the id of the variable you want
                              # Edit B for the amout to add
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    while @exp < @exp_list[@level]
      @level -= 1
    end
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
end
 
Status
Not open for further replies.

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