Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> 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
   
Areksu
post Nov 14 2011, 08:35 PM
Post #2



Group Icon

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




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?



__________________________


There is no impossible, only unlikely.


Go to the top of the page
 
+Quote Post
   
TheCableGuy
post Nov 15 2011, 04:40 AM
Post #3


Level 4
Group Icon

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




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



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
   

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: 22nd May 2013 - 10:21 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker