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.

Window on Level Up

Nolund

Sponsor

I could have sword I've seen this script before, and now I can't find it for the life of me (and none of my searches have proved successful).

I would like a script that shows a window on a level up, showing players what stats they have gained. Something like this:

fire-emblem-goddess-of-dawn--20070223082226281_640w.jpg

Of course, it doesn't have to show character battler (but if it was possible, I'd really like to have it featured). If anyone can help me out I'd appreciate it.
 

Atoa

Member

I have this one:

Code:
#================================================

# Janela de Level UP

#==============================================================================

class Scene_Battle

LEVEL_UP_SE = "" 

LEVEL_UP_ME = "Audio/ME/001-Victory01"

end

class Window_SkillLearning < Window_Base

SKILLLEARN_SE = "Audio/SE/106-Heal02" 

end

#==============================================================================

# Window_LevelUpWindow

#==============================================================================

class Window_LevelUpWindow < Window_Base

def initialize(x, y, actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)

super(x-x, y-96, 160, 192+64)

 

self.contents = Bitmap.new(width - 32, height - 32)

self.visible = false

self.back_opacity = 400

refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)

end

#--------------------------------------------------------------------------

def refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)

self.contents.clear

self.contents.font.color = system_color

self.contents.font.size = 20

self.contents.font.name = $fontface

self.contents.draw_text( 20, 0, 160, 24, "Ganhou Nível!")

self.contents.font.size = 20

self.contents.font.name = $fontface

self.contents.draw_text( 0, 28+64, 160, 24, $data_system.words.hp)

self.contents.draw_text( 0, 50+64, 160, 24, $data_system.words.sp)

self.contents.font.size = 20

self.contents.font.name = $fontface

self.contents.draw_text( 0, 0+64, 80, 24, "Level")

self.contents.draw_text( 0, 72+64, 80, 24, $data_system.words.str[0,3])

self.contents.draw_text( 0, 94+64, 80, 24, $data_system.words.dex[0,3])

self.contents.draw_text( 0, 116+64, 80, 24, $data_system.words.agi[0,3])

self.contents.draw_text( 0, 138+64, 80, 24, $data_system.words.int[0,3])

self.contents.draw_text(76, 0+64, 128, 24, "=")

self.contents.draw_text(76, 28+64, 128, 24, "=")

self.contents.draw_text(76, 50+64, 128, 24, "=")

self.contents.draw_text(76, 72+64, 128, 24, "=")

self.contents.draw_text(76, 94+64, 128, 24, "=")

self.contents.draw_text(76, 116+64, 128, 24, "=")

self.contents.draw_text(76, 138+64, 128, 24, "=")

self.contents.font.size = 20

self.contents.font.color = normal_color

self.contents.draw_text( 0, 0+64, 72, 24, "+" + (actor.level-last_lv).to_s, 2)

self.contents.draw_text( 0, 28+64, 72, 24, "+" + up_hp.to_s, 2)

self.contents.draw_text( 0, 50+64, 72, 24, "+" + up_sp.to_s, 2)

self.contents.draw_text( 0, 72+64, 72, 24, "+" + up_str.to_s, 2)

self.contents.draw_text( 0, 94+64, 72, 24, "+" + up_dex.to_s, 2)

self.contents.draw_text( 0, 116+64, 72, 24, "+" + up_agi.to_s, 2)

self.contents.draw_text( 0, 138+64, 72, 24, "+" + up_int.to_s, 2)

self.contents.font.size = 20

self.contents.font.name = $fontface

self.contents.draw_text( 0, 0+64, 128, 24, actor.level.to_s, 2)

self.contents.draw_text( 0, 26+64, 128, 24, actor.maxhp.to_s, 2)

self.contents.draw_text( -40, 26, 128, 24, actor.name, 2)

self.contents.draw_text( 0, 48+64, 128, 24, actor.maxsp.to_s, 2)

self.contents.draw_text( 0, 70+64, 128, 24, actor.str.to_s, 2)

self.contents.draw_text( 0, 92+64, 128, 24, actor.dex.to_s, 2)

self.contents.draw_text( 0, 114+64, 128, 24, actor.agi.to_s, 2)

self.contents.draw_text( 0, 136+64, 128, 24, actor.int.to_s, 2)

self.z = 9999999

end

end

#==============================================================================

# Window_SkillLearning

#==============================================================================

class Window_SkillLearning < Window_Base

#--------------------------------------------------------------------------

attr_reader :learned 

#--------------------------------------------------------------------------

def initialize(class_id, last_lv, now_lv)

super(160, 64-32, 320, 64)

 

self.contents = Bitmap.new(width - 32, height - 28) 

self.visible = false

self.z = 999999

@learned = false

refresh(class_id, last_lv, now_lv)

end

#--------------------------------------------------------------------------

def refresh(class_id, last_lv, now_lv)

for i in 0...$data_classes[class_id].learnings.size

learn_lv = $data_classes[class_id].learnings[i].level

if learn_lv > last_lv and learn_lv <= now_lv

@learned = true

if SKILLLEARN_SE != ""

Audio.se_play(SKILLLEARN_SE)

end

skill_name = $data_skills[$data_classes[class_id].learnings[i].skill_id].name

self.contents.clear

self.contents.font.name = $fontface

self.contents.draw_text(0,0,448,32, "Aprendeu " + skill_name)

self.visible = true

loop do

Graphics.update

Input.update

update

if @learned == false

break

end

end

end

end

end

#--------------------------------------------------------------------------

def update

if Input.trigger?(Input::C)

@learned = false

self.visible = false

end

end

end

#==============================================================================

# Window_BattleStatus

#==============================================================================

class Window_BattleStatus < Window_Base

#--------------------------------------------------------------------------

attr_accessor :level_up_flags # LEVEL UP!•\Ž¦

end

#==============================================================================

# Scene_Battle

#==============================================================================

class Scene_Battle

#--------------------------------------------------------------------------

alias xrxs_bp10_start_phase5 start_phase5

def start_phase5

xrxs_bp10_start_phase5

@exp_gained = battle_exp

for i in 0...$game_party.actors.size

actor = $game_party.actors[i]

if actor.cant_get_exp? == false

last_level = actor.level

actor.exp -= @exp_gained

if actor.level < last_level

@status_window.level_up_flags[i] = false

end

end

end

@exp_gain_actor = -1

@result_window.visible = true

end

#--------------------------------------------------------------------------

alias xrxs_bp10_update_phase5 update_phase5

def update_phase5

@level_up_phase_done = false if @level_up_phase_done != true

if Input.trigger?(Input::C)

@levelup_window.visible = false if @levelup_window != nil

@status_window.level_up_flags[@exp_gain_actor] = false

@level_up_phase_done = phase5_next_levelup

end

if @level_up_phase_done

if @phase5_wait_count < 2

@result_window.opacity = 0

@result_window.back_opacity = 0

@result_window.contents_opacity = 0

end

xrxs_bp10_update_phase5

battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0

end

end

#--------------------------------------------------------------------------

def phase5_next_levelup

begin

@exp_gain_actor += 1

if @exp_gain_actor >= $game_party.actors.size

return true

end

actor = $game_party.actors[@exp_gain_actor]

if actor.cant_get_exp? == false

last_level = actor.level

last_maxhp = actor.maxhp

last_maxsp = actor.maxsp

last_str = actor.str

last_dex = actor.dex

last_agi = actor.agi

last_int = actor.int

actor.exp += @exp_gained

if actor.level > last_level

@status_window.level_up(@exp_gain_actor)

@result_window.visible = false

if LEVEL_UP_SE != ""

Audio.se_play(LEVEL_UP_SE)

end

if LEVEL_UP_ME != ""

Audio.me_stop

Audio.me_play(LEVEL_UP_ME)

end

actors_size = [$game_party.actors.size, 4].max

x_shift = 160 + (640 - 160*actors_size)/(actors_size - 1)

x = x_shift * @exp_gain_actor

y = 128

@levelup_window = Window_LevelUpWindow.new(x, y, actor, last_level,

actor.maxhp - last_maxhp, actor.maxsp - last_maxsp, actor.str - last_str,

actor.dex - last_dex, actor.agi - last_agi, actor.int - last_int)

@levelup_window.visible = true

@status_window.refresh

@skilllearning_window = Window_SkillLearning.new(actor.class_id, last_level, actor.level)

@phase5_wait_count = 40

return false

end

end

end until false

end

 

def battle_exp

bexp = 0

for enemy in $game_troop.enemies

unless enemy.hidden

bexp += enemy.exp

end

end

return bexp

end

end
 

Atoa

Member

and this one:
Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

# Level UP Window

# by Blizzard

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# CONFIGURATION

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

#          RPG::AudioFile.new('Name', Volume, Pitch)

LVLUP_SE = RPG::AudioFile.new('087-Action02', 80, 100)

LEARN_SE = RPG::AudioFile.new('106-Heal02', 80, 100)

WINDOW_BACK_OPACITY = 160

NO_EXP_DISPLAY = false

OLD_EXP_DISPLAY = false

 

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

# END OF CONFIGURATION

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

$easy_lvlup_notifier = true

 

#==============================================================================

# Game_Actor

#==============================================================================

 

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------

  def all_exp

    return @exp

  end

  #--------------------------------------------------------------------------

  def all_exp=(exp)

    @exp = exp

  end

  #--------------------------------------------------------------------------

end

 

#==============================================================================

# Window_BattleResult

#==============================================================================

 

class Window_BattleResult < Window_Base

 #--------------------------------------------------------------------------

 alias easy_lvlup_notfier_refresh refresh

 def refresh

   if $tons_version != nil && $tons_version >= 4.02 &&

       $game_system.WINDOW_BATTLERESULT || OLD_EXP_DISPLAY

     easy_lvlup_notfier_refresh

   else

     self.contents.clear

     x = 4

     self.contents.font.color = system_color

     cx = contents.text_size('Gained').width

     self.contents.draw_text(x, 0, cx+4, 32, 'Gained')

     x += cx + 4

     self.contents.font.color = normal_color

     cx = contents.text_size(@gold.to_s).width

     self.contents.draw_text(x, 0, cx+4, 32, @gold.to_s)

     x += cx + 4

     self.contents.font.color = system_color

     self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)

     (0...@treasures.size).each {|i| draw_item_name(@treasures[i], 4, (i+1)*32)}

   end

 end

 #--------------------------------------------------------------------------

end

 

#==============================================================================

# Window_LevelUp

#==============================================================================

 

