Menu Script Tutorial

The Infamous Bon Bon

Executive Geek
Veteran
Joined
Mar 13, 2012
Messages
850
Reaction score
409
First Language
English
Primarily Uses
Who's this for?  The intended audience is people who have spent some time with RPG Maker, but haven't gotten to scripting yet.  I myself spent a lot of time looking at custom scripts before I started scripting and I have not done any Ruby classes or anything.  So not Beginners, but you don't need to be an Expert either.

--Introduction--
This tutorial has 4 main sections:  

The Basics which cover the fundamentals that one should know before scripting

Part I which introduces the basic definitions needed for scripts and includes info on conditional statements and modules

Part II which shows how to modify various Window classes and Scene classes and implementation of the new methods

Part III which shows how to use Window scripts with eventing

Here's a video showing what is being created here:



 ​
Here is the project if you wish to download it.  Many of the instructions are contained within:  Menu Script Tutorial Project

--The Basics--
The main point of this tutorial is to show you how you can modify or make your own menu screens.  This is something I believe most people should be able to learn and since its visual scripting you should be able to spot most mistakes quickly.
 
There are some instructions and examples about the other necessary definitions for making menus (such as how to set the handler and the Scene Class), but this tutorial uses the script definition "draw_text" quite a bit, so I will go over that in depth here.
                   
--draw text--
                            
'draw_text' is used quite frequently in default and custom menu scripts and understanding how it is used can greatly increase the amount of things that an amateur scripter can do.  Lets look at an example:
 
draw_text(x, y, width, line_height, actor.name, 0)
 
This displays the actors name, most of it is self describing variables, but lets break it down anyways.
 
The first two, 'x, y,' are of course referring to the text's starting position on the coordinate plane.  x being the text's starting horizontal position, negative values moving it left and positive values moving it right.  y then is the text's starting vertical position, negative values moving it up and positive values moving it down.
 
'width' is how much horizontal space is being alloted for the text, if the text exceeds this value, default scripts will reduce the text size to make it fit, of course with limitations.
 
'line_height' is how much vertical space is being alloted for the text, if the text exceeds this value it will be cut off.  Along with "width" the text's lettering size is determined by script with the default being 24 pixels.  This section usually uses the variable "line_height" and is only changed for very specific uses.  "line_height" by default is set to 24 pixels as well, I believe this standard is used because the standard size for icons is 24 pixels and since they are used alot in menus, messages and such this allows everything to look nice and clean.
 
'actor.name' is the section that changes the most because its where the data that determines what is displayed is found.  Here you can simply put text in quotes ("") to display verbatim what you typed or you can insert a variable like 'actor.name' to display the name of the currently active actor.  This tutorial includes a bunch of examples that vary this up so you can see how it works.
 
'0' is the alignment of the text.  There are three options:  0 for left, 1 for center, and 2 for right.  0 is the default and is predetermined, so if you don't want to change it, you don't even need to type it.  For example the definition could instead be written as:  
draw_text(x, y, width, line_height, actor.name) without throwing any errors, but it will be left aligned.
 
In the script below there are plenty of examples that utilize the definition 'draw_text' in a variety of ways.  Various other concepts are introduced here as well so there's lots of little things to learn here.
 

 --def statements--
 ​
def statements are used to create methods.  def statements are not that particular. A lot of the def statements I've made are named draw "something", but draw isn't required in the name and is simply done so I can remember what they are for.  The underscore must be used for spaces, but that is about the only rule.  You don't have to use parenthesis () either, unless you need variables
for methods in the def statement.  If you do use the parenthesis all variables must be divided by commas and they must be defined unless it predefined like width = 70 in the first method of Window_Base Add_Ons below.
 
Most of the draw methods also have a line like 'change_color(normal_color)'. This simply changes the font color until another method changes it again. If you need more options on what to enter in the parenthesis go to the default Window_Base line 156.  You can also enter text_color(n) where n is a number. It will change the color to the corresponding color on the windowskin image you are using.  Just to clarify it will end up looking like this:  change_color(text_color(2))  You can also do this if you feel like having the text semi-transparent:  change_color(system_color, false)
 

--Other Useful Info--
You will need to know a bit about inheritance in order to script properly.  I suggest you read this wonderful tutorial by Fomar0153.  It's short and informative and I couldn't do a better job of explaining it: Anatomy of Windows
 
Variables will be used quite a bit in this tutorial as well:
  local variables start with lowercase letters and are used within the methods they are assigned and can be reassigned. Example: value = 'something'
  
  instance variables start with '@' and use lowercase leters and can be used by any method in the class they are intialized and be reassigned in that class. Example: @page_index = 1
  
  global variables start with '$' and use lowercase letters and can be used in almost any method in any class. Example:  $game_party
  
  Constants start with uppercase letters and can be used by just about any class in any method and they include class and module names.  They are referred with '::' such as 'Vocab::ShopBuy' which are both constants.
  
For more indepth info on variables click Help in the Script Editor:  RGSS Reference Manual - Ruby Syntax - Variables and Constants
 
 
--Part I--
 ​
Here we introduce a module and some additional Window_Base definitions.
 
Modules are handy for adding variables, reference definitions, and many other things.  Modules of the same name simply add to each other, but if you use the same def statement name that is in another module of the same name it will overwrite it with the lowest one in the script editor taking precedence. Vocab modules are handy because they give you the ability to set the name for things in one handy location and you don't have to dig through the scripts to rename things and you can write them in a way that allows you to use variables, which can save a lot of time.  This is particularly handy if you want to use your own custom scripts in multiple projects that may have different terminology or if you are like me and change your mind constantly.
 
The Window_Base additions are handy because they can be used by any Window script, but if you overwrite a Window_Base def you can affect a lot of things so take precautions.  If I overwrite a Window_Base definition I generally make a copy and pop it below Main so that if what I did screws a bunch of things up I can undo the damage.  Not a bad idea if you plan on changing a lot in other scripts too.
Each of the scripts are heavily noted to explain new concepts and ideas as they show up in the definitions.  So basically they are part of the tutorial.

The Vocab Module
=beginTIBB's Vocab Moduleby The Infamous Bon BonFree to use commercially or non-commercially with credit So here we have a Vocab module I've created (This has the same name as the standard Vocab module and simply adds to it). This script is necessary for TIBB's Window_Base Add-Ons to work. Lets look at the first one for X-Parameters: The def is self.xparam(xparam_id) and you refer to it with Vocab.xparam(xparam_id) or Vocab::xparam(xparam_id) where xparam_id is a number. Vocab:: must be used with constants like 'ShopBuy' in the default Vocab module script. "self" referes to the Object (in this case it is module, Window scripts are class) in which the def is found in, this one is Vocab of course.=endmodule Vocab #-------------------------------------------------------------------------- # --New Method-- # * Normal Parameters # Added a return line to add Max TP to the normal parameters. You can use # this method to add additional Normal Parameters like Fomar0153's Barehand # for example. # 'return' exits the method and returns the specified value, string, array,etc # Since it exits the method we don't have to worry about what follows it # throwing an error, which is why it is used. In this def it's a concern # because param 8 doesn't actually exist in the System tab of the Database. # On the return line we have 'if param_id == 8' at the end of the # line. This allows you to have the if statement apply only to that line # which is a nice space saver, note it doesn't require an end statement. # Also note that if you want to ask if a value equals a specific amount you # must use two equal signs. #-------------------------------------------------------------------------- def self.param(param_id) return "MTP" if param_id == 8 #Max TP Maximum Tech Points $data_system.terms.params[param_id] end #-------------------------------------------------------------------------- # --New Method-- # * X-Parameters # Here we need to give names to the X parameters because there is no other # place to do so. The S parameters are the same way. # Here we introduce case statements. They are similar to if statements. # First establish the case - in this example it is the variable 'xparam_id'. # Then we use 'when' and a value, followed by a line a code. # In this one we also add a fun new space saver the ';' # This ends the line. In the def below for example we have: # when 0; "Hit" # Without the ';' it would be written like this # when 0 # "Hit" # then any other when statements or end # I've included 'return ""' in the else to prevent errors. This will make # it essentially draws nothing. #-------------------------------------------------------------------------- def self.xparam(xparam_id) case xparam_id when 0; "Hit" # HIT Hit Rate when 1; "Evasion" # EVA Evasion Rate when 2; "Critical" # CRI Critical Hit Rate when 3; "Cri Eva" # CEV Critical Evasion Rate when 4; "Mag Eva" # MEV Magic Evasion Rate when 5; "Mag Ref" # MRF Magic Relfection Rate when 6; "Cnt Atk" # CNT Counter Attack Rate when 7; "HP Regen" # HRG Hp Regeneration Rate when 8; "MP Regen" # MRG Mp Regeneration Rate when 9; "TP Regen" # TRG Tp Regeneration Rate else; return ""; end end #-------------------------------------------------------------------------- # --New Method-- # * S-Parameters #-------------------------------------------------------------------------- def self.sparam(sparam_id) case sparam_id when 0; "Target" # TGR TarGet Rate when 1; "Guard" # GRD GuaRD effect rate when 2; "Recovery" # REC RECovery effect rate when 3; "Med Lore" # PHA PHArmacology when 4; "MP Cost" # MCR Mp Cost Rate when 5; "TP Charge" # TCR Tp Charge Rate when 6; "Phy Dmg" # PDR Physical Damage Rate when 7; "Mag Dmg" # MDR Magical Damage Rate when 8; "Floor Dmg" # FDR Floor Damage Rate when 9; "Exp Rate" # EXR EXperience Rate else; return ""; end end #-------------------------------------------------------------------------- # --New Method-- # * Elements # most of these are defined in the database, but 0 and -1 are not and this # method just ties it all together. It also shortens it and adds consistency. #-------------------------------------------------------------------------- def self.elements(element_id) if element_id == -1; "User's Atk Element(s)" elsif element_id == 0; "None" else; $data_system.elements[element_id]; end end #-------------------------------------------------------------------------- # --New Method-- # * States # The Skill Effect - Add State includes the option Normal State, that is the # reason for the return line otherwise these are already defined and could # simply be accessed with the line afterwards. This project won't use this, # but a future one will. #-------------------------------------------------------------------------- def self.states(state_id) return "User's Atk State(s)" if state_id == 0 $data_states[state_id].name end #-------------------------------------------------------------------------- # --New Method-- # * Skill Types # The below already defined and the point of these was to add consistency and # makes referencing them in scripts a bit shorter. #-------------------------------------------------------------------------- def self.stype(item_id); $data_system.skill_types[item_id]; end #-------------------------------------------------------------------------- # --New Method-- # * Weapon Types #-------------------------------------------------------------------------- def self.wtype(item_id); $data_system.weapon_types[item_id]; end #-------------------------------------------------------------------------- # --New Method-- # * Armor Types #-------------------------------------------------------------------------- def self.atype(item_id); $data_system.armor_types[item_id]; endend # module Vocab
 ​
The Window_Base Add-On's Script
Code:
=beginTIBB's Window_Base Add-Onsby The Infamous Bon BonFree to use commercially or non-commercially with creditRequired Scripts:  TIBB's Vocab Module    These are basic definitions used by the following scripts.  This script is  necessary for the others to work.=endclass Window_Base < Window  #--------------------------------------------------------------------------  # --New Method--  # * Draw Normal Parameter Name  # Now drawing the normal parameters (attack, defense, etc. is already built  # in, but I like to do things my own way and also this keeps it from have  # compatibility problems with other scripts.  #--------------------------------------------------------------------------  def draw_nparam_name(x, y, param_id, width = 70)    change_color(system_color)    name = Vocab.param(param_id)    draw_text(x, y, width, line_height, name)  end  #--------------------------------------------------------------------------  # --New Method--  # * Draw Current Normal Parameter  # In this def statement the first variable is 'actor'.  This is used because  # in the original version of this method I simply used @actor in the value =   # section, but I found that it limited this methods use.    #  # Now I can use @actor, @enemy, @battler(for use in battle scripts mostly),   # and others. Extending its use and saving time.  Better to be more open in  # Window_Base scripts.  #   # The case statement is explained in the X Parameter section.  I eventually  # changed this method so I could include MAX_TP.  I like to include it in   # the status menu as I have ways to change this, plus even without changing  # it, it feels incomplete to leave it out.  #--------------------------------------------------------------------------  def draw_current_nparam(actor, x, y, param_id, width = 40)     change_color(normal_color)    case param_id      when 0; value = actor.mhp          # MHP      Maximum Hit Points      when 1; value = actor.mmp          # MMP      Maximum Magic Points      when 2; value = actor.atk          # ATK      ATtacK power      when 3; value = actor.def          # DEF      DEFense power      when 4; value = actor.mat          # MAT      Magic ATtack power      when 5; value = actor.mdf          # MDF      Magic DeFense power      when 6; value = actor.agi          # AGI      AGIlity      when 7; value = actor.luk          # LUK      LUcK      when 8; value = actor.max_tp       # MAX_TP   MAXimum Tech Points      else; value = 0      end    draw_text(x, y, width, line_height, value, 2)  end    #--------------------------------------------------------------------------  # * Draw Menu Normal Parameter  # This combines the two methods into one method.  Because the value method  # (in this one that would be 'draw_current_nparam') is aligned to the right  # and the name is aligned to the left (by default), you can use the same  # values for the variables and it will look nice.  If the text is overlapping  # each other then simply increase the width.  #--------------------------------------------------------------------------  def draw_menu_nparam(actor, x, y, width, param_id)    draw_nparam_name(x, y, param_id, width)    draw_current_nparam(actor, x, y, param_id, width)  end  #--------------------------------------------------------------------------  # --New Method--  # * Draw XParameter Name   #--------------------------------------------------------------------------    def draw_xparam_name(x, y, param_id, width = 70)    change_color(system_color)    name = Vocab.xparam(param_id)    draw_text(x, y, width, line_height, name)  end  #--------------------------------------------------------------------------  # --New Method--  # * Draw Current XParameter  #You'll notice there is a commented out line, this line can replace the case  #statement in the event whatever script you may be using changes things in the  #xparam method instead of each individual method (hit, eva, etc.)  #  #I originally used the xparam method, but found it didn't work with Yanfly's  #Extra Param Formulas script (which is what I'm using for my game).  The  #case statement works with that script.  #  #So some new concepts in this method include modifying the value so it appears  #correctly on the screen because percentages are actually decimals by default.  #You'll also notice that it has '.to_i' after the parenthesis.  This changes  #the value to the integer number set.  This eliminates decimals, which is   #useful when you have limited space to work with.  #  #The next line then creates a new variable "text".  This adds a new concept   #as well '.to_s' which changes a number into a string.  Once the value is a  #string we can then add additional strings to it before we display it, in  #this case I've added "%".  The advantage of doing it this way is that it  #makes it more flexible in case you need to change font sizes because the  #% is now part of the number.  #  # See the default script- Game_BattlerBase.  This is where you will find  # hit, eva, cri, etc.  Lots of values and info can be found in this script.  # A lot of scripts that add new stats add them to the Game_BattlerBase,  # Game_Battler, Game_Actor, and/ or Game_Enemy.  Stats that apply to the  # whole party are generally put in Game_Party.  Try searching for these first  # if you want to display those values in you custom window scripts.  #--------------------------------------------------------------------------  def draw_current_xparam(actor, x, y, param_id, width = 40)    change_color(normal_color)    #value = @actor.xparam(param_id)    case param_id    when 0; value = actor.hit         # HIT Hit Rate    when 1; value = actor.eva         # EVA Evasion Rate    when 2; value = actor.cri         # CRI Critical Hit Rate    when 3; value = actor.cev         # CEV Critical Evasion Rate    when 4; value = actor.mev         # MEV Magic Evasion Rate    when 5; value = actor.mrf         # MRF Magic Relfection Rate    when 6; value = actor.cnt         # CNT Counter Attack Rate    when 7; value = actor.hrg         # HRG Hp Regeneration Rate    when 8; value = actor.mrg         # MRG Mp Regeneration Rate    when 9; value = actor.trg         # TRG Tp Regeneration Rate    else; value = 0    end    value = (value * 100).to_i    text = value.to_s + "%"    draw_text(x, y, width, line_height, text, 2)  end  #--------------------------------------------------------------------------  # * Draw Menu X-Parameter  #--------------------------------------------------------------------------  def draw_menu_xparam(actor, x, y, width, param_id)    draw_xparam_name(x, y, param_id, width)    draw_current_xparam(actor, x, y, param_id, width)  end  #--------------------------------------------------------------------------  # --New Method--  # * Draw S-Parameter Name  #--------------------------------------------------------------------------    def draw_sparam_name(x, y, param_id, width = 70)    change_color(system_color)    name = Vocab.sparam(param_id)    draw_text(x, y, width, line_height, name)  end    #--------------------------------------------------------------------------  # --New Method--  # * Draw Current S-Parameter  #--------------------------------------------------------------------------  def draw_current_sparam(actor, x, y, param_id, width = 40,bonus_style = true,                            flipped = false)    change_color(normal_color)    #value = @actor.sparam(param_id)    case param_id      when 0; value = actor.tgr      # TGR  TarGet Rate    when 1; value = actor.grd      # GRD  GuaRD effect rate    when 2; value = actor.rec      # REC  RECovery effect rate    when 3; value = actor.pha      # PHA  PHArmacology    when 4; value = actor.mcr      # MCR  Mp Cost Rate    when 5; value = actor.tcr      # TCR  Tp Charge Rate    when 6; value = actor.pdr      # PDR  Physical Damage Rate    when 7; value = actor.mdr      # MDR  Magical Damage Rate    when 8; value = actor.fdr      # FDR  Floor Damage Rate    when 9; value = actor.exr      # EXR  EXperience Rate    else; value = 0    end    value = (value * 100).to_i    if bonus_style      value -= 100      value *= -1 if flipped      if value > 0        sign = "+"        text = sign + value.to_s + "%"      elsif value == 0        text = "-- %"      else        text = value.to_s + "%"      end    else      text = value.to_s + "%"    end    draw_text(x, y, width, line_height, text, 2)  end  #--------------------------------------------------------------------------  # * Draw Menu Sp-Parameter  #--------------------------------------------------------------------------  def draw_menu_sparam(actor, x, y, width, param_id)    draw_sparam_name(x, y, param_id, width)    draw_current_sparam(actor, x, y, param_id, width)  end  #--------------------------------------------------------------------------  # --New Method--  # * Draw Element Name  #--------------------------------------------------------------------------  def draw_element_name(x, y, param_id, width = 70)    change_color(system_color)    draw_text(x, y, width, line_height, Vocab.elements(param_id))  end  #--------------------------------------------------------------------------  # --New Method--  # Draw Current Element Rate  #  #So here I've added some new predetermined variables in the def line,  #bonus_style and flipped.  If bonus_style is true then the value ranges from  #-900% to +100%, if flipped is true.  If flipped is false then the range then  #becomes -100% to 900%.  If bonus_style is false then the value ranges from  #0% to 1000% and flipped is not a factor.  If you don't want to use bonus_style  #just change bonus_style = true in the def to bonus_style = false.  #  #So now we have a couple different if statements.  The first one checks to   #see if bonus_style is true, if it is we subtract 100 from the value so that  #100% becomes 0%, then 'if flipped' we multiply by -1 to change the range.  #Then in the next imbedded if statement we check to see if the value is   #greater than 0 and if it is we add a '+' sign to the front of the text.  #  #--------------------------------------------------------------------------  def draw_current_element_rate(actor,x, y, param_id, width = 40,                                 bonus_style = true, flipped = true)    change_color(normal_color)    value = (actor.element_rate(param_id) * 100).to_i    if bonus_style      value -= 100      value *= -1 if flipped      if value > 0        sign = "+"        text = sign + value.to_s + "%"      elsif value == 0        text = "-- %"      else        text = value.to_s + "%"      end    else      text = value.to_s + "%"    end    draw_text(x, y, width, line_height, text, 2)  end  #--------------------------------------------------------------------------  # --New Method--  # * Draw Menu Element  #--------------------------------------------------------------------------  def draw_menu_element(actor, x, y, width, param_id)    draw_element_name(x, y, param_id, width)    draw_current_element_rate(actor, x, y, param_id, width)  end      #--------------------------------------------------------------------------  # --New Method--  # * Draw State Name  #--------------------------------------------------------------------------  def draw_state_name(x, y, param_id, width = 70)    change_color(system_color)    draw_text(x, y, width, line_height, Vocab.states(param_id))  end  #--------------------------------------------------------------------------  # --New Method--  # Draw Current State Rate  #The only difference from the Element Rate above is the addition of this:  #if actor.state_resist?(param_id)  #This just checks to see if the actor has the feature Resist State (n) because  #it changes the formula.  I haven't test this extensively and who knows what  #scripts could mess this up, so if things aren't displaying right that might  #be something to keep in mind.  #--------------------------------------------------------------------------  def draw_current_state_rate(actor, x, y, param_id, width = 40,                              bonus_style = true, flipped = true)    change_color(normal_color)    value = (actor.state_rate(param_id) * 100).to_i    value = 0 if @actor.state_resist?(param_id)    if bonus_style      value -= 100      value *= -1 if flipped      if value > 0        sign = "+"        text = sign + value.to_s + "%"      elsif value == 0        text = "-- %"      else        text = value.to_s + "%"      end    else      text = value.to_s + "%"    end      draw_text(x, y, width, line_height, text, 2)  end  #--------------------------------------------------------------------------  # --New Method--  # * Draw Menu State  #--------------------------------------------------------------------------  def draw_menu_state(actor, x, y, width, param_id)    draw_state_name(x, y, param_id, width)    draw_current_state_rate(actor, x, y, param_id, width)  end    #--------------------------------------------------------------------------  # --New Method--  # * Draw TP  # This is similar to the default Draw HP and Draw MP found in the Window_Base  # script.  I originally had the max value set with the string "100" as that  # is the default value, but since I recently discovered how to change that  # in fun ways I have it actually draw the 'max_tp' value found in   # Game_BattlerBase.  I will hopefully be sharing that sooner than later.  #--------------------------------------------------------------------------  def draw_actor_tp(actor, x, y, width = 124)    draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)    change_color(system_color)    draw_text(x, y, width, line_height, Vocab::tp_a)    draw_current_and_max_values(x, y, width, actor.tp.to_i, actor.max_tp.to_i,    tp_color(actor), normal_color)  end  #--------------------------------------------------------------------------  # --New Method--  # Draw Variable Info  # This allows you to draw both the variable's name and value with one method.  #--------------------------------------------------------------------------      def draw_variable_info(x, y, vid, width)    draw_variable_name(x, y, vid, width)    draw_variable_value(x, y, vid, width)  end  #--------------------------------------------------------------------------  # --New Method--  # Draw Variable Name  # This allows you to draw the variable's name as defined in the variable window.  #--------------------------------------------------------------------------     def draw_variable_name(x, y, vid, width = 100)    change_color(system_color)    draw_text(x, y, width, line_height, $data_system.variables[vid])  end      #--------------------------------------------------------------------------  # --New Method--  # Draw Variable Value  # This allows you to draw the variable's current value or text.  #--------------------------------------------------------------------------       def draw_variable_value(x, y, vid, width = 100)    change_color(normal_color)    draw_text(x, y, width, line_height, $game_variables[vid], 2)  end  #--------------------------------------------------------------------------  # --New Method--  # *Draw Block Title  # This draws whatever you enter for title_text (usually a string), centered  # with lines drawn on either side of the text.  This also features the  # methods 'content.font.italic' and similar.  These are default methods.    # When 'contents.' with other methods is used it only applies to things drawn  # after it, but will leak into other methods if you don't change them back  # afterwards, so don't forget to undo things you change.  # This also uses the default method text_size().width - the parenthesis must  # use a local variable, hence the need for line_title = title_text.  #--------------------------------------------------------------------------  def draw_block_title(x, y, title_text, width = 200)    change_color(normal_color)    line_title = title_text    lw = text_size(line_title).width    draw_horz_line_alt(x, y, width / 2 - lw / 2 - 5)    draw_horz_line_alt(x + width / 2 + lw / 2 + 5, y, width / 2 - lw / 2 - 5)    contents.font.italic = true    contents.font.outline = false    contents.font.shadow = true    draw_text(x, y, width, line_height, line_title, 1)    contents.font.shadow = false    contents.font.outline = true    contents.font.italic = false  end  #--------------------------------------------------------------------------  # --New Method--  # * Draw Horizontal Line Alt  # This and the one below were created based on the Vertical Line method found  # in the default Window_Status script.  They have a lot more customability  # than that method.  The line color method had to be added to avoid throwing  # errors (because the original method was only in the Window_Status script).  #--------------------------------------------------------------------------  def draw_horz_line_alt(x, y, width, line_y = line_height / 2 - 1)    contents.fill_rect(x, y + line_y, width, 2, line_color_alt)  end  #--------------------------------------------------------------------------  # --New Method--  # * Draw Vertical Line Alt  #--------------------------------------------------------------------------  def draw_vert_line_alt(x, y, height)    contents.fill_rect(x, y, 2, height, line_color_alt)  end  #--------------------------------------------------------------------------  # --New Method--  # * Get Color of Vertical & Horizontal Line Alt  #--------------------------------------------------------------------------  def line_color_alt    color = normal_color    color.alpha = 48    color  endend #class Window_Base < Window
Part II
 ​
         In this part we will go over how to change three default window scripts.

 

First, I have the Status Screen which I have added the X-Params and S-Params and also the Element and State Rates.  I moved the Face graphic to the middle and made the name and title bigger adding emphasis (I think it looks cool that way). I also used multiple pages so the information wouldn't have to be squished to show it all.

 

Second, I have the Equip Screen which I've added the X-Params, The character sprite, etc. to the info window.  I've also changed the EquipSlot window so that it no longer shows the categories unless the actor doesn't have something equipped in that slot.  Lastly I've reduced the ItemList Window in height and made the EquipCommand window vertical instead of horizontal.

 

Third, I have changed the Menu Status Screen to show character sprites instead of faces, streamlined the data to show next to the sprite, provided a way to have the icons show on two lines, and added the function of having the info automatically resize based on the amount of people in the party, allowing up to 8 actors to be shown at once.  I also made TP standard.  I maintained the default scripts use of making non-battle members' image semi-transparent, but with the character sprites instead of the faces.

Status Screen Script
 ​
 Images

 


Status Screen page 1 featuring X-Parameters and S-Parameters



 

Status Screen page 2 featuring Elements and States
 =beginTIBB's Status Screenby The Infamous Bon BonFree to use commercially or non-commercially with creditRequired Scripts: TIBB's Vocab Module and TIBB's Window_Base Add-Ons Includes X-Parameters, S-Parameters, Element Rates, and State Rates. It also utilizes multiple pages and I will show you how to set that up as well=endclass Window_Status < Window_Selectable #-------------------------------------------------------------------------- # --Alias Method-- # * Object Initialization # Modified to now include '@page_index'. Necessary for multiple pages. # # Here is the first Alias Method I've done, so lets look at how it works. # Aliasing a method simply copies a method exactly and allows you to put it # into another method. Generally this is used to Overwrite a method without # screwing any other previously done changes to the method up, while allowing # you to add things either before or after the method runs or both. # In this method all I needed to add was '@page_index = 0', it didn't really # change all that much and there is always the possibility that some other # script that you might be using added important things here, so I figured # it would be best to alias. To be honest I'm not exactly sure why, but it # was necessary to put the '@page_index = 0' before the alias, while in the # Window_EquipStatus I was able to put it afterwards. It wasn't drawing the # pages intially. # # When you alias a method you come up with a new name (usually it is a good # idea to include the original methods name in some way as to remind you what # it is for) then add a space (not an underscore, this is important) then the # original method's name with no variables (if it has them). After this you # do it like an Overwrite and use your alias with variables (if the original # method had them) were you need it. #-------------------------------------------------------------------------- alias tibb_initialize_window_status initialize def initialize(actor) @page_index = 0 tibb_initialize_window_status(actor) end #-------------------------------------------------------------------------- # --Alias Method-- # * Frame Update # Modified to now include 'update_page'. Necessary for multiple pages. #-------------------------------------------------------------------------- alias tibb_update_window_status update def update tibb_update_window_status update_page end #-------------------------------------------------------------------------- # --New Method-- # * Update Page # This was taken from Window_ShopStatus. This is a bit a hard to understand, # but lets try. # The if line makes sure that the window is visible, that the user is pressing # the Shift key and that the page_max is higher than 1. # In the next line 1 gets added to @page_index and that is divided by page_max # then it returns the remainder of that (that's what the '%' does) and that # becomes @page_index. # (Remember remainders, who thought they would ever use that again) # # So lets use some numbers to illustrate. Say we just opened the window, so # @page_index equals 0 because that's how we assigned it in the def initialize # above and page_max equals 2 (see def below). We press Shift and 1 gets # added to 0 for a total of 1. When we divide that by 2, 2 goes into 1, # 0 times with a remainder of 1, so @page_index becomes 1. So now we decide # to press Shift again so 1 gets added to 1, giving us a total of 2 and when # we divide that by 2 we get 1 with a remainder of 0, so @page_index becomes # 0 again and the process starts over. So we will never actually get to an # @page_index of 2, therefore when we assign draw methods in the refresh we # will only be assigning them to @page_index of 0 and 1. # page_max must be higher than 1 because anything divided by one will always # have a remainder of 0, making '@page_index' 0 everytime and never allowing # multiple pages. Also you never want to initialize '@page_index' higher than # 'page_max' because things will get funky. #-------------------------------------------------------------------------- def update_page if visible && Input.trigger?:)A) && page_max > 1 @page_index = (@page_index + 1) % page_max refresh end end #-------------------------------------------------------------------------- # --New Method-- # * Get Maximum Number of Pages # Necessary for multiple pages. #-------------------------------------------------------------------------- def page_max; return 2; end #-------------------------------------------------------------------------- # --New Method-- # * Get Horizontal Column Spacing # Value added to x and used in some width formulas to maintain consistent # columns. #-------------------------------------------------------------------------- def horz_column_spacing; return 20; end #-------------------------------------------------------------------------- # --New Method-- # * Get Three Column Width #-------------------------------------------------------------------------- def three_col_width; return (contents.width - (horz_column_spacing * 2)) / 3 end #-------------------------------------------------------------------------- # --New Method-- # * Get Four Column Width #-------------------------------------------------------------------------- def four_col_width; return (contents.width - (horz_column_spacing * 3)) / 4 end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Refresh # Done in a block style similar to the default Window_Status script, but of # course with my additions. The blocks are handy because you can keep # everything lined up together and move the whole block around a lot easier. # They are all defined below. # # Notice the line 'actor = @actor' is used to make the lower lines use @actor # in their methods, otherwise it would throw a ton of errors, because when you # are in actor selectable screens the script engines require @actor. #-------------------------------------------------------------------------- def refresh contents.clear draw_header(0) actor = @actor width = three_col_width hs = horz_column_spacing draw_menu_nparam_block(actor, 0, line_height * 2, width) draw_class_block(width + hs, line_height * 4, width) draw_equipments((width + hs) * 2, line_height * 2, width) width = four_col_width if @page_index == 0 draw_menu_xparam_block(actor, 0, line_height * 8 - 4, width, "X-Parameters") draw_menu_sparam_block(actor, (width + hs) * 2, line_height * 8 - 4, width, "S-Parameters") elsif @page_index == 1 draw_menu_element_block(actor, 0, line_height * 8 - 4, width, "Vs. Elements") draw_menu_state_block(actor, (width + hs) * 2, line_height * 8 - 4, width, "Vs. States") end #if @page_index == 0 # This all concerning the more info text-------------------------------- contents.font.size = 20 contents.font.italic = true contents.font.outline = false contents.font.shadow = true change_color(text_color(3), true) rect = Rect.new(0, line_height * 12 + 12, contents.width, line_height) text = "Press Shift for More Info" draw_text(rect, text, 2) if page_max > 1 contents.font.italic = false contents.font.outline = true contents.font.shadow = false contents.font.size = Font.default_size #------------------------------------------------------------------------ draw_horz_line(line_height * 13) draw_description(0, line_height * 14) end #-------------------------------------------------------------------------- # --New Method-- # * Draw Header # This utilizes the 'draw_horz_line_alt' and 'draw_vert_line_alt' I created # in the Window_Base Add-Ons. Note also I modified the height variable in # the 'draw_text' lines to the size of the font so they would draw properly. #-------------------------------------------------------------------------- def draw_header(y) contents.font.italic = true contents.font.size = Font.default_size * 1.5 th = contents.font.size tw = contents.width / 2 - 48 draw_text(0, y + 2, tw, th, @actor.name, 1) draw_text(tw + 96, y + 2, tw, th, @actor.nickname, 1) draw_actor_face(@actor, tw, y + 2) contents.font.size = Font.default_size contents.font.italic = false draw_horz_line_alt(0, y, tw, th) draw_horz_line_alt(tw + 96, y, tw, th) draw_horz_line_alt(tw, y, 98, 0) draw_horz_line_alt(tw - 2, y + 96, 98, 0) draw_vert_line_alt(tw - 2, y, 98) draw_vert_line_alt(tw + 96, y, 98) end #-------------------------------------------------------------------------- # --New Method-- # * Draw Menu Normal Parameter Block # This utilizes the 'draw_men_nparam' method I created in the Window_Base # Add-Ons. #-------------------------------------------------------------------------- def draw_menu_nparam_block(actor, x, y, width) hs = horz_column_spacing contents.font.size = Font.default_size - 4 draw_level(actor, x, y, (width - hs) / 2) draw_menu_nparam(actor, x + width / 2 + hs / 2, y, (width - hs) / 2, 0) draw_menu_nparam(actor, x, y + line_height * 1, (width - hs) / 2, 1) draw_menu_nparam(actor, x + width / 2 + hs / 2, y + line_height * 1, (width - hs) / 2, 8) draw_menu_nparam(actor, x, y + line_height * 2, width / 2 - hs / 2, 2) draw_menu_nparam(actor, x, y + line_height * 3, width / 2 - hs / 2, 3) draw_menu_nparam(actor, x, y + line_height * 4, width / 2 - hs / 2, 4) column2 = width / 2 + hs / 2 draw_menu_nparam(actor, column2, y + line_height * 2, width / 2 - hs / 2, 5) draw_menu_nparam(actor, column2, y + line_height * 3, width / 2 - hs / 2, 6) draw_menu_nparam(actor, column2, y + line_height * 4, width / 2 - hs / 2, 7) contents.font.size = Font.default_size end #-------------------------------------------------------------------------- # --New Method-- # * Draw Actor Level #-------------------------------------------------------------------------- def draw_level(actor, x, y, width) change_color(system_color) draw_text(x, y, width, line_height, Vocab.level_a) change_color(normal_color) draw_text(x, y, width, line_height, actor.level, 2) end #-------------------------------------------------------------------------- # --New Method-- # * Draw Menu X-Parameter Block # Here I utilize the 'draw_block_title' and of course # 'draw_menu_xparam' that I created. # This uses a multiple draw method. It executes 'draw_menu_xparam' 10 times. # i starts at 0 and increases by 1 each time. Handy if you want to draw # multiple things in numerical order. #-------------------------------------------------------------------------- def draw_menu_xparam_block(actor, x, y, width, block_title) hs = horz_column_spacing draw_block_title(x, y - (line_height - 4), block_title, width * 2 + hs) contents.font.size = Font.default_size - 4 5.times {|i| draw_menu_xparam(actor, x, y + (line_height - 4) * i, width, i) } 5.times {|i| draw_menu_xparam(actor, x + (width + hs), y + (line_height - 4) * i, width, i + 5) } contents.font.size = Font.default_size end #-------------------------------------------------------------------------- # --New Method-- # * Draw Menu Sp-Parameter Block #-------------------------------------------------------------------------- def draw_menu_sparam_block(actor, x, y, width, block_title) hs = horz_column_spacing draw_block_title(x, y - (line_height - 4), block_title, width * 2 + hs) contents.font.size = Font.default_size - 4 5.times {|i| draw_menu_sparam(actor, x, y + (line_height - 4) * i, width, i) } 5.times {|i| draw_menu_sparam(actor, x + (width + hs), y + (line_height - 4) * i, width, i + 5) } contents.font.size = Font.default_size end #-------------------------------------------------------------------------- # --New Method-- # * Draw Menu Element Block # When doing the multiple draw I wanted to avoid drawing Physical and Absorb # so I added 3 to i. # Remember i starts at 0 so if you don't add anything to 'i' it will do 0, # which is defined in the Vocab module as "None" #-------------------------------------------------------------------------- def draw_menu_element_block(actor, x, y, width, block_title) hs = horz_column_spacing draw_block_title(x, y - (line_height - 4), block_title, width * 2 + hs) contents.font.size = Font.default_size - 4 4.times {|i| draw_menu_element(actor, x, y + (line_height - 4) * i, width, 3 + i) } 4.times {|i| draw_menu_element(actor, x + (width + hs), y + (line_height - 4) * i, width, 7 + i) } contents.font.size = Font.default_size end #-------------------------------------------------------------------------- # --New Method-- # * Draw Menu State Block # When doing the multiple draw I wanted to avoid drawing Death # so I added 2 to i. #-------------------------------------------------------------------------- def draw_menu_state_block(actor, x, y, width, block_title) hs = horz_column_spacing draw_block_title(x, y - (line_height - 4), block_title, width * 2 + hs) contents.font.size = Font.default_size - 4 4.times {|i| draw_menu_state(actor, x, y + (line_height - 4) * i, width, 2 + i) } 3.times {|i| draw_menu_state(actor, x + (width + hs), y + (line_height - 4) * i, width, 6 + i) } contents.font.size = Font.default_size end #-------------------------------------------------------------------------- # --New Method-- # * Draw Class Block #-------------------------------------------------------------------------- def draw_class_block(x, y, width) contents.font.size = Font.default_size - 4 draw_class(x, y, width) draw_exp_info(x, y + line_height * 1, width) contents.font.size = Font.default_size end #-------------------------------------------------------------------------- # --New Method-- # * Draw Class and Level on the same line #-------------------------------------------------------------------------- def draw_class(x, y, width) change_color(system_color) draw_text(x, y, width, line_height, "Class") change_color(normal_color) draw_text(x, y, width, line_height, @actor.class.name, 2) end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Draw Experience Information # Modified to include width as a variable. Also reduced font size to make # things fit. #-------------------------------------------------------------------------- def draw_exp_info(x, y, width) s1 = @actor.max_level? ? "-------" : @actor.exp s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp s_next = sprintf(Vocab::ExpNext, Vocab::level) change_color(system_color) draw_text(x, y, width, line_height, Vocab::ExpTotal) draw_text(x, y + line_height * 1, width, line_height, s_next) change_color(normal_color) draw_text(x, y, width, line_height, s1, 2) draw_text(x, y + line_height * 1, width, line_height, s2, 2) end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Draw Equipment # Modified to include width as a variable. Also reduced font size to make # things fit. #-------------------------------------------------------------------------- def draw_equipments(x, y, width) contents.font.size = Font.default_size - 4 @actor.equips.each_with_index do |item, i| draw_item_name(item, x, y + line_height * i, true, width) end contents.font.size = Font.default_size endend #class Window_Status < Window_Selectable 

Equip Screen Script

 Images



Equip Screen page 1 featuring X-Parameters



Equip Screen page 2 featuring S-Parameters



Equip Screen page 3 featuring Elements



Equip Screen page 4 featuring States
=beginTIBB's Equip Screenby The Infamous Bon BonFree to use commercially or non-commercially with creditRequired Scripts: TIBB's Vocab Module and TIBB's Window_Base Add-Ons This script not only includes an enhanced status screen with multiple pages, changes to other windows in the scene, and how to modify the Scene class itself.=end#==============================================================================# ** Window_EquipStatus#------------------------------------------------------------------------------# This window displays actor's Parameters, Level, and Character Sprite.# Using SHIFT key (Input A) the player can switch between also viewing the# the X-Parameters, S-Parameters, Element Rates, and State Rates.#==============================================================================class Window_EquipStatus < Window_Base # #-------------------------------------------------------------------------- # --Alias Method-- # * Object Initialization # Modified to now include '@page_index'. Necessary for multiple pages. #-------------------------------------------------------------------------- alias tibb_initialize_window_equipstatus initialize def initialize(x, y) tibb_initialize_window_equipstatus(x, y) @page_index = 0 end #-------------------------------------------------------------------------- # --Alias Method-- # * Frame Update # Modified to now include 'update_page'. Necessary for multiple pages. #-------------------------------------------------------------------------- alias tibb_update_window_equipstatus update def update tibb_update_window_equipstatus update_page end #-------------------------------------------------------------------------- # --New Method-- # * Update Page # Necessary for multiple pages. #-------------------------------------------------------------------------- def update_page if visible && Input.trigger?:)A) && page_max > 1 @page_index = (@page_index + 1) % page_max refresh end end #-------------------------------------------------------------------------- # --New Method-- # * Get Maximum Number of Pages # Necessary for multiple pages. #-------------------------------------------------------------------------- def page_max; return 4; end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Get Window Width # If you modify this, you will need to go down Scene_Equip, def @status_window # and change the x value (it currently is Graphics.width - 378) to # Graphics.width - n (the value you change this to) for the windows to draw # correctly and line up all pretty and such. #-------------------------------------------------------------------------- def window_width; return 378; end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Get Number of Lines to Show # The visible_line_number is used to calculate the window height. # The original was 7, so this made the window taller. #-------------------------------------------------------------------------- def visible_line_number; return 10; end #-------------------------------------------------------------------------- # --New Method-- # * Get Line Spacing Modifier # Used to push lines vertically closer to one another. Used to modify y. # The higher the number the closer lines will be. #-------------------------------------------------------------------------- def line_spacing_mod; return 6; end #-------------------------------------------------------------------------- # --New Method-- # * Get Arrow xSpacing # Value added to x to get the arrow in the right place. #-------------------------------------------------------------------------- def arrow_xspacing; return 108; end #-------------------------------------------------------------------------- # --New Method-- # * Get Current xSpacing # Value added to x to get the current equipment value in the right place. #-------------------------------------------------------------------------- def current_xspacing; return 71; end #-------------------------------------------------------------------------- # --New Method-- # * Get Change xSpacing # Value added to x to get the changed to equipment value in the right place. #-------------------------------------------------------------------------- def change_xspacing; return 125; end #-------------------------------------------------------------------------- # --New Method-- # * Get Arrow xSpacing # Value added to x to get the 2nd column starting point. #-------------------------------------------------------------------------- def column2; return 170; end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Refresh #-------------------------------------------------------------------------- def refresh #------------------------------------------------------------------------ # This section applies to all pages. contents.clear actor = @actor draw_actor_name(@actor, 40, 0) if @actor contents.font.size = Font.default_size - 5 draw_actor_level(@actor, 40, 20, 40) draw_actor_graphic_alt(20, 36) draw_nparam_block(actor, 0, 0) #------------------------------------------------------------------------ # This section applies only to the first page. if @page_index == 0 draw_xparam_block(actor, 0, line_height * 5 + 6, "X-Parameters") #------------------------------------------------------------------------ # This section applies only to the first page. elsif @page_index == 1 draw_sparam_block(actor, 0, line_height * 5 + 6, "S-Parameters") #------------------------------------------------------------------------ # This section applies only to the third page. elsif @page_index == 2 draw_element_block(actor, 0, line_height * 5 + 6,"Vs. Elements") #------------------------------------------------------------------------ # This section applies only to the fourth page. elsif @page_index == 3 draw_state_block(actor, 0, line_height * 5 + 6, "Vs. States") #------------------------------------------------------------------------ # If you wanted a third page you would add 'elsif @page_index == 2' here and # of course you would need to change the 'page_max' end #if @page_index == 0 #------------------------------------------------------------------------ # This all concerning the text at the bottom of the window change_color(text_color(3), false) rect = Rect.new(0, contents.height - contents.font.size, contents.width, line_height) text = "Press Shift for More Info" draw_text(rect, text, 2) if page_max > 1 #This also applies to all pages, but it is simply reseting the font. contents.font.size = Font.default_size end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Draw Level # Modified to include width as a variable. #-------------------------------------------------------------------------- def draw_actor_level(actor, x, y, width) change_color(system_color) draw_text(x, y, width, line_height, Vocab::level_a) change_color(normal_color) draw_text(x, y, width, line_height, actor.level, 2) if @actor end #-------------------------------------------------------------------------- # --New Method-- # * Draw Actor Graphic Alternative # The comment out lines are only necessary if you are using a Visual Equip # script like Victor Sant's or Modern Algebra's for example. Otherwise # its basically the same as the original 'draw_actor_graphic'. #-------------------------------------------------------------------------- def draw_actor_graphic_alt(x, y) draw_actor_graphic(@actor, x, y) if @actor #draw_right_arrow(x + arrow_xspacing - 20, y - line_height) if @temp_actor #draw_actor_graphic(@temp_actor, x + change_xspacing - 4, y) if @temp_actor end #-------------------------------------------------------------------------- # --New Method-- # * Draw Parameter Block #-------------------------------------------------------------------------- def draw_nparam_block(actor, x, y) change_color(normal_color) draw_nparam(actor, x, y + (line_height - line_spacing_mod) * 3, 0) draw_nparam(actor, x, y + (line_height - line_spacing_mod) * 4, 1) draw_nparam(actor, x, y + (line_height - line_spacing_mod) * 5, 8) 6.times {|i| draw_nparam(actor, column2, y + (line_height - line_spacing_mod) * i, 2 + i)} end #-------------------------------------------------------------------------- # --New Method-- # * Draw X Parameter Block #-------------------------------------------------------------------------- def draw_xparam_block(actor, x, y, block_title) change_color(normal_color) draw_block_title(x, y - (line_height - line_spacing_mod), block_title, contents.width - 20) 5.times {|i| draw_xparam(actor, x, y + (line_height - line_spacing_mod) * i, i)} 5.times {|i| draw_xparam(actor, column2, y + (line_height - line_spacing_mod) * i, i + 5)} end #-------------------------------------------------------------------------- # --New Method-- # * Draw S Parameter Block #-------------------------------------------------------------------------- def draw_sparam_block(actor, x, y, block_title) change_color(normal_color) draw_block_title(x, y - (line_height - line_spacing_mod), block_title, contents.width - 20) 5.times {|i| draw_sparam(actor, x, y + (line_height - line_spacing_mod) * i, i)} 5.times {|i| draw_sparam(actor, column2, y + (line_height - line_spacing_mod) * i, i + 5)} end #-------------------------------------------------------------------------- # --New Method-- # * Draw Element Block #-------------------------------------------------------------------------- def draw_element_block(actor, x, y, block_title) change_color(normal_color) draw_block_title(x, y - (line_height - line_spacing_mod), block_title, contents.width - 20) 4.times {|i| draw_element(actor, x, y + (line_height - line_spacing_mod) * i, i + 3)} 4.times {|i| draw_element(actor, column2, y + (line_height - line_spacing_mod) * i, i + 7)} end #-------------------------------------------------------------------------- # --New Method-- # * Draw State Block #-------------------------------------------------------------------------- def draw_state_block(actor, x, y, block_title) change_color(normal_color) draw_block_title(x, y - (line_height - line_spacing_mod), block_title, contents.width - 20) 4.times {|i| draw_state(actor, x, y + (line_height - line_spacing_mod) * i, i + 2)} 3.times {|i| draw_state(actor, column2, y + (line_height - line_spacing_mod) * i, i + 6)} end #-------------------------------------------------------------------------- # --New Method-- # * Draw Normal Parameters # The method 'draw_right_arrow' is the only one that was used in the default # and was not overwritten. #-------------------------------------------------------------------------- def draw_nparam(actor, x, y, param_id) draw_nparam_name(x + 4, y, param_id) draw_current_nparam(actor, x + current_xspacing, y, param_id) if @actor draw_right_arrow(x + arrow_xspacing, y) if @temp_actor draw_new_nparam(x + change_xspacing, y, param_id) if @temp_actor end #-------------------------------------------------------------------------- # --New Method-- # * Draw X-param #-------------------------------------------------------------------------- def draw_xparam(actor, x, y, param_id) draw_xparam_name(x + 4, y, param_id) draw_current_xparam(actor, x + current_xspacing, y, param_id) if @actor draw_right_arrow(x + arrow_xspacing, y) if @temp_actor draw_new_xparam(x + change_xspacing, y, param_id) if @temp_actor end #-------------------------------------------------------------------------- # --New Method-- # * Draw S-param #-------------------------------------------------------------------------- def draw_sparam(actor, x, y, param_id) draw_sparam_name(x + 4, y, param_id) draw_current_sparam(actor, x + current_xspacing, y, param_id) if @actor draw_right_arrow(x + arrow_xspacing, y) if @temp_actor draw_new_sparam(x + change_xspacing, y, param_id) if @temp_actor end #-------------------------------------------------------------------------- # --New Method-- # * Draw Element #-------------------------------------------------------------------------- def draw_element(actor, x, y, param_id) draw_element_name(x + 4, y, param_id) draw_current_element_rate(actor, x + current_xspacing, y, param_id) if @actor draw_right_arrow(x + arrow_xspacing, y) if @temp_actor draw_new_element_rate(x + change_xspacing, y, param_id) if @temp_actor end #-------------------------------------------------------------------------- # --New Method-- # * Draw State #-------------------------------------------------------------------------- def draw_state(actor, x, y, param_id) draw_state_name(x + 4, y, param_id) draw_current_state_rate(actor, x + current_xspacing, y, param_id) if @actor draw_right_arrow(x + arrow_xspacing, y) if @temp_actor draw_new_state_rate(x + change_xspacing, y, param_id) if @temp_actor end #-------------------------------------------------------------------------- # --New Method-- # * Draw Post-Equipment Change N-Parameter # Based on the default method 'draw_new_param' with my way of doing things # and of course MAX TP added in this one. #-------------------------------------------------------------------------- def draw_new_nparam(x, y, param_id, width = 40) case param_id when 0; value = @actor.mhp # MHP Maximum Hit Points when 1; value = @actor.mmp # MMP Maximum Magic Points when 2; value = @actor.atk # ATK ATtacK power when 3; value = @actor.def # DEF DEFense power when 4; value = @actor.mat # MAT Magic ATtack power when 5; value = @actor.mdf # MDF Magic DeFense power when 6; value = @actor.agi # AGI AGIlity when 7; value = @actor.luk # LUK LUcK when 8; value = @actor.max_tp # MAX_TP Maximum Tech Points else; value = 0; end case param_id when 0; temp_value = @temp_actor.mhp # MHP Maximum Hit Points when 1; temp_value = @temp_actor.mmp # MMP Maximum Magic Points when 2; temp_value = @temp_actor.atk # ATK ATtacK power when 3; temp_value = @temp_actor.def # DEF DEFense power when 4; temp_value = @temp_actor.mat # MAT Magic ATtack power when 5; temp_value = @temp_actor.mdf # MDF Magic DeFense power when 6; temp_value = @temp_actor.agi # AGI AGIlity when 7; temp_value = @temp_actor.luk # LUK LUcK when 8; temp_value = @temp_actor.max_tp # MAX_TP Maximum Tech Points else; temp_value = 0; end change_color(param_change_color(temp_value - value)) draw_text(x, y, width, line_height, temp_value, 2) end #-------------------------------------------------------------------------- # --New Method-- # * Draw Post-Equipment Change X-Parameter #-------------------------------------------------------------------------- def draw_new_xparam(x, y, param_id, width = 40) case param_id when 0; value = @actor.hit # HIT Hit Rate when 1; value = @actor.eva # EVA Evasion Rate when 2; value = @actor.cri # CRI Critical Hit Rate when 3; value = @actor.cev # CEV Critical Evasion Rate when 4; value = @actor.mev # MEV Magic Evasion Rate when 5; value = @actor.mrf # MRF Magic Relfection Rate when 6; value = @actor.cnt # CNT Counter Attack Rate when 7; value = @actor.hrg # HRG Hp Regeneration Rate when 8; value = @actor.mrg # MRG Mp Regeneration Rate when 9; value = @actor.trg # TRG Tp Regeneration Rate else; value = 0; end case param_id when 0; temp_value = @temp_actor.hit # HIT Hit Rate when 1; temp_value = @temp_actor.eva # EVA Evasion Rate when 2; temp_value = @temp_actor.cri # CRI Critical Hit Rate when 3; temp_value = @temp_actor.cev # CEV Critical Evasion Rate when 4; temp_value = @temp_actor.mev # MEV Magic Evasion Rate when 5; temp_value = @temp_actor.mrf # MRF Magic Relfection Rate when 6; temp_value = @temp_actor.cnt # CNT Counter Attack Rate when 7; temp_value = @temp_actor.hrg # HRG Hp Regeneration Rate when 8; temp_value = @temp_actor.mrg # MRG Mp Regeneration Rate when 9; temp_value = @temp_actor.trg # TRG Tp Regeneration Rate else; temp_value = 0; end new_value = (temp_value * 100).to_i current_value = (value * 100).to_i change_color(param_change_color(new_value - current_value)) text = new_value.to_s + "%" draw_text(x, y, width, line_height, text, 2) end #-------------------------------------------------------------------------- # --New Method-- # * Draw Post-Equipment Change S-Parameter #-------------------------------------------------------------------------- def draw_new_sparam(x, y, param_id, width = 40, bonus_style = true, flipped = false) case param_id when 0; value = @actor.tgr # TGR TarGet Rate when 1; value = @actor.grd # GRD GuaRD effect rate when 2; value = @actor.rec # REC RECovery effect rate when 3; value = @actor.pha # PHA PHArmacology when 4; value = @actor.mcr # MCR Mp Cost Rate when 5; value = @actor.tcr # TCR Tp Charge Rate when 6; value = @actor.pdr # PDR Physical Damage Rate when 7; value = @actor.mdr # MDR Magical Damage Rate when 8; value = @actor.fdr # FDR Floor Damage Rate when 9; value = @actor.exr # EXR EXperience Rate else; value = 0; end case param_id when 0; temp_value = @temp_actor.tgr # TGR TarGet Rate when 1; temp_value = @temp_actor.grd # GRD GuaRD effect rate when 2; temp_value = @temp_actor.rec # REC RECovery effect rate when 3; temp_value = @temp_actor.pha # PHA PHArmacology when 4; temp_value = @temp_actor.mcr # MCR Mp Cost Rate when 5; temp_value = @temp_actor.tcr # TCR Tp Charge Rate when 6; temp_value = @temp_actor.pdr # PDR Physical Damage Rate when 7; temp_value = @temp_actor.mdr # MDR Magical Damage Rate when 8; temp_value = @temp_actor.fdr # FDR Floor Damage Rate when 9; temp_value = @temp_actor.exr # EXR EXperience Rate else; temp_value = 0; end text_value = (temp_value * 100).to_i current_value = (value * 100).to_i change_color(param_change_color(text_value - current_value)) if bonus_style text_value -= 100 text_value *= -1 if flipped if text_value > 0 sign = "+" text = sign + text_value.to_s + "%" elsif text_value == 0 text = "-- %" else text = text_value.to_s + "%" end else text = text_value.to_s + "%" end draw_text(x, y, width, line_height, text, 2) end #-------------------------------------------------------------------------- # --New Method-- # * Draw Post-Equipment Change Element Rate #-------------------------------------------------------------------------- def draw_new_element_rate(x, y, param_id, width = 40, bonus_style = true, flipped = true) text_value = (@temp_actor.element_rate(param_id) * 100).to_i current_value = (@actor.element_rate(param_id) * 100).to_i change_color(param_change_color(current_value - text_value)) if bonus_style text_value -= 100 text_value *= -1 if flipped if text_value > 0 sign = "+" text = sign + text_value.to_s + "%" elsif text_value == 0 text = "-- %" else text = text_value.to_s + "%" end else text = text_value.to_s + "%" end draw_text(x, y, width, line_height, text, 2) end #-------------------------------------------------------------------------- # --New Method-- # * Draw Post-Equipment Change State Rate #-------------------------------------------------------------------------- def draw_new_state_rate(x, y, param_id, width = 40, bonus_style = true, flipped = true) text_value = (@temp_actor.state_rate(param_id) * 100).to_i current_value = (@actor.state_rate(param_id) * 100).to_i text_value = 0 if @temp_actor.state_resist?(param_id) #--------------------------------------------- # This fun little section was necessary because of how I did Resist State. # Without this it would always make the resisted states the positive change # color, even when changing equipment that didn't add or remove a Resist # State feature. if @temp_actor.state_resist?(param_id) unless @actor.state_resist?(param_id) change_color(param_change_color(current_value - text_value)) else change_color(normal_color) end else change_color(param_change_color(current_value - text_value)) end #------------------------------------------- if bonus_style text_value -= 100 text_value *= -1 if flipped if text_value > 0 sign = "+" text = sign + text_value.to_s + "%" elsif text_value == 0 text = "-- %" else text = text_value.to_s + "%" end else text = text_value.to_s + "%" end draw_text(x, y, width, line_height, text, 2) endend #class Window_EquipStatus < Window_Base#==============================================================================# ** Window_EquipSlot#------------------------------------------------------------------------------# This window displays items the actor is currently equipped with on the# equipment screen.#==============================================================================class Window_EquipSlot < Window_Selectable #-------------------------------------------------------------------------- # --Overwrite Method-- # * Get Number of Lines to Show # The visible_line_number is used to calculate the window height. # The original was 5, so this made the window taller. #-------------------------------------------------------------------------- def visible_line_number return 6 end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Draw Item # Based off the default on except since the slot type and the actual equipped # are layered on top of each other, it will only draw the slot type if # there is nothing equipped. Also adds "Equip " before the slot name and # italicizes. That is the purpose of the if statement. In addition I changed # the 'draw_item_name' width by 24 (the icons size) because it had a tendency # to draw the name off the side of the window with longer names. #-------------------------------------------------------------------------- def draw_item(index) return unless @actor rect = item_rect_for_text(index) change_color(system_color, enable?(index)) if @actor.equips[index].nil? contents.font.italic = true name = "Unable to Equip" if @actor.equip_type_sealed?(index) name = "Equip " + slot_name(index) unless @actor.equip_type_sealed?(index) draw_text(rect.x, rect.y, rect.width, line_height, name, 1) contents.font.italic = false end draw_item_name(@actor.equips[index], rect.x, rect.y, enable?(index), rect.width - 24) endend #class Window_EquipSlot < Window_Selectable#==============================================================================# ** Window_EquipCommand_Vert#------------------------------------------------------------------------------# This window is for selecting commands (change equipment/ultimate equipment# etc.) on the equip screen, but vertical.#==============================================================================class Window_EquipCommand_Vert < Window_Command #-------------------------------------------------------------------------- # --Overwrite Method-- # * Object Initialization # This method and 'window_width' were done in this way to make the window # automatically resize, at least concerning width, with the status window. # The Scene will determine the width as you will see its math is based off # the status winow. #-------------------------------------------------------------------------- def initialize(x, y, width) @window_width = width super(x, y) end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Get Window Width #-------------------------------------------------------------------------- def window_width @window_width end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Get Number of Lines to Show # This is mostly for determining the height of the window. If you made it # one (1) all the commands would still work, you would just only be able to # see one at a time as you scrolled through them. #-------------------------------------------------------------------------- def visible_line_number return 3 end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Get Alignment # Just because I wanted the text to be centered. #-------------------------------------------------------------------------- def alignment return 1 end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Create Command List # By default in Window_Command, make_command_list is an empty method, so even # though it is an overwrite in kind of isn't, plus compatibility speaking, # window is my own unique thing, though someone else may use the exact name # for the class, so you may still want to watch out for that. # # As for the method itself, it is a copy of the default one for the equip # screen. A copy of add_command is below and commented out so you can see. # It is from Window_Command the Superclass of this window. # # As you can see these commands only use 2 of the 4 possible things you can # use. The name is what is displayed on the screen for the command, the symbol # is handled and used by the Scene class. Enabled and Ext aren't needed and # aren't used by this method and I don't know how to use them correctly myself # though enabled is a bit obvious, I'm not sure what the command to change it # is. #-------------------------------------------------------------------------- def make_command_list add_command(Vocab::equip2, :equip) add_command(Vocab::optimize, :optimize) add_command(Vocab::clear, :clear) end #-------------------------------------------------------------------------- # * Add Command # name : Command name # symbol : Corresponding symbol # enabled : Activation state flag # ext : Arbitrary extended data #--------------------------------------------------------------------------#~ def add_command(name, symbol, enabled = true, ext = nil)#~ @list.push({:name=>name, :symbol=>symbol, :enabled=>enabled, :ext=>ext})#~ endend #class Window_EquipCommand_Vert < Window_Command#==============================================================================# ** Scene_Equip#------------------------------------------------------------------------------# This class performs the equipment screen processing.# The changes here were necessary in order to move the windows around.#==============================================================================class Scene_Equip < Scene_MenuBase #-------------------------------------------------------------------------- # --Overwrite Method-- # * Create Status Window # The only change here was the x of the Window_EquipStatus, remember if you # change the 378 part you will need to change the window_width in the # Window_EquipStatus class, if you want things to still line up, because the # Command Window's and Slot Window's with are based off this windows width. #-------------------------------------------------------------------------- def create_status_window @status_window = Window_EquipStatus.new(Graphics.width - 378, @help_window.height) @status_window.viewport = @viewport @status_window.actor = @actor end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Create Command Window # The change here was the wx = 0 which use to be @status_window.width. # The other change was @command_window = Window_EquipCommand_Vert because # I wanted to use that window instead of the default Window_EquipCommand. # # I mentioned in the make_command_list method above that the Scene handled # the symbol, that is utilized in the lines '@command_window.set_handler' # (symbol, method that is called done as a symbol) kind of confusing, but if you # look in the default Scene_Equip you will see the top three methods defined, # Scene_Base for :return_scene, and Scene_MenuBase for the last two. #-------------------------------------------------------------------------- def create_command_window wx = 0 wy = @help_window.height ww = Graphics.width - @status_window.width @command_window = Window_EquipCommand_Vert.new(wx, wy, ww) @command_window.viewport = @viewport @command_window.help_window = @help_window @command_window.set_handler:)equip, method:)command_equip)) @command_window.set_handler:)optimize, method:)command_optimize)) @command_window.set_handler:)clear, method:)command_clear)) @command_window.set_handler:)cancel, method:)return_scene)) @command_window.set_handler:)pagedown, method:)next_actor)) @command_window.set_handler:)pageup, method:)prev_actor)) end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Create Slot Window # The change here was the wx = 0 which use to be @status_window.width. #-------------------------------------------------------------------------- def create_slot_window wx = 0 wy = @command_window.y + @command_window.height ww = Graphics.width - @status_window.width @slot_window = Window_EquipSlot.new(wx, wy, ww) @slot_window.viewport = @viewport @slot_window.help_window = @help_window @slot_window.status_window = @status_window @slot_window.actor = @actor @slot_window.set_handler:)ok, method:)on_slot_ok)) @slot_window.set_handler:)cancel, method:)on_slot_cancel)) end end #class Scene_Equip < Scene_MenuBase 

Menu Status Script

Images



Menu Status Screen with 3 party members



Menu Status Screen with 6 party members



Menu Status Screen with 8 or more party members
=beginTIBB's Menu Staus Screenby The Infamous Bon BonFree to use commercially or non-commercially with creditRequired Scripts: TIBB's Vocab Module and TIBB's Window_Base Add-Ons It has been modified to scale with party size, include TP and draw the actors character sprite instead of face. The actor information was slimmed down so up to 8 can be seen on the screen, especially useful for games with large battle parties or if you don't use face graphics. Include at the top is 'max_battle_members' so you can change it and see how the 'enabled' (explained further down) works.=endclass Game_Party < Game_Unit #-------------------------------------------------------------------------- # --Overwrite Method-- # * Get Maximum Number of Battle Members # No difference unless you change it from 4 to something else #-------------------------------------------------------------------------- def max_battle_members return 4 endend #class Game_Party < Game_Unit#==============================================================================# ** Window_MenuStatus#------------------------------------------------------------------------------# This window displays party member status on the menu screen.#==============================================================================class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # --Overwrite Method-- # * Get Item Height # The default method used the formula at the bottom except with 4 instead or # item_num. What I wanted was the spacing to adjust based on how many # party members there actually is, but with anymore than 8 party members # even my slimmed down version would cause them to overlap, thus the need for # the if statement to determine what item_num would be. #-------------------------------------------------------------------------- def item_height if $game_party.members.size <= 8 item_num = $game_party.members.size else item_num = 8 end (height - standard_padding * 2) / item_num end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Draw Item # Here all I did was remove draw_actor_face #-------------------------------------------------------------------------- def draw_item(index) actor = $game_party.members[index] enabled = $game_party.battle_members.include?(actor) rect = item_rect(index) draw_item_background(index) draw_actor_basic_status(actor, rect.x, rect.y, enabled) end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Draw Simple Status # Although this is a Window_Base method, I overwrote the method just in this # window because I didn't want to change how Window_SkillStatus looked (it # uses draw_actor_basic_status) and also because I wanted to add an enabled # function to it, which could screw up and cause error in that script (not # for certain, I didn't try). # # Changes include adding the enabled to the def, changing font size, adding # 'draw_actor_graphic', and 'draw_actor_tp'(which I added to the Window_Base. #-------------------------------------------------------------------------- def draw_actor_basic_status(actor, x, y, enabled) contents.font.size = 20 y_mod = line_height draw_actor_graphic(actor, x + 32, y + 36, enabled) draw_actor_name(actor, x, y + y_mod + 4, 64) draw_actor_level(actor, x + 80, y) draw_actor_icons(actor, x + 306, y) draw_actor_class(actor, x + 80, y + y_mod, 64) draw_actor_hp(actor, x + 160, y) draw_actor_mp(actor, x + 160, y + y_mod - 2, 60) draw_actor_tp(actor, x + 224, y + y_mod - 2, 60) end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Draw Name # The only change was making the alignment center in the 'draw_text' line #-------------------------------------------------------------------------- def draw_actor_name(actor, x, y, width = 112) change_color(hp_color(actor)) draw_text(x, y, width, line_height, actor.name, 1) end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Draw State and Buff/Debuff Icons # Basically I modified the 'icons.each_with_index do' statement to draw the # first two states (0 and 1 aka the two with the highest priority) to draw # on one line and the next two to draw on the line below. #-------------------------------------------------------------------------- def draw_actor_icons(actor, x, y, width = 96) icons = (actor.state_icons + actor.buff_icons)[0, width / 24] icons.each_with_index do |n, i| if i < 2 draw_icon(n, x + 25 * i, y) else draw_icon(n, x + 25 * (i - 2), y + line_height) end end end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Draw Actor Walking Graphic # Added enabled to the def and the method. #-------------------------------------------------------------------------- def draw_actor_graphic(actor, x, y, enabled) draw_character(actor.character_name, actor.character_index, x, y, enabled) end #-------------------------------------------------------------------------- # --Overwrite Method-- # * Draw Character Graphic # Added enabled to the def and 'enabled ? 255 : translucent_alpha' which # added to the 'content.blt' opacity setting, an optional setting for bitmaps. # Its a simple if else statement where if enabled is true it sets it to 255 # (the default) and if false it sets it to the translucent_alpha which is # defined in the default Window_Base as 160. #-------------------------------------------------------------------------- def draw_character(character_name, character_index, x, y, enabled) return unless character_name bitmap = Cache.character(character_name) sign = character_name[/^[\!\$]./] if sign && sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : translucent_alpha) endend #class Window_MenuStatus < Window_Selectable 


