Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[XP] Custom Menu Help (Equipment/Item/Skill Isolation)

Hey guys, it's me again.

I'm working on a custom menu system (based on a Chrono Trigger ring menu script I have by Raziel) still and I've come across another question. I'm trying to skip some steps in the equipment window. I want to be able to choose weapon, shield, armor, ect. from a menu that's not the actually equipment window. (so the main menu for example). I've been looking and trying to isolate the right bit of code for it, but I haven't been able to find what I need. Any help would be awesome!

thanks,
~X
 
Not sure what you're looking for exactly, but this should help (assuming you work on XP, which you foolishly didn't state):

Window_EquipLeft - window on the upper left in Scene_Equip, showing stat differences between equips
Window_EquipRight - window on the upper right, showing currently equipped equips along with their slot tags
Window_Equip - selection window for equips to equip
Scene_Equip - handles the processing of all of the above (if you're working on a CMS, I assume you know the responsibilities of the initialize, update and whatnot methods)

Shouldn't be too different for VX.
 
Ah yes, this is RMXP. I can't believe I forgot to mention that. :P

What I'm looking for is actually what's inside the Window_EquipRight I believe. I'm looking to isolate just the right hand equip, or the left hand equip, or the helmet, ect...

A little more background on what I"m doing...I'm working with a ring menu to create a custom in-battle system so that when you are in battle (using the XAS) this special menu appears and provides just certain choices of what you can adjust at that time. Things like the Weapon you currently hold or the item. So while I have this topic open, I guess I'll expand it to all three isolation questions.

1. The Equipment Window - I'm looking to isolate the 5 different parameters all based inside the Window_EquipRight script. I need to skip that window entirely and depending on which menu choice you choose (between Weapon, Shield, Armor, Helmet, Pendant). I have the menu set up to handle the code for it so far (it's a little messy but it works smoothly) I just need the lines to input a selection for adjusting weapon armor and such...
Alright, I'm finding this a little hard to sound clear to myself so a picture to help explain. :)

MenuWIP3c.jpg


As you can see, it has a ring menu style but already has the options for sword, armor ect, I need to know how to, when I select those choices, allow the player to change the item equipped. I will be making a new version of the Window_Equip window for selecting the item, I just don't know how to call it for a certain equip type. (Hope that makes better sense)

