Jump to content
Dalhan

Modifying Main Menu Elements/Backgrounds

Recommended Posts

well, you can't do that since drawing an icon via the default menu command throws you an error of a disposed sprite. So, you need to make a new menu that inherits from Window_Base, so you can then create icons using:

draw_icon(icon_index, x, y, enabled = true)

Share this post


Link to post
Share on other sites

The selector. Is there a way to change it so that an image is used instead of the system window sprite sheet for the default? 

Share this post


Link to post
Share on other sites

Yes. You need to change it using the sprite class.

Share this post


Link to post
Share on other sites

Modifying the equipment screen currently. Do you know what player evasion and crit chance rating is referenced as in regards to adding in the equipment information?

Share this post


Link to post
Share on other sites

for a skill or item:

  #--------------------------------------------------------------------------
  # * Calculate Critical Rate of Skill/Item
  #--------------------------------------------------------------------------
  def item_cri(user, item)
    item.damage.critical ? user.cri * (1 - cev) : 0
  end

for rates:

  #--------------------------------------------------------------------------
  # * Calculate Hit Rate of Skill/Item
  #--------------------------------------------------------------------------
  def item_hit(user, item)
    rate = item.success_rate * 0.01     # Get success rate
    rate *= user.hit if item.physical?  # Physical attack: Multiply hit rate
    return rate                         # Return calculated hit rate
  end
  #--------------------------------------------------------------------------
  # * Calculate Evasion Rate for Skill/Item
  #--------------------------------------------------------------------------
  def item_eva(user, item)
    return eva if item.physical?    # Return evasion if physical attack
    return mev if item.magical?     # Return magic evasion if magic attack
    return 0
  end

most of the damage calculations are located under game battler.

Share this post


Link to post
Share on other sites

Working with the Yanfly equip script at the moment. The code doesn't leave much room for manipulations, other than basic variables being changed which is annoying. I have managed to tack on the Crit, Evasion, Hit onto the bottom of the screen. (Combination of changes to a similar code), but it's overlapping and not the same formatting. I could just move it around until it's in the right place/format but it seems a little dodgey to me :S

 

I'd like to hold onto the Yanfly scripts, as they work well with each other (and I intend to use the side battler script). 

 

Do you know how to modify the Yanfly Equip to fix this little debarcle?

 

LatestScreen_zpsff89e077.png

Share this post


Link to post
Share on other sites

which one do you need to fix? the overlapping text? You can reposition it if you want (look at the draw method for each of them).

Share this post


Link to post
Share on other sites

Yeah, the overlapping. But I'd rather make changes to the Yanfly script. Well, maybe not the script itself. But add those Params into the automated display process and change the opacity of the windows. Should I perhaps make a new thread for this topic, since it's modifying an existing script?

Share this post


Link to post
Share on other sites

I keep coming across this param and param_id in the scripts but can't find the arrays. Some where, there's a list that's like "Display HP, MP, STR, AGL... etc"... After searching the forums and the script editor, others have had the same issue. So where is this list of params???

  #--------------------------------------------------------------------------  
  # * Draw Parameter Name
  #--------------------------------------------------------------------------
  def draw_param_name(x, y, param_id)
    change_color(system_color)
    draw_text(x, y, 80, line_height, Vocab::param(param_id))
  end

Share this post


Link to post
Share on other sites


#--------------------------------------------------------------------------

# * Draw Parameters

#--------------------------------------------------------------------------

def draw_parameters(x, y)

6.times {|i| draw_actor_param(@actor, x, y + line_height * i, i + 2) }

end

Share this post


Link to post
Share on other sites

I just realised I was looking for the x params. The Yanfly Script doesn't use those, it just uses the standard param attributes. I wish I picked up on that before. I'll need to add my own attachment to the Yanfly script which picks out each ID as I need it. 

Share this post


Link to post
Share on other sites

Trying to find which method references the information bar that sits at the top of the screen. I noticed it's used in the spells section as well, so it's a re-used method. But which one?

Share this post


Link to post
Share on other sites

which window? The Window Status? Or do you mean the help window?

Share this post


Link to post
Share on other sites

Ah, Window_Help. It doesn't appear to have an Equip specific method. Just one thats used universally. 

Share this post


Link to post
Share on other sites

Yes, but you can modify it via the window you're working on.

Share this post


Link to post
Share on other sites

I'm not following how you'd do that. With most windows, you simply reference the class and then fiddle with which method is being used. But the help_window is used by two other scenes. So how do you isolate it into the equip scene?

 

 

I'm just not sure how you go about being scene specific with widows like that :x

Edited by Dalhan

Share this post


Link to post
Share on other sites

No. Seeing that Window_Help < Window_Base, you'll just need to follow that rule. The first thing you need to do is to copy the whole Help window.

 

i.e.

 

 

 

class Window_Help_Equip < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(line_number = 2)
    super(0, 0, Graphics.width, fitting_height(line_number))
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #--------------------------------------------------------------------------
  def set_text(text)
    if text != @text
      @text = text
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Clear
  #--------------------------------------------------------------------------
  def clear
    set_text("")
  end
  #--------------------------------------------------------------------------
  # * Set Item
  #     item : Skills and items etc.
  #--------------------------------------------------------------------------
  def set_item(item)
    set_text(item ? item.description : "")
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_text_ex(4, 0, @text)
  end
end
 

 

 

 

That is where you're going to place into your Scene Equip or call.

 

i.e.

@help_window = Window_Help_Equip.new

You can also add more to your Window_Help_Equip actually, as long as its inside Window_Base.

Share this post


Link to post
Share on other sites

Currently attempting to display some information on players experience. I'm having trouble getting it to display :/

class Window_MenuStatus < Window_Selectable    
  def draw_exp_info(x, y)
    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 + line_height * 0, 180, line_height, Vocab::ExpTotal)
    draw_text(x, y + line_height * 2, 180, line_height, s_next)
    change_color(normal_color)
    draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
    draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
  end
end

Is it being displayed but off screen or something?

Share this post


Link to post
Share on other sites

The reason why it does not display anything is because you only created the method draw_exp_info and is not drawing it in actual in the draw_item method of the Window_MenuStatus. But by doing so, it would throw you an error, since it does not recognize @actor and all its contents such as max level and such.

Share this post


Link to post
Share on other sites

Okay, I think I went the wrong route here, as I see what you mean about the @actor being an error. I'm trying to obtain a variable int that I don't have access to. How do you display this? 

Share this post


Link to post
Share on other sites

You have to create a public instance variable on Game Actor to read the actor id. For example, since all of them is getting their inheritance to Window_Base, it is also correct to say that you can adopt the drawing methods from Window Status. Therefore, you can do:

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables (Showing Actor)
  #--------------------------------------------------------------------------  
  attr_reader :actor_id
end

This for example, would get the actor's id. You'll have to modify this a bit from the Window_MenuStatus.

Share this post


Link to post
Share on other sites

Okay, managed to get it working. Is there a way to reduce the size of text? I have a line below as an example. I don't believe any of the variables displayed actually reduce / increase it's overall size. 

draw_text(x - 225, y + 285, 30, line_height, "EXP")

Share this post


Link to post
Share on other sites

The draw_text method was easy enough to figure out. You just dump your arguments in and then it'll write the text. But with the text_size, it's not as clear. 
 

  #--------------------------------------------------------------------------
  # * Draw Text
  #     args : Same as Bitmap#draw_text.
  #--------------------------------------------------------------------------
  def draw_text(*args)
    contents.draw_text(*args)
  end
  #--------------------------------------------------------------------------
  # * Get Text Size
  #--------------------------------------------------------------------------
  def text_size(str)
    contents.text_size(str)
  end

Am I supposed to do something like

 text_size(draw_text(*args)) = 20

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted