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.

Display Level Up Text Like Damage Text

Status
Not open for further replies.
When my character levels up, I would like for the words "Level Up" to appear over the sprite similar to the way the damage text does.

I fiddled around with the default script a little but I'm probably changing the wrong thing.

In Window_BattleStatus I changed line 44 to : self.contents.draw_text(self.x, self.y, 160, 20, "LEVEL UP!")

But now I can't even see the words. I tried some other things too, but they moved the text off to the side of the screen. I am using a side view battle system by Paradog but this should not affect what I'm trying to do, hopefully.

Here's what that whole section looks like:

Code:
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 4
      draw_actor_name(actor, actor_x, 0)
      draw_actor_hp(actor, actor_x, 32, 120)
      draw_actor_sp(actor, actor_x, 64, 120)
      if @level_up_flags[i]
        self.contents.font.color = Color.new(255, 255, 128, 255)#added color
        self.contents.draw_text(self.x, self.y, 160, 20, "LEVEL UP!")
        self.contents.font.size = 22#added
        self.contents.font.bold = true#added
        Audio.se_play('Audio/SE/decide10', 90, 100)#added
      else
        draw_actor_state(actor, actor_x, 96)
      end
    end
  end

As you may have probably noticed, I've been asking quite a few questions lately. I have a bit of time now to work on my project but I keep running into these little speed bumps. Any help would be greatly appreciated.

Oh, and one more thing: How do I get rid of the text [Normal] at the bottom of the character's stats in the battle screen? And then, when a character is inflicted with a status ailment, how do I get rid of the brackets?
 
I'm not sure how to make the level up-text appear like the damage pop, but I like the idea of it so I think I'll look into it. ^^

As for getting rid of the "[normal]" and the brackets in the status text, editing the def make_battler_state_text in window_base should do the trick.
 
Replace:
Code:
        self.contents.font.color = Color.new(255, 255, 128, 255)#added color
        self.contents.draw_text(self.x, self.y, 160, 20, "LEVEL UP!")
        self.contents.font.size = 22#added
        self.contents.font.bold = true#added
With:
Code:
actor.damage = 'LEVEL UP!'
actor.damage_pop = true

And elemmiire is correct about how to remove the [] here's one I did quickly:
Code:
class Window_Base < Window
  
  #--------------------------------------------------------------------------
  # * Make State Text String for Drawing
  #     actor       : actor
  #     width       : draw spot width
  #     need_normal : Whether or not [normal] is needed (true / false)
  #--------------------------------------------------------------------------
  def make_battler_state_text(battler, width, need_normal)
    # Make text string for state names
    text = ""
    for i in battler.states
      if $data_states[i].rating >= 1
        if text == ""
          text = $data_states[i].name
        else
          new_text = text + "/" + $data_states[i].name
          text_width = self.contents.text_size(new_text).width
          if text_width > width - brackets_width
            break
          end
          text = new_text
        end
      end
    end
    # If text string for state names is empty, make it [normal]
    if text == ""
      if need_normal
        text = ""
      end
    end
    # Return completed text string
    return text
  end
  
end
 
Thanks elemmiire for pointing me in the right direction for the removal of the status brackets.

Thank you so much Fomar for your help with the level up pop damage text and the code for the removal of the status brackets.

I have a question, though. How do I alter the level up text? I tried adding the self.contents... codes in front of those two lines you gave me, but nothing changed. I'm assuming I have to use a different method now that it's acting like the pop damage text. If it's too complex to change it, then it's all right.
 
Just change the text saying LEVEL UP! to what you would like displayed.
Code:
actor.damage = 'LEVEL UP!'
to for example
Code:
actor.damage = 'Grows Stronger!'
damage_pop just stores whether the damage should be shown yet or not.
 
Sorry I misinterpreted what you meant, i've taken this straight from the help file:
Code:
module RPG
  
  class Sprite < ::Sprite
    
    def damage(value, critical)
      dispose_damage
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
        damage_string = value.to_s
      end
      bitmap = Bitmap.new(160, 48)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
      if value.is_a?(Numeric) and value < 0
        bitmap.font.color.set(176, 255, 144)
      else
        bitmap.font.color.set(255, 255, 255)
      end
      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
      if critical
        bitmap.font.size = 20
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
        bitmap.font.color.set(255, 255, 255)
        bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
      end
      @_damage_sprite = ::Sprite.new(self.viewport)
      @_damage_sprite.bitmap = bitmap
      @_damage_sprite.ox = 80
      @_damage_sprite.oy = 20
      @_damage_sprite.x = self.x
      @_damage_sprite.y = self.y - self.oy / 2
      @_damage_sprite.z = 3000
      @_damage_duration = 40
    end
    
  end
  
end
You can edit the font name size and colour etc of the damage with this. Hope that helps.
 

ccoa

Member

This topic has been resolved. If alexia or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
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