class Window_LevelUp < Window_Base

 #--------------------------------------------------------------------------

 attr_reader :limit

 #--------------------------------------------------------------------------

 def initialize(a, d)

   if $tons_version != nil && $tons_version >= 4.98 &&

       $game_system.CENTER_BATTLER

     x = case $game_party.actors.size

    when 1 then 240

     when 2 then a.index * 320 + 80

     when 3 then a.index * 160 + 80

     when 4 then a.index * 160

     end

   else

     x = a.index * 160

   end

   text = []

   text.push(['Level:', d[0], a.level]) if d[0] != a.level

   text.push([$data_system.words.hp[0, 3], d[1], a.maxhp]) if d[1] != a.maxhp

   text.push([$data_system.words.sp[0, 3], d[2], a.maxsp]) if d[2] != a.maxsp

   text.push([$data_system.words.str[0, 3], d[3], a.str]) if d[3] != a.str

   text.push([$data_system.words.dex[0, 3], d[4], a.dex]) if d[4] != a.dex

   text.push([$data_system.words.agi[0, 3], d[5], a.agi]) if d[5] != a.agi

   text.push([$data_system.words.int[0, 3], d[6], a.int]) if d[6] != a.int

   h = text.size * 24 + (NO_EXP_DISPLAY ? 32 : 56)

   @limit, y = 320 - h, 480 - h + (h/64+1)*64

   super(x, y, 160, h)

   self.z, self.back_opacity = 100, WINDOW_BACK_OPACITY

   self.contents = Bitmap.new(self.width - 32, self.height - 32)

   if $fontface != nil

     self.contents.font.name = $fontface

   elsif $defaultfonttype != nil

     self.contents.font.name = $defaultfonttype

   end

   self.contents.font.size, self.contents.font.bold = 20, true

   unless NO_EXP_DISPLAY

     self.contents.font.color = normal_color

     self.contents.draw_text(0, 0, 128, 24, "#{a.exp - d[7]} EXP", 1)

   end

   text.each_index {|i|

   index = NO_EXP_DISPLAY ? i : i + 1

   self.contents.font.color = system_color

   self.contents.draw_text(0, index*24, 128, 24, text[i][0])

   self.contents.draw_text(80, index*24, 32, 24, '»')

   self.contents.font.color = normal_color

   self.contents.draw_text(0, index*24, 76, 24, text[i][1].to_s, 2)

   if text[i][1] > text[i][2]

     self.contents.font.color = Color.new(255, 64, 0)

   else

     self.contents.font.color = Color.new(0, 255, 64)

   end

   self.contents.draw_text(0, index*24, 128, 24, text[i][2].to_s, 2)}

 end

 #--------------------------------------------------------------------------

end

 

#==============================================================================

# Scene_Battle

#==============================================================================

 

class Scene_Battle

 #--------------------------------------------------------------------------

 alias main_lvlup_later main

 def main

   @lvlup_data = {}

   @moving_windows, @pending_windows = [], []

   (1...$data_actors.size).each {|i|

       actor = $game_actors[i]

       @lvlup_data[actor] = [actor.level, actor.maxhp, actor.maxsp, actor.str,

           actor.dex, actor.agi, actor.int, actor.exp, actor.skills.clone]}

   main_lvlup_later

   (@moving_windows + @pending_windows).each {|win| win.dispose if win != nil}

 end

 #--------------------------------------------------------------------------

 alias start_phase5_lvlup_later start_phase5

 def start_phase5

   start_phase5_lvlup_later

   @skill_texts = []

   $game_party.actors.each {|actor|

   actor.remove_states_battle

   if @lvlup_data[actor][0, 7] != [actor.level, actor.maxhp, actor.maxsp,

       actor.str, actor.dex, actor.agi, actor.int]

     @pending_windows.push(Window_LevelUp.new(actor, @lvlup_data[actor]))

     @skill_texts.push('')

     new_skills = actor.skills - @lvlup_data[actor][8]

     if new_skills.size > 0

       new_skills.each {|id|

           @skill_texts.push("#{actor.name} learned #{$data_skills[id].name}!")}

     end

   elsif @lvlup_data[actor][7] != actor.exp && !NO_EXP_DISPLAY

     @moving_windows.push(Window_LevelUp.new(actor, @lvlup_data[actor]))

   end}

 end

 #--------------------------------------------------------------------------

 def update_phase5

   if @phase5_wait_count > 0

     @phase5_wait_count -= 1

     if @phase5_wait_count == 0

       @result_window.visible, $game_temp.battle_main_phase = true, false

       @status_window.refresh

     end

     return

   end

   @moving_windows.each {|win|

       win.y -= [win.y - win.limit].min}

   if Input.trigger?(Input::C)

     @result_window.visible = false

     if @skill_texts.size > 0

       text = @skill_texts.shift

       if text == ''

         $game_system.se_play(LVLUP_SE)

         @moving_windows.push(@pending_windows.shift)

         @help_window.visible = false

       else

         $game_system.se_play(LEARN_SE)

         @help_window.set_text(text, 1)

       end

     else

       battle_end(0)

     end

   end

 end

 #--------------------------------------------------------------------------

end
 

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