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.

Level Up Windows compatible with Derrv Animated Battlers

I'm asking for someone (please) make these 2 scripts compatibles with Derrvulfman Animated Battlers. This script (the level up window) shows a little window above heroes names displaying thier older stats and what they've gained when they level up. Actually, an error occurs in this script and i don't know what to do to fix it. If someone foes, please post it here. Thanks.
Here are the scripts:
Level up 1 (part 1)

HTML:
#==============================================================================
# Window_LevelUpWindow
#------------------------------------------------------------------------------
# Base from fukuyama's
# Compiled by Syvkal
#==============================================================================

class Window_LevelUpWindow < Window_Base

#--------------------------------------------------------------------------
# Window size
#--------------------------------------------------------------------------

def initialize(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
 super(0, 128, 160, 192)
 self.contents = Bitmap.new(width - 32, height - 32)
 self.back_opacity = 160
 self.visible = false
 refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
end

#--------------------------------------------------------------------------
# Editable part of contents
#--------------------------------------------------------------------------

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.name = "Arial"
 self.contents.font.size = 14
 self.contents.draw_text( 0,   0, 160, 24, "LEVEL UP!!")
 self.contents.font.size = 18
 self.contents.draw_text( 0,  28, 160, 24, $data_system.words.hp)
 self.contents.draw_text( 0,  50, 160, 24, $data_system.words.sp)
 self.contents.font.size = 14
 self.contents.draw_text( 0,  72,  80, 24, $data_system.words.str)
 self.contents.draw_text( 0,  94,  80, 24, $data_system.words.dex)
 self.contents.draw_text( 0, 116,  80, 24, $data_system.words.agi)
 self.contents.draw_text( 0, 138,  80, 24, $data_system.words.int)
 self.contents.font.name = "Wingdings"
 self.contents.draw_text(97,   0, 128, 24, "")
 self.contents.font.name = "Arial"
 self.contents.draw_text(76,  28, 128, 24, "=")
 self.contents.draw_text(76,  50, 128, 24, "=")
 self.contents.draw_text(76,  72, 128, 24, "=")
 self.contents.draw_text(76,  94, 128, 24, "=")
 self.contents.draw_text(76, 116, 128, 24, "=")
 self.contents.draw_text(76, 138, 128, 24, "=")
 self.contents.font.color = normal_color
 self.contents.draw_text( 0,   0,  88, 24, last_lv.to_s, 2)
 self.contents.draw_text( 0,  28,  72, 24, "+" + up_hp.to_s, 2)
 self.contents.draw_text( 0,  50,  72, 24, "+" + up_sp.to_s, 2)
 self.contents.draw_text( 0,  72,  72, 24, "+" + up_str.to_s, 2)
 self.contents.draw_text( 0,  94,  72, 24, "+" + up_dex.to_s, 2)
 self.contents.draw_text( 0, 116,  72, 24, "+" + up_agi.to_s, 2)
 self.contents.draw_text( 0, 138,  72, 24, "+" + up_int.to_s, 2)
 self.contents.font.size = 20
 self.contents.draw_text( 0,   0, 128, 24, actor.level.to_s, 2)
 self.contents.draw_text( 0,  26, 128, 24, actor.maxhp.to_s, 2)
 self.contents.draw_text( 0,  48, 128, 24, actor.maxsp.to_s, 2)
 self.contents.draw_text( 0,  70, 128, 24, actor.str.to_s, 2)
 self.contents.draw_text( 0,  92, 128, 24, actor.dex.to_s, 2)
 self.contents.draw_text( 0, 114, 128, 24, actor.agi.to_s, 2)
 self.contents.draw_text( 0, 136, 128, 24, actor.int.to_s, 2)
end
end

Level up 2 (part 2)

HTML:
#==============================================================================
# Scene_Battle add ons
#------------------------------------------------------------------------------
# Base from fukuyama's
# Compiled by Syvkal
#==============================================================================

#--------------------------------------------------------------------------
# Search for :EDIT:  for parts you can edit.
#--------------------------------------------------------------------------

#==============================================================================
# Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
  
#--------------------------------------------------------------------------

 attr_accessor :level_up_flags
end


#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler
  
#--------------------------------------------------------------------------

attr_accessor :exp_gain_ban

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

alias xrxs_bp10_initialize initialize
def initialize
 @exp_gain_ban = false
 xrxs_bp10_initialize
end

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

alias xrxs_bp10_cant_get_exp? cant_get_exp?
def cant_get_exp?
 if @exp_gain_ban == true
   return true
 else
   return xrxs_bp10_cant_get_exp?
 end
end
end


#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
  
#--------------------------------------------------------------------------

alias xrxs_bp10_start_phase5 start_phase5
def start_phase5
 
 for i in 0...$game_party.actors.size
   $game_party.actors[i].exp_gain_ban = true
 end
 xrxs_bp10_start_phase5
 
 for i in 0...$game_party.actors.size
   $game_party.actors[i].exp_gain_ban = false
 end
 
 @exp_gained = 0
 for enemy in $game_troop.enemies
   
   @exp_gained += enemy.exp if not enemy.hidden
 end
 
 @phase5_step       = 0
 @exp_gain_actor    = -1
 
 ******@result_window.y -= 64*****
 @result_window.visible = true
 
 phase5_next_levelup
end

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

alias xrxs_bp10_update_phase5 update_phase5
def update_phase5
 case @phase5_step
 when 1
   update_phase5_step1
 else
   xrxs_bp10_update_phase5
   
   battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0
 end
end

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

def update_phase5_step1
#  Continue trigger, default : Input::C  (Enter)
 if Input.trigger?(Input::C)
   
   @levelup_window.visible = false if @levelup_window != nil
   @status_window.level_up_flags[@exp_gain_actor] = false
   phase5_next_levelup
 end
end

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

def phase5_next_levelup
 begin
   
   @exp_gain_actor += 1
  
   if @exp_gain_actor >= $game_party.actors.size
     
     @phase5_step = 0
     return
   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)
       if $data_system_level_up_se != ""
         Audio.se_stop
         #  :EDIT:             Sound effect of level up
         $data_system_level_up_se = "Audio/SE/001-System01"
         #  End :EDIT:
         Audio.se_play($data_system_level_up_se)
       end
       if $data_system_level_up_me != ""
         Audio.me_stop
         #  :EDIT:                Music effect of level up
         $data_system_level_up_me = "Audio/ME/007-Fanfare01"
         Audio.me_play($data_system_level_up_me)
         #  End :EDIT:
       end
       @levelup_window = Window_LevelUpWindow.new(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.x = 160 * @exp_gain_actor
       @levelup_window.visible = true
       @phase5_wait_count = 40
       @phase5_step       =  1
       
       @status_window.refresh
       return
     end
   end
 end until false
end
end

The part that have the **** is where the error occurs. If animated battlers would be needed, i'll post it here.
 
Technically, I haven't seen any error other than the 81st line in the 2nd script.
Code:
 ******@result_window.y -= 64*****
I simply 'commented' it out.

Oh, and so the window is OVERTOP of the general gold/exp window and shows over the battlers themselves, I did this at the very beginning of the 1st script:
Code:
def initialize(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
 super(0, 128, 160, 192)
 self.contents = Bitmap.new(width - 32, height - 32)
[B] self.back_opacity = 220 [/B][color=Green]#160[/color]
 self.visible = false
[B] self.z = 1000[/B]
 refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
end
Other than that one glitch I noted first, there was nothing that would have caused the script to crash... with or without any other script.
 
I don't know why it happened too Derrv. I've just fixed your new version of animated battlers, and this bug has gone! Anyway, thanks for the help.

You may close this topic, moderators.
 

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