Part III in the next post.

 ​

If anyone notices any mistakes either in the scripts or incorrect terminology, please let me know and I will correct.

I am not a master scripter by any means so I may be wrong about some things.

All scripts and eventing system are free for use in commercial and non-commercial projects as long as credit is provided.

I would like to thank Fomar0153 for encouraging me to learn to script with the way he made his scripts and tutorials, also I want to thank Yanfly for making so many scripts that I felt the need to look through and providing so many wonderful examples.
 
Last edited by a moderator:

The Infamous Bon Bon

Executive Geek
Veteran
Joined
Mar 13, 2012
Messages
850
Reaction score
409
First Language
English
Primarily Uses
Part III​
[SIZE=10.5pt]Well it just wouldn't be one of my tutorials without some eventing mixed in, so here I have made a window for an event system called Mood.  The event system is really only made for the three characters, but could certainly be expanded if one desired.  It's not that complicated, so just check it out in the project.  The script itself includes some new concepts and such, so it's worth checking out.[/SIZE]

[SIZE=10.5pt]The Event System Window Script[/SIZE]
 ​
Images



Mood Screen with 3 party members



Mood Screen with 6 party members



Mood Screen with 8 or more party members
Code:
=beginTIBB's Mood Event Screenby The Infamous Bon BonFree to use commercially or non-commercially with credit (this includes the  script and the event system)Required Scripts:  TIBB's Vocab Module and TIBB's Window_Base Add-Ons  This is used to display information in conjunction with an eventing system,  called Mood.  The actor's mood will determine how other character react to  them and can be expanded depending on the creators imagination and eventing  abilities.  I used the variables exactly 100 more than the actors id, to make eventing  easier.  If you want to use different variables the you will need to change  the variables that are used in the refresh.=end#==============================================================================# ** Window_Mood#------------------------------------------------------------------------------#  This window displays the Mood screen.#==============================================================================class Window_Mood < Window_Selectable  #--------------------------------------------------------------------------  # * Object Initialization  # Just for fun I added a new line that makes it use a different image for  # the windowskin, it can be removed.  #  # I've also intialized the variable @ln.  I initialized it to 1 because it  # used for building the window, and I want the information to start on the  # second line, so there is space for the title of the window.  One (1) gets  # added to @ln each time a line is drawn and since @ln is part of the formula  # determining the y position of the line, it will result in the line  # displaying correctly, see Refresh below.  #--------------------------------------------------------------------------  def initialize    super(Graphics.width/4, line_height, Graphics.width/2, window_height)    self.windowskin = Cache.system("Window2")#new line.  Not necessary.    @ln = 1    refresh    activate  end  #--------------------------------------------------------------------------  # * Get Window Height  # Used to determine the height of the window.  The size changes depending  # on the visible_line_number.  #--------------------------------------------------------------------------  def window_height    fitting_height(visible_line_number)  end  #--------------------------------------------------------------------------  # * Get Number of Lines to Show  # This changes depending on how many people are in the party with one added  # for the title of the window.  #--------------------------------------------------------------------------  def visible_line_number    total = ($game_party.members.size + 1)    return total  end  #--------------------------------------------------------------------------  # * Refresh  # I assigned some local variables (st_p, gpmem, gact, y_mod, and lw) to save  # space and ensure that each line was visible without scrolling right.  # The if statement for example is actually:  # if $game_party.members.include?$game_actors[1]  # which as you can see is quite long.  # By using the if statement and making the y positioning based on @ln, which  # is only added to when the line is actually drawn, the window will only  # draw the members that are actually in the party at the time.  #--------------------------------------------------------------------------  def refresh    contents.clear    st_p = standard_padding    draw_block_title(st_p, 0, "Mood", contents.width - st_p * 2)    gpmem = $game_party.members    gact = $game_actors    y_mod = line_height    lw = contents.width - st_p * 2    draw_variable_info(st_p, y_mod * @ln, 101, lw) if gpmem.include?gact[1]    draw_variable_info(st_p, y_mod * @ln, 102, lw) if gpmem.include?gact[2]    draw_variable_info(st_p, y_mod * @ln, 103, lw) if gpmem.include?gact[3]    draw_variable_info(st_p, y_mod * @ln, 104, lw) if gpmem.include?gact[4]    draw_variable_info(st_p, y_mod * @ln, 105, lw) if gpmem.include?gact[5]    draw_variable_info(st_p, y_mod * @ln, 106, lw) if gpmem.include?gact[6]    draw_variable_info(st_p, y_mod * @ln, 107, lw) if gpmem.include?gact[7]    draw_variable_info(st_p, y_mod * @ln, 108, lw) if gpmem.include?gact[8]    draw_variable_info(st_p, y_mod * @ln, 109, lw) if gpmem.include?gact[9]    draw_variable_info(st_p, y_mod * @ln, 110, lw) if gpmem.include?gact[10]  end  #--------------------------------------------------------------------------  # --Overwrite of New Method in Window_Base Add-Ons--  # Draw Variable Value  # This one has been changed to show how you can overwrite methods to make  # changes that only apply to one particular window.  # For this method the variable value is utilized in a case statement to  # determine the actor's mood.  A common event will be used to control the  # range, but just in case the else line is used to keep error from being  # thrown.  # Lastly we have @ln = @ln + 1 which is used by the refresh method to build  # the window.  #--------------------------------------------------------------------------      def draw_variable_value(x, y, vid, width)    change_color(normal_color)    value = $game_variables[vid]    case value    when -3; mood = "Irate"    when -2; mood = "Seething"    when -1; mood = "Vexed"    when  0; mood = "Indifferent"    when  1; mood = "Happy"    when  2; mood = "Cheerful"    when  3; mood = "Jovial"    else; mood = ""    end    draw_text(x, y, width, line_height, mood, 2)    @ln = @ln + 1  endend #class Window_Mood < Window_Selectable#==============================================================================# ** Scene_Mood#------------------------------------------------------------------------------#  This class performs the Mood Screen processing.#==============================================================================class Scene_Mood < Scene_MenuBase  #--------------------------------------------------------------------------  # --New Method--  # * Start Processing  # Based on Scene_Status (one of the most basic scenes).  Making it a subclass  # of Scene_MenuBase handles most things when it comes to windows, saving you  # time and reducing errors. 'super' is kind of like alias but it works when  # you are overwriting something from the super class - in this case  # Scene_MenuBase.  Then we set the @status_window to the Winow_Mood we created  # above and we include the handler so we can exit the scene correctly.  #--------------------------------------------------------------------------  def start    super    @status_window = Window_Mood.new    @status_window.set_handler(:cancel,   method(:return_scene))  endend #class Scene_Mood < Scene_MenuBase#==============================================================================# ** Window_MenuCommand#------------------------------------------------------------------------------#  This command window appears on the menu screen.# When adding a new menu command we have to make some additions to the# Window_MenuCommand as well.#==============================================================================class Window_MenuCommand < Window_Command  #--------------------------------------------------------------------------  # --Alias Method--  # * Add Original Commands to List  # When adding commands there are five places you can add the command (in order)  # add_main_commands  # add_formation_command  # add_original_commands  # add_save_command  # add_game_end_command  # original_commands is empty by default, so I decided to add it there  # add_command works like this: (name, symbol, enabled)  # (the name of the command as a string, the symbol that will be referenced by  # the scene - in this case create_command_window, the method that enables it -  # in this case main_commands_enabled which is defined in the default  # Window_MenuCommand)  #--------------------------------------------------------------------------  alias mood_add_original_commands add_original_commands  def add_original_commands    mood_add_original_commands    add_command("Mood", :mood, main_commands_enabled)  endend #class Window_MenuCommand < Window_Command#==============================================================================# ** Scene_Menu#------------------------------------------------------------------------------#  This class performs the menu screen processing.# When adding a new menu command we have to make some additions to the# Scene_Menu as well.#==============================================================================class Scene_Menu < Scene_MenuBase  #--------------------------------------------------------------------------  # --Alias Method--  # * Create Command Window  # An alias was definitely the best way to go on this, as the order is fairly  # irrelevant.  This just makes it so the scene knows which method to call  # when you select Mood.  #--------------------------------------------------------------------------  alias mood_create_command_window create_command_window  def create_command_window    mood_create_command_window    @command_window.set_handler(:mood,   method(:command_mood))  end  #--------------------------------------------------------------------------  #--New Method--  # * [Mood] Command  #Because Window_Mood is basic the method command_mood simply calls the  #Scene_Mood (it was modeled off command_item)  #--------------------------------------------------------------------------  def command_mood    SceneManager.call(Scene_Mood)  endend #class Scene_Menu < Scene_MenuBase
 
