Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Custom Lvl Script, Need help understanding Basic Math.
TheCableGuy
post Nov 14 2011, 05:47 PM
Post #1


Level 4
Group Icon

Group: Member
Posts: 58
Type: Mapper
RM Skill: Beginner




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.
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
Areksu
post Nov 16 2011, 06:01 AM
Post #2



Group Icon

Group: Member
Posts: 3
Type: None
RM Skill: Advanced




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


__________________________


There is no impossible, only unlikely.


Go to the top of the page
 
+Quote Post
   

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 03:30 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker