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.

A request for a new experience system

I'm looking for a script that will allow me to set the experience per level.

Ok that's not exactly, let me explain better:

Level 1 = 50 XP
Level 2 = 65 XP

Ok.... Now, you start at 0 XP and you slowly gain XP. When you reach the level you gain a level and the XP you have drops to zero. Now you have to start all over agian with the new level and the higher "Next Level" XP cap.

Is that clear?

Let's see....

Start XP = 0
Next Level = 40 XP
GAINED A LEVEL!!
XP = 0
Next Level = 50 XP

I can try to explain it better if need be. Just let me know.


Thanks in Advance,
Firestalker
 
OK, it's somewhat easy... in the default system.
Put this above main:
Code:
#no problem
class Game_Actor<Game_Battler
  def previous_exp_s
    return @exp_list[@level]
  end
end

#rewrites class, compability problem
class Window_Base<Window
  def draw_actor_exp(actor, x, y)
    
    #added
    a1=actor.exp_s.to_i-actor.previous_exp_s.to_i
    a1="--" if a1<0
    a2=actor.next_exp_s.to_i-actor.previous_exp_s.to_i
    a2="--" if a2<0
    #end temp variables added
    
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 24, 32, "E")
    self.contents.font.color = normal_color
    #self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
    self.contents.draw_text(x + 24, y, 84, 32, a1.to_s, 2)
    self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
    #self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
    self.contents.draw_text(x + 120, y, 84, 32, a2.to_s)
  end
end

#rewrites class, compability problem
class Window_Status < Window_Base
  def refresh
    
    #added
    a1=@actor.exp_s.to_i-@actor.previous_exp_s.to_i
    a1="--" if a1<0
    a2=@actor.next_exp_s.to_i-@actor.previous_exp_s.to_i
    a2="--" if a2<0
    #end temp variables added

    self.contents.clear
    draw_actor_graphic(@actor, 40, 112)
    draw_actor_name(@actor, 4, 0)
    draw_actor_class(@actor, 4 + 144, 0)
    draw_actor_level(@actor, 96, 32)
    draw_actor_state(@actor, 96, 64)
    draw_actor_hp(@actor, 96, 112, 172)
    draw_actor_sp(@actor, 96, 144, 172)
    draw_actor_parameter(@actor, 96, 192, 0)
    draw_actor_parameter(@actor, 96, 224, 1)
    draw_actor_parameter(@actor, 96, 256, 2)
    draw_actor_parameter(@actor, 96, 304, 3)
    draw_actor_parameter(@actor, 96, 336, 4)
    draw_actor_parameter(@actor, 96, 368, 5)
    draw_actor_parameter(@actor, 96, 400, 6)
    self.contents.font.color = system_color
    self.contents.draw_text(320, 48, 80, 32, "Exp")
    #self.contents.draw_text(320, 80, 80, 32, "Sig. Nivel")
    #deleted
    self.contents.font.color = normal_color
    #self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
    self.contents.draw_text(320 + 80, 48, 84, 32, a1.to_s + ' / ' + a2.to_s, 2)
    #self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
    #deleted
    self.contents.font.color = system_color
    self.contents.draw_text(320, 160, 96, 32, "Equipamento")
    draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
    draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 256)
    draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 304)
    draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 352)
    draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 400)
  end
end


It rewrites some classes of the default menu so if you use a customized menu it do nothing except errors.

To acoplate it to your own created menu you can see the script because I have commented the old parts and put the new line underneath.

What it makes is simple. It subtracts the experience of the previous level up to the actual experience.
Example:
Level 2->Have 25 exp total
Level 3->Have 55 exp total
Level 4->Have 90 exp total
So, with the operation:
From 1 to 2: 25(next)-0(previous)= 25 exp
From 2 to 3: 55-25= 30 exp
From 3 to 4: 90-55= 35 exp

The experience you have it's the same way:
Have 74 exp->74(actual)-55(previous_levelup)= 19 exp have in the 3 to 4 level
 

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