2. Skill Separation Script - So this is still to come (I'm more working on getting equipment settings done first.) I want the menu to look kind of like the previously shown ring menu but for skills. The trick is that I need a way to classify them into groups. Even if it's creating an array with the skill ID numbers from the database. Just someway so that I can split them up into groups like "Healing Spells, Offense Spells, Defense Spells" or something along those lines.

3. Item Separation Script - Same as the Skill thing as above. I'm just looking to find a way to separate the items into different groups and then call just that group of items for when you select that option from the menu. :)

Thanks for any help I get, and sorry for the length. I'm really just learning scripting as I go through this by trial and error and any help I get really makes the process go faster. :)

~uSX

EDIT: alright, one more quick thing (this one is easy, I promise :smile: ) Anyways, How do I change the font for just one thing? Such as the text in like a certain window like Window_Help (just for an example I don't really need to change the font there but it makes for a good reference) Thanks!
 
Any tips? I've still been searching but I haven't been able to isolate the snippet of code I need...

The code I'm using is as follows.
Ruby:
 

class Window_NewEquip < Window_Selectable

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

  # * Object Initialization

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

  def initialize

    super(300, 20, 350, 450)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.index = 0

    self.active = false

    self.opacity = 0

    @item_max = 5

    @old_index = $game_temp.cms_index

    refresh

  end

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

  # * Item Acquisition

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

  def item

    return @data[self.index]

  end

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

  # * Refresh

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

  def refresh

    self.contents.clear

    self.contents.font.size = 18

    self.contents.font.bold = true

    @actor = $game_party.actors[$game_temp.cms_index]

    self.contents.draw_text(164, 10, 100, 32, @actor.name)

    draw_actor_state(@actor, 164, 42)

    self.contents.draw_text(164, 74, 100, 32, "LV #{@actor.level}")

    self.contents.blt(20,20,RPG::Cache.picture("Faces/" + @actor.character_name), Rect.new(0,0,100,100))

    @data = []

    @data.push($data_weapons[@actor.weapon_id])

    @data.push($data_armors[@actor.armor1_id])

    @data.push($data_armors[@actor.armor2_id])

    @data.push($data_armors[@actor.armor3_id])

    @data.push($data_armors[@actor.armor4_id])

    @item_max = @data.size

    self.contents.font.color = system_color

    y = 115

    self.contents.draw_text(14, 25 * 0 + y, 92, 32, $data_system.words.weapon)

    self.contents.draw_text(14, 25 * 1 + y, 92, 32, $data_system.words.armor1)

    self.contents.draw_text(14, 25 * 2 + y, 92, 32, $data_system.words.armor2)

    self.contents.draw_text(14, 25 * 3 + y, 92, 32, $data_system.words.armor3)

    self.contents.draw_text(15, 25 * 4 + y, 92, 32, $data_system.words.armor4)

    draw_item_name(@data[0], 110, 25 * 0 + y)

    draw_item_name(@data[1], 110, 25 * 1 + y)

    draw_item_name(@data[2], 110, 25 * 2 + y)

    draw_item_name(@data[3], 110, 25 * 3 + y)

    draw_item_name(@data[4], 110, 25 * 4 + y)

    self.contents.font.color = normal_color

    self.contents.draw_text(14, 250, 500, 32, $data_system.words.str)

    self.contents.draw_text(14, 270, 500, 32, $data_system.words.atk)

    self.contents.draw_text(14, 290, 500, 32, $data_system.words.int)

    self.contents.draw_text(14, 310, 500, 32, $data_system.words.dex)

    self.contents.draw_text(144, 250, 500, 32, $data_system.words.agi)

    self.contents.draw_text(144, 270, 500, 32, $data_system.words.pdef)

    self.contents.draw_text(144, 290, 500, 32, $data_system.words.mdef)

    up_color = Color.new(60, 255, 255)

    str = @actor.str.to_s

    if @new_str != nil

      str = @new_str.to_s

      @actor.str == @new_str ? self.contents.font.color = normal_color : @actor.str < @new_str ? 

      self.contents.font.color = up_color : self.contents.font.color = disabled_color

    end

    self.contents.draw_text(25, 250, 100, 32, str, 2)

    atk = @actor.atk.to_s

    if @new_atk != nil

      atk = @new_atk.to_s

      @actor.atk == @new_atk ? self.contents.font.color = normal_color : @actor.atk < @new_atk ? 

      self.contents.font.color = up_color : self.contents.font.color = disabled_color

    end

    self.contents.draw_text(25, 270, 100, 32, atk, 2)

    int = @actor.int.to_s

    if @new_int != nil

      int = @new_int.to_s

      @actor.int == @new_int ? self.contents.font.color = normal_color : @actor.int < @new_int ? 

      self.contents.font.color = up_color : self.contents.font.color = disabled_color

    end

    self.contents.draw_text(25, 290, 100, 32, int, 2)

    agi = @actor.agi.to_s

    if @new_agi != nil

      agi = @new_agi.to_s

      @actor.agi == @new_agi ? self.contents.font.color = normal_color : @actor.agi < @new_agi ? 

      self.contents.font.color = up_color : self.contents.font.color = disabled_color

    end

    self.contents.draw_text(160, 250, 100, 32, agi, 2)

    pdef = @actor.pdef.to_s

    if @new_pdef != nil

      pdef = @new_pdef.to_s

      @actor.pdef == @new_pdef ? self.contents.font.color = normal_color : @actor.pdef < @new_pdef ? 

      self.contents.font.color = up_color : self.contents.font.color = disabled_color

    end

    self.contents.draw_text(160, 270, 100, 32, pdef, 2)

    mdef = @actor.mdef.to_s

    if @new_mdef != nil

      mdef = @new_mdef.to_s

      @actor.mdef == @new_mdef ? self.contents.font.color = normal_color : @actor.mdef < @new_mdef ? 

      self.contents.font.color = up_color : self.contents.font.color = disabled_color

    end

    self.contents.draw_text(160, 290, 100, 32, mdef, 2)

    dex = @actor.dex.to_s

    if @new_mdef != nil

      dex = @new_dex.to_s

      @actor.dex == @new_dex ? self.contents.font.color = normal_color : @actor.dex < @new_dex ? 

      self.contents.font.color = up_color : self.contents.font.color = disabled_color

    end

    self.contents.draw_text(160, 310, 100, 32, dex, 2)

    self.contents.font.color = normal_color

    self.contents.draw_text(14, 353, 500, 32, "EXP")

    self.contents.draw_text(14, 370, 500, 32, "NEXT")

    self.contents.draw_text(14, 353, 240, 32, "#{@actor.exp}",2)

    self.contents.draw_text(14, 370, 240, 32, "#{@actor.next_exp}",2)

  end

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

  # * Set parameters after changing equipment

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

  def set_new_parameters(new_str, new_atk, new_int, new_agi, new_pdef, new_mdef, new_dex)

    if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or

      @new_str != new_str or @new_int != new_int or @new_agi != new_agi or @new_dex != new_dex

      @new_str = new_str

      @new_atk = new_atk

      @new_int = new_int

      @new_agi = new_agi

      @new_pdef = new_pdef

      @new_mdef = new_mdef

      @new_dex = new_dex

      refresh

    end

  end

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

  # * Cursor Rectangle Update

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

  def update_cursor_rect

    if @index < 0

      self.cursor_rect.empty

    else

      self.cursor_rect.set(14, @index * 25 + 115, 0, 0)

    end

  end

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

  # * Update

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

  def update

    super

    if @old_index != $game_temp.cms_index

      refresh

      @old_index = $game_temp.cms_index

    end

  end

end

That's my whole Window_NewEquip script that's inside my CMS, and the code I'm using to call this is as follows
Ruby:
 

def update_commandequip

    case @command_windowequip.index

    when 0 # Weapon

     ###

    when 1 # Shield

     ###

    when 2 # Helmet

     ###

    when 3 # Armor

     ###

    when 4 # Pendant

     ###      

    when 5

     ### 

   end

   

    # If DOWN button was pressed

    if Input.trigger?(Input::DOWN)

      # Play cancel SE

      $game_system.se_play($data_system.cancel_se)

      # Back to Command Window

      @command_windowequip.visible = false

      @command_windowequip.active = false

      @command_window.visible = true

      @command_window.active = true

      return

    end

    # If UP button was pressed

    if Input.trigger?(Input::UP)

      #@playtime_background.visible = false

      #@playtime_window.visible = false

      # Branch by command window cursor position

      case @command_windowequip.index

      when 0  # Sword

       ###

        @new_equip.visible = true

        @new_equip.active = true

        @command_windowequip.active = false

        @command_windowequip.visible = false

      when 1  # Shield

       ###

      when 2  # Helmet

       ###

      when 3 # Armor

       ###

      when 4 # Pendant

       ###

      when 5

      end

      return

    end

    return if @command_windowequip.animation?

    if Input.press?(Input::LEFT) #Input.press?(Input::UP) or 

      $game_system.se_play($data_system.cursor_se)

      @command_windowequip.setup_move_move(Window_RingMenuEquip::MODE_MOVEL)

      return

    end

    if Input.press?(Input::RIGHT) #Input.press?(Input::DOWN) or 

      $game_system.se_play($data_system.cursor_se)

      @command_windowequip.setup_move_move(Window_RingMenuEquip::MODE_MOVER)

      return

    end

  end

I've done some commenting out of things and I just have ## symbols where I don't have code yet so I don't get errors. Any help??

Thanks,
~uSX
 
I think its not that hard.

In my custom hability script i also use groups of items, skills, equipment divided in arrays.

Restore_items = [1,3,6]

If you want a improvement you can use the item/skill/equip description to select the group. I was planning to use some type of code:

Potion
c: Recovers 250 PV.

EDIT: alright, one more quick thing (this one is easy, I promise :smile: ) Anyways, How do I change the font for just one thing? Such as the text in like a certain window like Window_Help (just for an example I don't really need to change the font there but it makes for a good reference) Thanks!

When you create a new bitmap or window it comes with the default one. If you changue the font of a window it will only be changued in that window or bitmap. You only have to call before drawing the text:

self.contents.font = new atributes(for windws)

As you can see, it has a ring menu style but already has the options for sword, armor ect, I need to know how to, when I select those choices, allow the player to change the item equipped. I will be making a new version of the Window_Equip window for selecting the item, I just don't know how to call it for a certain equip type. (Hope that makes better sense)

Idea:

Create a method in the equip window called 'activation' or like this, that accept two parameters that will be the equipment type and actor id. You can skip the actor id if you can know accessing to the scene what battler is active.
The equip window will have a variable called type that will be settled everytime that you call the activation method.

In that method you can also make the window active and visible. Then, refresh.

The refresh method have to be modified to check for adding to the list the items you want based on the type variable.

Skill separation and item: are the same. You pass the type argument, and then when adding items to the list you have to check in the arrays or hashes and compare to the type value.

I just need the lines to input a selection for adjusting weapon armor and such...

You have to study equip method of game actor. Its pretty easy anyway.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top