Last edited by a moderator:

huntersouls

Villager
Member
Joined
Aug 13, 2013
Messages
15
Reaction score
0
First Language
Portuguese
Primarily Uses
Thank you so much for the nice scripts!! I have a problem in event im wish equip a weapon from slot how i put a weapon in slot to in that event select that weapon?

example:. char star and 1 step event say " go check your equipment" and then auto open menu screen, but no weapon there.
 
Last edited by a moderator:

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,062
Reaction score
5,690
First Language
Indonesian
Primarily Uses
RMVXA
Fixed the vocab part in the part I spoiler
Code:
=begin
  TIBB's Vocab Module
  by The Infamous Bon Bon
  Free to use commercially or non-commercially with credit 
  
  So here we have a Vocab module I've created (This has the same name as the 
  standard Vocab module and simply adds to it). This script is necessary for 
  TIBB's Window_Base Add-Ons to work. Lets look at the first one for 
  X-Parameters: The def is self.xparam(xparam_id) and you refer to it with 
  Vocab.xparam(xparam_id) or Vocab::xparam(xparam_id) where xparam_id is a 
  number. Vocab:: must be used with constants like 'ShopBuy' in the default 
  Vocab module script. "self" referes to the Object (in this case it is module, 
  Window scripts are class) in which the def is found in, this one is Vocab of 
  course.
  
=end
module Vocab 
  #-------------------------------------------------------------------------- 
  # --New Method-- 
  # * Normal Parameters 
  # Added a return line to add Max TP to the normal parameters. You can use 
  # this method to add additional Normal Parameters like Fomar0153's Barehand 
  
  # for example. 
  # 'return' exits the method and returns the specified value, string, array,etc 
  # Since it exits the method we don't have to worry about what follows it 
  # throwing an error, which is why it is used. In this def it's a concern 
  # because param 8 doesn't actually exist in the System tab of the Database. 
  # On the return line we have 'if param_id == 8' at the end of the 
  # line. This allows you to have the if statement apply only to that line 
  # which is a nice space saver, note it doesn't require an end statement. 
  # Also note that if you want to ask if a value equals a specific amount you 
  # must use two equal signs. 
  #-------------------------------------------------------------------------- 
  def self.param(param_id) 
    return "MTP" if param_id == 8 
    #Max TP Maximum Tech Points $data_system.terms.params[param_id] 
  end 
  #-------------------------------------------------------------------------- 
  # --New Method-- 
  # * X-Parameters 
  # Here we need to give names to the X parameters because there is no other 
  # place to do so. The S parameters are the same way. 
  # Here we introduce case statements. They are similar to if statements. 
  # First establish the case - in this example it is the variable 'xparam_id'. 
  # Then we use 'when' and a value, followed by a line a code. 
  # In this one we also add a fun new space saver the ';' 
  # This ends the line. In the def below for example we have: 
  # when 0; "Hit" 
  # Without the ';' it would be written like this 
  # when 0 
  # "Hit" 
  # then any other when statements or end 
  # I've included 'return ""' in the else to prevent errors. This will make 
  # it essentially draws nothing. 
  #-------------------------------------------------------------------------- 
  def self.xparam(xparam_id) 
    case xparam_id 
    when 0; "Hit" 
      # HIT Hit Rate 
    when 1; "Evasion" 
      # EVA Evasion Rate 
    when 2; "Critical" 
      # CRI Critical Hit Rate 
    when 3; "Cri Eva" 
      # CEV Critical Evasion Rate 
    when 4; "Mag Eva" 
      # MEV Magic Evasion Rate 
    when 5; "Mag Ref" 
      # MRF Magic Relfection Rate 
    when 6; "Cnt Atk" 
      # CNT Counter Attack Rate 
    when 7; "HP Regen" 
      # HRG Hp Regeneration Rate 
    when 8; "MP Regen" 
      # MRG Mp Regeneration Rate 
    when 9; "TP Regen" 
      # TRG Tp Regeneration Rate 
    else; return ""; 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # --New Method-- 
  # * S-Parameters 
  #-------------------------------------------------------------------------- 
  def self.sparam(sparam_id) 
    case sparam_id 
    when 0; "Target" 
      # TGR TarGet Rate 
    when 1; "Guard" 
      # GRD GuaRD effect rate 
    when 2; "Recovery" 
      # REC RECovery effect rate 
    when 3; "Med Lore" 
      # PHA PHArmacology 
    when 4; "MP Cost" 
      # MCR Mp Cost Rate 
    when 5; "TP Charge" 
      # TCR Tp Charge Rate 
    when 6; "Phy Dmg" 
      # PDR Physical Damage Rate 
    when 7; "Mag Dmg" 
      # MDR Magical Damage Rate 
    when 8; "Floor Dmg" 
      # FDR Floor Damage Rate 
    when 9; "Exp Rate" 
      # EXR EXperience Rate 
    else; return ""; 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # --New Method-- 
  # * Elements 
  # most of these are defined in the database, but 0 and -1 are not and this 
  # method just ties it all together. It also shortens it and adds consistency. 
  #-------------------------------------------------------------------------- 
  def self.elements(element_id) 
    if element_id == -1; "User's Atk Element(s)" 
    elsif element_id == 0; "None" 
    else; $data_system.elements[element_id]; 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # --New Method-- 
  # * States 
  # The Skill Effect - Add State includes the option Normal State, that is the 
  # reason for the return line otherwise these are already defined and could 
  # simply be accessed with the line afterwards. This project won't use this, 
  # but a future one will. 
  #-------------------------------------------------------------------------- 
  def self.states(state_id) 
    return "User's Atk State(s)" if state_id == 0 $data_states[state_id].name 
  end 
  #-------------------------------------------------------------------------- 
  # --New Method-- 
  # * Skill Types 
  # The below already defined and the point of these was to add consistency and 
  # makes referencing them in scripts a bit shorter. 
  #-------------------------------------------------------------------------- 
  def self.stype(item_id); $data_system.skill_types[item_id]; end 
  #-------------------------------------------------------------------------- 
  # --New Method-- 
  # * Weapon Types 
  #-------------------------------------------------------------------------- 
  def self.wtype(item_id); $data_system.weapon_types[item_id]; end 
  #-------------------------------------------------------------------------- 
  # --New Method-- 
  # * Armor Types 
  #-------------------------------------------------------------------------- 
  def self.atype(item_id); $data_system.armor_types[item_id]; end
end # module Vocab
The comment could be better. Not going to promise to fix the others.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Stream will be live shortly with some pixel art! Feel free to drop by!

Can't believe I forgot to put an image of my drawing pad! It looks kinda like this, maybe I'll get a better pic tomorrow...
Backup tip: If you don't want to back up your whole project every day, at least back up everything *except* your Image and Audio folders, which you can do weekly/as needed/etc.
The final version of our game is already available both in English and Spanish! ^___^
Can't believe this day has finally come... T_T
Im so happy that Dead By Daylight is getting a Silent Hill chapter! Cant wait to play as pyramid head

Forum statistics

Threads
97,814
Messages
947,149
Members
129,035
Latest member
Tauron7
Top