Help - Search - Members - Calendar
Full Version: Custom Lvl Script
RPG RPG Revolution Forums > Scripting > Script Development and Support
TheCableGuy
So I got this Custom Lvl Script that allows you to change you character's Lvl Names.

CODE
class Window_Base
  def draw_actor_level(actor, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, 48, 32, 'Grade -')
    self.contents.font.color = system_color
    self.contents.font.name = "Arial"
    self.contents.font.size = 18  
      grade = case actor.level
        when 1 then '1st year'
        when 2 then ''
        when 3 then ''
        when 4 then ''
        when 5 then ''
        when 6 then ''
        when 7 then ''
        when 8 then ''
        when 9 then ''
        else        ''
        end
    if $scene.is_a?(Scene_Menu)
      self.contents.draw_text(x, y + 15, 96, 32, grade)
      else
      self.contents.draw_text(x + 5, y, 96, 32, grade, 2)
    end
  end
end


And it's working fine and all except I can't seam to get the words to line up correctly no matter how much I "Tweek" the variables..

They keep showing up like this:


And I guess I could use someone to point out how Changing anything in:
CODE
    if $scene.is_a?(Scene_Menu)
      self.contents.draw_text(x, y + 15, 96, 32, grade)
      else
      self.contents.draw_text(x + 5, y, 96, 32, grade, 2)
    end


Doesn't do much.
Areksu
I do not understand your question. You want the word "Grid -" is aligned to the name of the character's current level in the same line?

TheCableGuy
QUOTE (Areksu @ Nov 14 2011, 09:35 PM) *
I do not understand your question. You want the word "Grid -" is aligned to the name of the character's current level in the same line?


Correct but Nevermind. I Fixed it. Not entirely sure how because I still don't completely understand the script But I just swapped

CODE
      self.contents.draw_text(x, y + 15, 96, 32, grade)

With
CODE
      self.contents.draw_text(x + 5, y, 96, 32, grade, 2)


and it corrected it.
Areksu
Cool you have solved it.

Anyway, I have a workaround that I think is better if you want to change the font size. Here he will check the size of the string "Grid -" and will add its size to the position of the string level.

CODE
      @x = self.contents.text_size("Grade --").width
      self.contents.draw_text(x + @x, y, 96, 32, grade)


C ya! \o
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.