Full Body Equip

● ARCHIVED · READ-ONLY
Started by InfinateX 5 posts View original ↗
  1. Hello there. A long time ago I started trying to write my first ever script. I didn't do to good. I watch some tutorials on youtube and read about RGSS2, and I got a little farther. Shortly after I had stopped using the engine completely, so I stopped writing the code. Now that I've started again, I'd like to finish, but there are still some problems I can't quite figure out. If anybody would be willing to help, I'd be grateful.

    This right here is a picture from my script:

    Spoiler
    Every thing looks good. Fully functional. Et cetera. No. While I've managed to get the Window working for asthetic purposes, the 5 new equip types can not be selected by the cursor. I can't even hover over it. I could probably figure this part out on my own, but I'm unsure as to how I can create my new equip types. I'm thinknig it would either be a few arrays (one for each equip type) or note box tags. I just need to learn how to create them.

    Core/Setup (126 Lines)

    Spoiler
    Code:
     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~​​​
    #------------------------------------------------------------------------------
    # Full Body Equipment v0.2
    # Written By: InfinateX
    # Thanks To: Blizzard, Pacman, ???nOBodY???, and HungrySnake
    #
    # Description:
    # Full Body Equipment allows you, the user, to add more types of armor to your
    # game. You can add up to five new equip types with this script. It is unknown
    # whether this script is compatable with any scripts that alter the defualt
    # equip scene, but it is assumed to be incompatable due to the fact that it
    # near completely alters the defualt equip scene.
    #
    # Installation:
    # Plug n' Play
    #------------------------------------------------------------------------------
    # Editable Region
    #------------------------------------------------------------------------------
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    #Set the names of the new armor types below. You can set up between 1 to 5 new
    #equip slots here by writing their names in this array.
    ExtraEquipmentSlots = ["Leggings", "Gauntlets", "Boots", "Ring"]
    
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #------------------------------------------------------------------------------
    # End Editable Region
    #------------------------------------------------------------------------------
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~​​​
    
    #DO NOT ALTER BELOW UNLESS YOU KNOW MORE ABOUT CODE THAN I DO!!!!
    
    #==============================================================================
    # ** Game_NewEquip
    #------------------------------------------------------------------------------
    # This class is an extension of Game_Actor. It was made to allow for
    # functionality of the new equipment types.
    #==============================================================================
    
    class Game_NewEquip < Game_Actor
    
    SET_MAX_EQUIPS = 5 + ExtraEquipmentSlots.size
    $equiptypemax = SET_MAX_EQUIPS
    #--------------------------------------------------------------------------
    # * Public Instance Variables
    #--------------------------------------------------------------------------
    attr_reader :armor5_id	# Leg Armour ID
    attr_reader :armor6_id	# Gloves ID
    attr_reader :armor7_id	# Boots ID
    attr_reader :armor8_id	# Ring ID
    attr_reader :armor9_id	# Accesory 2 ID
    
    end
    #--------------------------------------------------------------------------
    # * Setup
    # actor_id : actor ID
    #--------------------------------------------------------------------------
    def setup(actor_id)
    actor = $data_actors[actor_id]
    @armor5_id = actor.armor5_id
    @armor6_id = actor.armor6_id
    @armor7_id = actor.armor7_id
    @armor8_id = actor.armor8_id
    @armor9_id = actor.armor9_id
    end
    #Below is the means of converting the writen word in the script into writen
    #word in the game.
    $armor5name = ExtraEquipmentSlots[0] if ExtraEquipmentSlots.size > 0
    $armor6name = ExtraEquipmentSlots[1] if ExtraEquipmentSlots.size > 1
    $armor7name = ExtraEquipmentSlots[2] if ExtraEquipmentSlots.size > 2
    $armor8name = ExtraEquipmentSlots[3] if ExtraEquipmentSlots.size > 3
    $armor9name = ExtraEquipmentSlots[4] if ExtraEquipmentSlots.size > 4
    #--------------------------------------------------------------------------
    # * Get Armor Object Array
    #--------------------------------------------------------------------------
    def armors
    result = []
    result.push($data_armors[@armor5_id]) if ExtraEquipmentSlots.size > 0
    result.push($data_armors[@armor6_id]) if ExtraEquipmentSlots.size > 1
    result.push($data_armors[@armor7_id]) if ExtraEquipmentSlots.size > 2
    result.push($data_armors[@armor8_id]) if ExtraEquipmentSlots.size > 3
    result.push($data_armors[@armor9_id]) if ExtraEquipmentSlots.size > 4
    end
    #--------------------------------------------------------------------------
    # * Change Equipment (designate object)
    # equip_type : Equip region (0..4)
    # item : Weapon or armor (nil is used to unequip)
    # test : Test flag (for battle test or temporary equipment)
    #--------------------------------------------------------------------------
    def change_equip(equip_type, item, test = false)
    last_item = equips[equip_type]
    unless test
    return if $game_party.item_number(item) == 0 if item != nil
    $game_party.gain_item(last_item, 1)
    $game_party.lose_item(item, 1)
    end
    item_id = item == nil ? 0 : item.id
    case equip_type
    when 5
    @armor5_id = item_id
    when 6
    @armor6_id = item_id
    when 7
    @armor7_id = item_id
    when 8
    @armor8_id = item_id
    when 9
    @armor9_id = item_id
    end
    end
    #--------------------------------------------------------------------------
    # * Discard Equipment
    # item : Weapon or armor to be discarded.
    # Used when the "Include Equipment" option is enabled.
    #--------------------------------------------------------------------------
    def discard_equip(item)
    if @armor5_id == item.id
    @armor5_id = 0
    elsif @armor6_id == item.id
    @armor6_id = 0
    elsif @armor7_id == item.id
    @armor7_id = 0
    elsif @armor8_id == item.id
    @armor8_id = 0
    elsif @armor9_id == item.id
    @armor9_id = 0
    end
    end
    Window (218 Lines)

    Spoiler
    Code:
     #==============================================================================
    # Full Body Equip - Window
    #------------------------------------------------------------------------------
    # This is a rewrite of the equip window script to allow compatibility with the
    # added equip types.
    #==============================================================================
    
    #==============================================================================
    # Part 1
    #==============================================================================
    # ** Window_Equip
    #------------------------------------------------------------------------------
    # This window displays items the actor is currently equipped with on the
    # equipment screen.
    #==============================================================================
    
    class Window_Equip < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    # x : window X coordinate
    # y : window Y corrdinate
    # actor : actor
    #--------------------------------------------------------------------------
    def initialize(x, y, actor)
    super(x, y, 336, WLH * 5 + 150)
    @actor = actor
    refresh
    self.index = 0
    end
    #--------------------------------------------------------------------------
    # * Get Item
    #--------------------------------------------------------------------------
    def item
    return @data[self.index]
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
    self.contents.clear
    @data = []
    for item in @actor.equips do @data.push(item) end
    @item_max = @data.size + ExtraEquipmentSlots.size
    self.contents.font.color = system_color
    if @actor.two_swords_style
    self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
    self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
    else
    self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
    self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::armor1)
    end
    self.contents.draw_text(4, WLH * 2, 92, WLH, Vocab::armor2)
    self.contents.draw_text(4, WLH * 3, 92, WLH, Vocab::armor3)
    self.contents.draw_text(4, WLH * 4, 92, WLH, Vocab::armor4)
    self.contents.draw_text(4, WLH * 5, 92, WLH, $armor5name)
    self.contents.draw_text(4, WLH * 6, 92, WLH, $armor6name)
    self.contents.draw_text(4, WLH * 7, 92, WLH, $armor7name)
    self.contents.draw_text(5, WLH * 8, 92, WLH, $armor8name)
    self.contents.draw_text(5, WLH * 9, 92, WLH, $armor9name)
    draw_item_name(@data[0], 92, WLH * 0)
    draw_item_name(@data[1], 92, WLH * 1)
    draw_item_name(@data[2], 92, WLH * 2)
    draw_item_name(@data[3], 92, WLH * 3)
    draw_item_name(@data[4], 92, WLH * 4)
    draw_item_name(@data[5], 92, WLH * 5)
    draw_item_name(@data[6], 92, WLH * 6)
    draw_item_name(@data[7], 92, WLH * 7)
    draw_item_name(@data[8], 92, WLH * 8)
    draw_item_name(@data[9], 92, WLH * 9)
    end
    #--------------------------------------------------------------------------
    # * Update Help Text
    #--------------------------------------------------------------------------
    def update_help
    @help_window.set_text(item == nil ? "" : item.description)
    end
    end
    
    #==============================================================================
    # Part 2
    #==============================================================================
    # ** Window_EquipItem
    #------------------------------------------------------------------------------
    # This window displays choices when opting to change equipment on the
    # equipment screen.
    #==============================================================================
    
    class Window_EquipItem < Window_Item
    #--------------------------------------------------------------------------
    # * Object Initialization
    # x : sindow X coordinate
    # y : sindow Y corrdinate
    # width : sindow width
    # height : sindow height
    # actor : actor
    # equip_type : equip region (0-4)
    #--------------------------------------------------------------------------
    def initialize(x, y, width, height, actor, equip_type)
    @actor = actor
    if equip_type == 1 and actor.two_swords_style
    equip_type = 0		 # Change shield to weapon
    end
    @equip_type = equip_type
    super(x, y, width, height)
    end
    #--------------------------------------------------------------------------
    # * Whether to include item in list
    # item : item
    #--------------------------------------------------------------------------
    def include?(item)
    return true if item == nil
    if @equip_type == 0
    return false unless item.is_a?(RPG::Weapon)
    else
    return false unless item.is_a?(RPG::Armor)
    return false unless item.kind == @equip_type - 1
    end
    return @actor.equippable?(item)
    end
    #--------------------------------------------------------------------------
    # * Whether to display item in enabled state
    # item : item
    #--------------------------------------------------------------------------
    def enable?(item)
    return true
    end
    end
    
    #===============================================================================âÂÂ
    # Part 3
    #===============================================================================âÂÂ
    
    #==============================================================================
    # ** Window_Item
    #------------------------------------------------------------------------------
    # This window displays a list of inventory items for the item screen, etc.
    #==============================================================================
    
    class Window_Item < Window_Selectable
    #--------------------------------------------------------------------------
    # * Object Initialization
    # x : window x-coordinate
    # y : window y-coordinate
    # width : window width
    # height : window height
    #--------------------------------------------------------------------------
    def initialize(x, y, width, height)
    super(x, y, width, height)
    @column_max = 1
    self.index = 0
    refresh
    end
    #--------------------------------------------------------------------------
    # * Get Item
    #--------------------------------------------------------------------------
    def item
    return @data[self.index]
    end
    #--------------------------------------------------------------------------
    # * Whether or not to include in item list
    # item : item
    #--------------------------------------------------------------------------
    def include?(item)
    return false if item == nil
    if $game_temp.in_battle
    return false unless item.is_a?(RPG::Item)
    end
    return true
    end
    #--------------------------------------------------------------------------
    # * Whether or not to display in enabled state
    # item : item
    #--------------------------------------------------------------------------
    def enable?(item)
    return $game_party.item_can_use?(item)
    end
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    def refresh
    @data = []
    for item in $game_party.items
    next unless include?(item)
    @data.push(item)
    if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
    self.index = @data.size - 1
    end
    end
    @data.push(nil) if include?(nil)
    @item_max = @data.size
    create_contents
    for i in [email="0...@item_max"]0...@item_max[/email]
    draw_item(i)
    end
    end
    #--------------------------------------------------------------------------
    # * Draw Item
    # index : item number
    #--------------------------------------------------------------------------
    def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
    number = $game_party.item_number(item)
    enabled = enable?(item)
    rect.width -= 4
    draw_item_name(item, rect.x, rect.y, enabled)
    self.contents.draw_text(rect, sprintf(":%2d", number), 2)
    end
    end
    #--------------------------------------------------------------------------
    # * Update Help Text
    #--------------------------------------------------------------------------
    def update_help
    @help_window.set_text(item == nil ? "" : item.description)
    end
    end
    Scene (Lines 186)

    Spoiler
    Code:
     #==============================================================================
    # Full Body Equip - Scene
    #------------------------------------------------------------------------------
    # This is a rewrite of the equip scene script to allow compatibility with the
    # added equip types.
    #==============================================================================
    
    class Scene_Equip < Scene_Base
    #--------------------------------------------------------------------------
    # * Constants
    #--------------------------------------------------------------------------
    EQUIP_TYPE_MAX = $equiptypemax	 # Number of equip region
    #--------------------------------------------------------------------------
    # * Object Initialization
    # actor_index : actor index
    # equip_index : equipment index
    #--------------------------------------------------------------------------
    def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
    @equip_index = equip_index
    end
    #--------------------------------------------------------------------------
    # * Start processing
    #--------------------------------------------------------------------------
    def start
    super
    create_menu_background
    @actor = $game_party.members[@actor_index]
    @help_window = Window_Help.new
    create_item_windows
    @equip_window = Window_Equip.new(208, 56, @actor)
    @equip_window.help_window = @help_window
    @equip_window.index = @equip_index
    @status_window = Window_EquipStatus.new(0, 56, @actor)
    end
    #--------------------------------------------------------------------------
    # * Termination Processing
    #--------------------------------------------------------------------------
    def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @equip_window.dispose
    @status_window.dispose
    dispose_item_windows
    end
    #--------------------------------------------------------------------------
    # * Return to Original Screen
    #--------------------------------------------------------------------------
    def return_scene
    $scene = Scene_Menu.new(2)
    end
    #--------------------------------------------------------------------------
    # * Switch to Next Actor Screen
    #--------------------------------------------------------------------------
    def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Equip.new(@actor_index, @equip_window.index)
    end
    #--------------------------------------------------------------------------
    # * Switch to Previous Actor Screen
    #--------------------------------------------------------------------------
    def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_Equip.new(@actor_index, @equip_window.index)
    end
    #--------------------------------------------------------------------------
    # * Update Frame
    #--------------------------------------------------------------------------
    def update
    super
    update_menu_background
    @help_window.update
    update_equip_window
    update_status_window
    update_item_windows
    if @equip_window.active
    update_equip_selection
    elsif @item_window.active
    update_item_selection
    end
    end
    #--------------------------------------------------------------------------
    # * Create Item Window
    #--------------------------------------------------------------------------
    def create_item_windows
    @item_windows = []
    for i in 0...EQUIP_TYPE_MAX
    @item_windows[i] = Window_EquipItem.new(0, 208, 208, 208, @actor, i)
    @item_windows[i].help_window = @help_window
    @item_windows[i].visible = (@equip_index == i)
    @item_windows[i].y = 208
    @item_windows[i].height = 416
    @item_windows[i].active = false
    @item_windows[i].index = -1
    end
    end
    #--------------------------------------------------------------------------
    # * Dispose of Item Window
    #--------------------------------------------------------------------------
    def dispose_item_windows
    for window in @item_windows
    window.dispose
    end
    end
    #--------------------------------------------------------------------------
    # * Update Item Window
    #--------------------------------------------------------------------------
    def update_item_windows
    for i in 0...EQUIP_TYPE_MAX
    @item_windows[i].visible = (@equip_window.index == i)
    @item_windows[i].update
    end
    @item_window = @item_windows[@equip_window.index]
    end
    #--------------------------------------------------------------------------
    # * Update Equipment Window
    #--------------------------------------------------------------------------
    def update_equip_window
    @equip_window.update
    end
    #--------------------------------------------------------------------------
    # * Update Status Window
    #--------------------------------------------------------------------------
    def update_status_window
    if @equip_window.active
    @status_window.set_new_parameters(nil, nil, nil, nil)
    elsif @item_window.active
    temp_actor = @actor.clone
    temp_actor.change_equip(@equip_window.index, @item_window.item, true)
    new_atk = temp_actor.atk
    new_def = temp_actor.def
    new_spi = temp_actor.spi
    new_agi = temp_actor.agi
    @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
    end
    @status_window.update
    end
    #--------------------------------------------------------------------------
    # * Update Equip Region Selection
    #--------------------------------------------------------------------------
    def update_equip_selection
    if Input.trigger?(Input::
    Sound.play_cancel
    return_scene
    elsif Input.trigger?(Input::R)
    Sound.play_cursor
    next_actor
    elsif Input.trigger?(Input::L)
    Sound.play_cursor
    prev_actor
    elsif Input.trigger?(Input::C)
    if @actor.fix_equipment
    Sound.play_buzzer
    else
    Sound.play_decision
    @equip_window.active = false
    @item_window.active = true
    @item_window.index = 0
    end
    end
    end
    #--------------------------------------------------------------------------
    # * Update Item Selection
    #--------------------------------------------------------------------------
    def update_item_selection
    if Input.trigger?(Input::
    Sound.play_cancel
    @equip_window.active = true
    @item_window.active = false
    @item_window.index = -1
    elsif Input.trigger?(Input::C)
    Sound.play_equip
    @actor.change_equip(@equip_window.index, @item_window.item)
    @equip_window.active = true
    @item_window.active = false
    @item_window.index = -1
    @equip_window.refresh
    for item_window in @item_windows
    item_window.refresh
    end
    end
    end
    end
    Objectives to Finish this Script:

    1. Allow the equip menu cursor to select the new equip types.

    2. Allow for setting armour to the new equip types.

    3. Force the new equip slots to recognize the correct type of equipment to be equipped in itself.

    4. Automaticly resize the menu to fit the number of added equipment slots.

    5. Disable scrolling in the Equip window.
  2. Uhhh. I'm new to this forum, as you can tell. Can somebody please tell me how to fix my image? It works on other forums so I'm not sure what's wrong. :/
  3. @InfinateX

    I will help you newb.

    First off pal Double posting is against the rules. Try not to do that.

    That is why the EDIT button exists.

    -It is right to the left of the multi-quote button at the bottom of your post.-

    You can see it better when you move the mouse over it.

    Which mean if you have a problem with something edit it to fix it.

    and I think your image really isn't the problem. I used to have this problem with Photobucket all the time (when I used to use it) when your bandwidth limit is exceeded it won't show the image either.

    I don't use PB for that reason. I use ImageShack myself.

    I hope this solves your problem.

    I can only dream that the script can live up to the expectations I had by the topic title.

    It reminded me of th VS:ER full equip system.
  4. Well if it's not the BBCode than I guess you'll have to go on one of the other 2 forums I've posted this on if you want to see the screenshot. It's on RPGMakerVX.net and Omega-Dev.net.

    Nvm. The problem corrected itself.

    Actually it didn't. :( Only in the editor...

    I did a google search and found nothing. What's VS:ER full equip system?
  5. Bump