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.

Yet another Visual Equipment script!

Code:
#==============================================================================
# â–  Visual Equipment
#------------------------------------------------------------------------------
# Author  | Meâ„¢ / me@solarsoft.nl
# Version | 2.2.32
# Date    | 13 / 02 / 07 (DDMMYY)
# Credit  | Raitaime - Geso Chiku
#==============================================================================
#   â–¼ New in version 2.2.X
#   - guill_trick_*: Compatible with tricks multi-equip
#
#   â–¼ New in version 2.1.X
#   - Can now return false and [false]
#   - Fixed: Not updating
#
#   â–¼ New in version 2.0.X
#   - Now Compatible with N+
#
#   â–¼ New in version 1.2.X
#   - Now possible to use other maps then Visual Equipment
#   - Fixed: Unable to load bug
#   - Fixed: Guillaume update bug
#   - Fixed: Guillaume Weapon not showing bug 
#
#   â–¼ New in version 1.1.X
#   - Equipment visible in windows (using draw_actor_graphic)
#   - Compatible with Guillaume777's Multi-Slot script version 6.2.1
#
#==============================================================================
#
#   â–¼ Instructions (updated: version 1.0.0)
#
#   Hello dear reader. Thank you for choosing my Visual Equipment
#   script, based on the originals by Raitaime and Geso Chiku.
#   This script contains new elements, and rewritten  code, and copied 
#   code from the old scripts.
#
#------------------------------------------------------------------------------
#
#   â–¼ What does this script:
#   - Shows the players equipment on map
#   - Initial body value possible (skin, eyes and hair)
#   - Up to 5 types of equipment. From weapons to accesoiry's
#   - Shows NPC equipment on the map events if set
#   - Compatible with Caterpillar and Squad Based Action Battle System
#   - Compatible with Half Kaizer- and other different size-sprites
#
#------------------------------------------------------------------------------
#
#   â–¼ How to add your own graphics:
#   - Make or locate the Visual Equipment - folder which should be in Graphics
#   - You can choose to place your files here, or make submaps
#   - Scroll down for the Get_file method in module Visual Equipement
#   - Add a line like this: return ["FILENAME, HUE] if item_id = ID
#         where Filename is the filename between quotes without extension
#         Hue is the hue which the sprite should take (usually 0)
#         ID is the ID number of the weapon/armor
#   ● NOTE: Make sure you add weapons above the else, and the rest after it!
#   ● NOTE: The equipment on a frog should match the frogs size, the equipent
#           on a standard event should thus be 128x192.
#
#------------------------------------------------------------------------------
#
#   â–¼ How to give my character default skin, eyes and hair:
#   - Add somewhere after you initialized $game_party the following lines:
#       $game_party.actors[0].set_body(0, "FILENAME")
#       $game_party.actors[0].set_body(1, "FILENAME")
#       $game_party.actors[0].set_body(2, "FILENAME")
#   - Change the line according to your needs, just replace the '' with the
#     Filename. 0 is for skin, 1 for eyes and 2 for hair. If this is left
#     empty (like what it is now) the body[0] will be replaced by the graphic
#     set in the database. (So, no skin is set ;))
#
#------------------------------------------------------------------------------
#
#   â–¼ How to add Equipment to the characters as in Events:
#   - Add comments in this format:
#       Comment: Visual Equipment
#       Comment: Body | [charset] | [hue]
#       Comment: Armor | [charset] | [hue]
#       Comment: Helmet | [charset] | [hue]
#       Comment: Weapon | [charset] | [hue]
#       Comment: Accessory | [charset] | [hue]
#       Comment: Shield | [charset] | [hue]
#   - Replace [charset] by the filename without extension
#   - Replace [hue] by the hue, default 0
#   ● NOTE: please use:  |  (with spaces) instead of | (without spaces)
#   ● NOTE: when no hue was found, the hue will be set to 0 (default)
#   ● NOTE: when not entering the hue, remove the last collon. (ex. Body | [charset])
#   ● NOTE: more/less maximum event equipments can be set at Visual_Equipment
#   ● NOTE: Body/Armor/Helmet etc. can be replaced by ex. 1, 2, 3, 4
#
#------------------------------------------------------------------------------
#
#   â–¼ Additional Information... 
#   - You probably need to alter the script yourself a bit when usong 8 frames 
#     etc. I already did a little thing by adding the options frames and 
#     directions in the visual equipment module. Make sure any directions script 
#     is ABOVE this script, and copy the edits from Sprite_Character to this 
#     script or it won't work anyway.
#
#------------------------------------------------------------------------------
#
#   â–¼ Known compatibility issues
#   - With extra equipments scripts, does not shows things in the extra slots
#   - With Raitaimes shadow script, only shows character sprite, not equipments
#   - With Only scripts like Netplay and Netplay+, only shows head/does not work
#   - Only works with SDK version of Caterpillar
#
#------------------------------------------------------------------------------
#
#   ● NOTE: Merges can always be requested on the topic on rmxp.org
#           http://www.rmxp.org/forums/showthread.php?t=9112
#
#   Have fun and Take care,
#   Meâ„¢
#==============================================================================
#
#   â–¼ This script aliases:
#   - Game_Actor > setup
#   - Sprite_Character > initialize
#
#   â–¼ This script rewrites:
#   - Sprite_Character > update
#   - Window_Base > draw_actor_graphic
#
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script and Begin SDK Enable Test
#------------------------------------------------------------------------------
SDK.log('Visual Equipment', 'Meâ„¢', 1, '12.09.06')
if SDK.state('Visual Equipment') == true
 
#==============================================================================
# *** module Visual Equipment
#------------------------------------------------------------------------------
#  This module handles the image name and equipment draw order processing
#==============================================================================
module Visual_Equipment
  module_function
  
  #--------------------------------------------------------------------------
  # * Configuration
  #--------------------------------------------------------------------------
  #    Width            : The default file width.
  #    Heigth           : The default file heigth.
  #    Event_equipments : How many comments will be used after Visual Equipment
  #    Frames           : How many frames do the sprites contain (left right)
  #    Directions       : How many directions do the sprites contain (up down)
  #    Guillaume777     : Set to true if you are using Guillaume777's script
  #    Trickster        : Set to true if you are using Tricksters Multi Equip
  #--------------------------------------------------------------------------
  Width                 = 128 
  Height                = 192 
  Event_equipments      = 5
  Frames                = 4
  Directions            = 4
  Guillaume777          = false
  Trickster             = true
  
  #--------------------------------------------------------------------------
  # * Gives the file name which corresponds to the item ^^
  #--------------------------------------------------------------------------
  def get_file(type, item_id)
    case type
     when 5
      #---------------------------------------------------------
      # Weapons should have type 5
      #---------------------------------------------------------
      return ['#Characters/002-Fighter02',0] if item_id == 1
    else
      #---------------------------------------------------------
      # Body Armors should have type 1
      #---------------------------------------------------------
      return [false,0] if item_id == 2
      #---------------------------------------------------------
      # Helmets should have type 2
      #---------------------------------------------------------
      return [false,0] if item_id == 5
      #---------------------------------------------------------
      # Assesoiry's should have type 3
      #---------------------------------------------------------
      return ['#Characters/003-Fighter03',0] if item_id == 33
      #---------------------------------------------------------
      # Shields should have type 4
      #---------------------------------------------------------
      return ['#Characters/004-Fighter04',0] if item_id == 1
    end
    # When not found, return nothing
    return [false,0]
  end  
  #--------------------------------------------------------------------------
  # * Set the order or drawing the equipments / returns the id of the item
  #--------------------------------------------------------------------------
  def get_itemid(order_i,actor)
    return -1 if Guillaume777 == true or Trickster != true
    return -1 if actor == nil
    case order_i
     when 0 # Body (Skin/Eyes/Hair)
      return actor.body
     when 1 # Body Armor / Trousers
      return actor.armor3_id 
     when 2 # Helmet / Top
      return actor.armor2_id
     when 3 # Assesoiry / Extra
      return actor.armor4_id
     when 4 # Shield
      return actor.armor1_id 
     when 5 # Weapon
      return actor.weapon_id
    end
  end
  #--------------------------------------------------------------------------
  # * Set the order or drawing the equipments / returns the ids of the items
  #--------------------------------------------------------------------------
  def guill_trick_itemid(type, actor)
    return [] if Guillaume777 != true and Trickster != true
    return [] if actor == nil
    case type
     when 0
      return actor.body
     when 1...4 # Includes originial armors (armor1_id ... armor4_id)
      return actor.armor_ids 
     when 5 # Includes weapon 1
      return actor.weapon_ids
    end
  end
end

class Game_NetPlayer < Game_Actor
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Aliases
  #--------------------------------------------------------------------------
  alias tm_visualequipment_gameactor_setup setup
  #--------------------------------------------------------------------------
  # * Public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :body
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    @body = []
    tm_visualequipment_gameactor_setup(actor_id)
  end
  #--------------------------------------------------------------------------
  # * Set's a actors body
  #     thing: 0 should be Template (Skin)
  #            1 should be Eyes 
  #            2 should be Hair
  #--------------------------------------------------------------------------
  def set_body(thing, value)
    # If value is not the 'remove' code.
    if value != nil and value != ''
      # Put the filename into the body array.
      @body[thing] = value
    else
      # Clear the filename in the body array.
      @body[thing] = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Get's the needed equipments / Also determines ordeR!
  #--------------------------------------------------------------------------
  def get_equipments
    return [] if Visual_Equipment::Guillaume777 == true or 
                 Visual_Equipment::Trickster == true
    # Empty's equipments array for use
    equipments = []
    # Add the skin/default char and eyes to the array
    equipments.push([@body[0][0],@body[0][1]])        if @body[0] != nil
    equipments.push(["#Characters/#{@character_name}", @character_hue]) if equipments.size != 1
    equipments.push([@body[1][0], @body[1][1]])        if @body[1] != nil 
    # Add the hair to the array, if any is set
    equipments.push([@body[2][0], @body[2][1]]) if @body[2] != nil
    # Add the equipments, if there is a file for the equipments
    for equipnumber in 1...5
      # First, get the item_id of the equipment
      item_id = Visual_Equipment.get_itemid(equipnumber, self)
      # Second, get the filename and hue of the file attached to the id
      item = Visual_Equipment.get_file(equipnumber, item_id)
      # Put the item into the array if a file name was found
      equipments.push(item) unless item == false or item == nil
    end
    
    # Return all the equipments
    return equipments
  end
  #--------------------------------------------------------------------------
  # * Get's the needed equipments / Also determines ordeR!
  #--------------------------------------------------------------------------
  def guill_trick_equipments
    return [] unless Visual_Equipment::Guillaume777 == true or 
              Visual_Equipment::Trickster == true
    # Empty's equipments array for use
    equipments = []
    # Add the skin/default char and eyes to the array
    equipments.push([@body[0], @character_hue])        if @body[0] != nil
    equipments.push(["#Characters/#{@character_name}", @character_hue]) if equipments.size != 1
    equipments.push([@body[1], @character_hue])        if @body[1] != nil 
    # Gets wepaons and armors
    weapons    = Visual_Equipment.guill_trick_itemid(5, self)
    armors     = Visual_Equipment.guill_trick_itemid(2, self)
    # Add the hair to the array, if any is set
    equipments.push([@body[2], @character_hue]) if @body[2] != nil
    # Add the equipments, if there is a file for the equipments
    for armor_id in armors
      # Get the filename and hue of the file attached to the id
      item = Visual_Equipment.get_file(1, armor_id)
      # Put the item into the array if a file name was found
      equipments.push(item) unless item == false or item == nil
    end
     # Add the equipments, if there is a file for the equipments
    for weapon in weapons
      # Get the filename and hue of the file attached to the id
      item = Visual_Equipment.get_file(5, weapon)
      # Put the item into the array if a file name was found
      equipments.push(item) unless item == false or item == nil
    end
    return equipments
  end
end

#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Aliases
  #--------------------------------------------------------------------------
  alias tm_visualequipment_spritecharacter_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     viewport  : viewport
  #     character : character (Game_Character)
  #--------------------------------------------------------------------------
  def initialize(viewport, character = nil)
    # Make an body array
    @body_id = Array.new(3,nil)
    # How many id's are there?
    number = 0
    if Visual_Equipment::Guillaume777 == true
      number += G7_MS_MOD::WEAPON_KINDS.size + G7_MS_MOD::ARMOR_KINDS.size
    end
    if Visual_Equipment::Trickster == true
      number += Multi_Equip::Weapon_Slots.size + Multi_Equip::Armor_Slots.size
    end
    if Visual_Equipment::Guillaume777 != true and Visual_Equipment::Trickster != true
      number = 5
    end
    # Make the equipment array
    @equips_id = Array.new(number,0)
    # What kind is the character?
    if character.is_a?(Game_Player)
      @actor = $game_party.actors[0]
    elsif SDK.state('SBABS') == true and character.is_a?(Game_Ally)
      @actor = $game_party.actors[character.actor_id]
    elsif SDK.state('Caterpillar') == true and character.is_a?(Game_Party_Actor)
      @actor = character.actor
    elsif character.is_a?(Game_NetPlayer)
      @actor = character
    elsif character.is_a?(Game_Event)
      @actor = 'event'
    else
      @actor = nil
    end
    tm_visualequipment_spritecharacter_initialize(viewport, character)
  end
  #--------------------------------------------------------------------------
  # * Did the equipment changed?
  #--------------------------------------------------------------------------
  def changed_equipment?
    return false if Visual_Equipment::Guillaume777 == true or
                    Visual_Equipment::Trickster == true
    # According to the kind of the actor, the check is made...
    if character.is_a?(Game_Player) or character.is_a?(Game_NetPlayer)
      for equipment_id in 1...5
        item_id = Visual_Equipment.get_itemid(equipment_id, @actor)
        if @equips_id[equipment_id] != item_id
          return true 
        end
      end
      body = Visual_Equipment.get_itemid(0, @actor)
      for i in 0..3
        if @body_id[i] != body[i]
          return true
        end
      end     
    elsif SDK.state('Caterpillar') == true and @character.is_a?(Game_Party_Actor)
      return (@actor != @character.actor ? true : false)
    elsif SDK.state('SBABS') == true and @character.is_a?(Game_Ally)
      return (@actor != $game_party.actors[@character.actor_id] ? true : false)
    elsif @character.is_a?(Game_Event)
      return (@page != @character.page ? true : false)
    else
      return false
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Did the equipment changed?
  #--------------------------------------------------------------------------
  def guill_trick_changed_equipment?
    return false if Visual_Equipment::Guillaume777 != true and
                    Visual_Equipment::Trickster != true
    # According to the kind of the actor, the check is made...
    if character.is_a?(Game_Player) or character.is_a?(Game_NetPlayer)
      weapons  = Visual_Equipment.guill_trick_itemid(5, @actor)
      armors   = Visual_Equipment.guill_trick_itemid(2, @actor)
      for id in 0..armors.size
        return true if @equips_id[id] != armors[id]
      end
      for id in armors.size..weapons.size
        return true if @equips_id[id] != weapons[id]
      end
      body = Visual_Equipment.guill_trick_itemid(0, @actor)
      for i in 0..3
        return true if @body_id[i] != body[i]
      end
      return false
    elsif SDK.state('Caterpillar') == true and @character.is_a?(Game_Party_Actor)
      return (@actor != @character.actor ? true : false)
    elsif SDK.state('SBABS') == true and @character.is_a?(Game_Ally)
      return (@actor != $game_party.actors[@character.actor_id] ? true : false)
    elsif @character.is_a?(Game_Event)
      return (@page != @character.page ? true : false)
    else
      return false
    end
  end
  #--------------------------------------------------------------------------
  # * Update known equipment
  #--------------------------------------------------------------------------
  def update_equipment
    return false if Visual_Equipment::Guillaume777 == true or
                    Visual_Equipment::Trickster == true
    # Remember tile ID, file name and hue
    @tile_id = @character.tile_id
    @character_name = @character.character_name
    @character_hue = @character.character_hue
    # If the actor isent supported, return immideatly
    return if @actor == nil
     # According to the kind of the actor, the update is made...
    if character.is_a?(Game_Player) or character.is_a?(Game_NetPlayer)
      for equipment in 1...5
        @equips_id[equipment] = Visual_Equipment.get_itemid(equipment, @actor)
      end
      body = Visual_Equipment.guill_trick_itemid(0, @actor)
      for bodypart in 0..3
        @body_id[bodypart] = body[bodypart]
      end
    elsif SDK.state('Caterpillar') == true and @character.is_a?(Game_Party_Actor)
      @actor = @character.actor
    elsif SDK.state('SBABS') == true and @character.is_a?(Game_Ally)
      @actor = $game_party.actors[@character.actor_id]
    elsif @character.is_a?(Game_Event)
      @page = @character.page
    end
  end
  #--------------------------------------------------------------------------
  # * Update known equipment
  #--------------------------------------------------------------------------
  def guill_trick_update_equipment
    return false if Visual_Equipment::Guillaume777 != true and
                    Visual_Equipment::Trickster != true
    # Remember tile ID, file name and hue
    @tile_id = @character.tile_id
    @character_name = @character.character_name
    @character_hue = @character.character_hue
    # If the actor isent supported, return immideatly
    return if @actor == nil
     # According to the kind of the actor, the update is made...
    if character.is_a?(Game_Player) or character.is_a?(Game_NetPlayer)
      weapons  = Visual_Equipment.guill_trick_itemid(1, @actor)
      armors   = Visual_Equipment.guill_trick_itemid(2, @actor)
      for id in 0..armors.size
        start = id
        @equips_id[id] = armors[id]
      end
      for id in (start+1)..weapons.size
        @equips_id[id] = weapons[id]
      end
      body = Visual_Equipment.guill_trick_itemid(0, @actor)
      for i in 0..3
        @body_id[i] = body[i]
      end
    elsif SDK.state('Caterpillar') == true and @character.is_a?(Game_Party_Actor)
      @actor = @character.actor
    elsif SDK.state('SBABS') == true and @character.is_a?(Game_Ally)
      @actor = $game_party.actors[@character.actor_id]
    elsif @character.is_a?(Game_Event)
      @page = @character.page
    end
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    super()
    # If something changed...
    if @tile_id != @character.tile_id or
      @character_name != @character.character_name or
      @character_hue != @character.character_hue or
      changed_equipment? or guill_trick_changed_equipment?
      
      # First, update the information known
      if Visual_Equipment::Guillaume777 != true and
         Visual_Equipment::Trickster != true
        update_equipment
      elsif Visual_Equipment::Guillaume777 == true or
            Visual_Equipment::Trickster == true
        guill_trick_update_equipment
      end
      # Then update the graphics
      update_tile
    end
    # Set visible situation
    self.visible = (not @character.transparent)
    # If graphic is character
    if @tile_id == 0
      # Set rectangular transfer
      sx = @character.pattern * @cw
      sy = (@character.direction - 2) / 2 * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
    # Set sprite coordinates
    self.x = @character.screen_x
    self.y = @character.screen_y
    self.z = @character.screen_z(@ch)
    # Set opacity level, blend method, and bush depth
    self.opacity = @character.opacity
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    # Animation
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      animation(animation, true)
      @character.animation_id = 0
    end
  end
  #--------------------------------------------------------------------------
  # * Update Tile
  #--------------------------------------------------------------------------
  def update_tile
    # If tile ID value is valid
    if @tile_id >= 384
      self.bitmap = RPG::Cache.tile($game_map.tileset_name,
      @tile_id, @character.character_hue)
      self.src_rect.set(0, 0, 32, 32)
      self.ox = 16
      self.oy = 32
      # If tile ID value is invalid (and thus a character is in that place ::))
    else
      # Create an Equpment awway
      equips = []
      # If handling a event
      if @character.is_a?(Game_Event) == true and @actor == 'event'
        # Check for comment input
        parameters = SDK.event_comment_input(@character, Visual_Equipment::Event_equipments, 'Visual Equipment')
        if parameters.nil?
          # Just draw the graphic
          equips.push(["#Characters/#{@character_name}", @character_hue])
        else
          # Catch the equipments
          for possible_item in 0..Visual_Equipment::Event_equipments-1
            item = parameters[possible_item].split(" | ") rescue ['none']
            hue = item.size > 2 ? item[2] : 0
            equips.push([item[1], hue]) if item[1] != 'none'
            equips.push(["#Characters/#{@character_name}", @character_hue]) if possible_item == 1
          end
        end
      # If handling the player
      elsif @actor != nil and @actor != 'event'
        if Visual_Equipment::Guillaume777 != true and
           Visual_Equipment::Trickster != true
          equips = @actor.get_equipments
        elsif Visual_Equipment::Guillaume777 == true or
              Visual_Equipment::Trickster == true
          equips = @actor.guill_trick_equipments
          
        end
      end
      # Dispose old bitmap
      self.bitmap.dispose unless self.bitmap == nil
      # Draws the character bitmap
      bmp = RPG::Cache.character(@character_name, @character_hue)
      self.bitmap = Bitmap.new(bmp.width, bmp.height)
      src_rect = Rect.new(0, 0, bmp.width, bmp.height)
      # If character fits the size
      if equips.size > 0 and bmp.width == Visual_Equipment::Width and bmp.height == Visual_Equipment::Height
        for graphic in equips
          next if graphic[0] == nil or graphic[0] == false or graphic[0] == "false"
          if graphic[0].include?("#Characters/")
            graphic_equipment = RPG::Cache.graphic("#{graphic[0]}", graphic[1].to_i)
          else
            graphic_equipment = RPG::Cache.equipment("#{graphic[0]}", graphic[1].to_i)
          end
          self.bitmap.blt(0, 0, graphic_equipment, src_rect, 255)
        end
      elsif equips.size > 0
        for graphic in equips
          next if graphic[0] == nil or graphic[0] == false or graphic[0] == "false"
          if graphic[0].include?("#Characters/")
            graphic_equipment = RPG::Cache.graphic("#{graphic[0]}", graphic[1].to_i)
          else
            graphic_equipment = RPG::Cache.equipment("#{graphic[0]}", graphic[1].to_i)
          end
          src_rect = Rect.new(0, 0, bmp.width, bmp.height)
          self.bitmap.blt(0, 0, graphic_equipment, src_rect, 255)
        end
      else
        src_rect = Rect.new(0, 0, bmp.width, bmp.height)
        self.bitmap.blt(0, 0, bmp, src_rect, 255)
      end
      # Divide the drawings into pieces ^^
      @cw = bitmap.width / Visual_Equipment::Frames
      @ch = bitmap.height / Visual_Equipment::Directions
      self.ox = @cw / 2
      self.oy = @ch
    end
  end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Graphic
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y)
    return if actor == nil
    # Get the equipments
    if Visual_Equipment::Guillaume777 != true and
       Visual_Equipment::Trickster != true
      equips = actor.get_equipments
    elsif Visual_Equipment::Guillaume777 == true or
          Visual_Equipment::Trickster == true
      equips = actor.guill_trick_equipments
    end
    # Set the basement
    bmp = RPG::Cache.character(actor.character_name, actor.character_hue)
    cw = bmp.width / 4
    ch = bmp.height / 4
    src_rect = Rect.new(0, 0, cw, ch)
    # Draw the equipments
    if equips.size > 0 and bmp.width == Visual_Equipment::Width and bmp.height == Visual_Equipment::Height
      for graphic in equips
        next if graphic[0] == nil or graphic[0] == false or graphic[0] == "false"
        if graphic[0].include?("#Characters/")
          graphic_equipment = RPG::Cache.graphic("#{graphic[0]}", graphic[1].to_i)
        else
          graphic_equipment = RPG::Cache.equipment("#{graphic[0]}", graphic[1].to_i)
        end
        self.contents.blt(x - cw / 2, y - ch, graphic_equipment, src_rect, 255)
      end
    elsif equips.size > 0
      for graphic in equips
        next if graphic[0] == nil or graphic[0] == false or graphic[0] == "false"
        if graphic[0].include?("#Characters/") 
          graphic_equipment = RPG::Cache.graphic("#{graphic[0]}", graphic[1].to_i)
        else
          graphic_equipment = RPG::Cache.equipment("#{graphic[0]}", graphic[1].to_i)
        end
        self.contents.blt(x - cw / 2, y - ch, graphic_equipment, src_rect, 255)
      end
    else
      src_rect = Rect.new(0, 0, bmp.width, bmp.height)
      self.contents.blt(0, 0, bmp, src_rect, 255)
    end
  end
end

#==============================================================================
# *** module RPG
#==============================================================================
module RPG
  #============================================================================
  # *** moduel Cache
  #============================================================================
  module Cache
    #--------------------------------------------------------------------------
    # * Load equipment
    #--------------------------------------------------------------------------
    def self.equipment(filename, hue)
      self.load_bitmap("Graphics/Visual Equipment/", filename, hue)
    end
    #--------------------------------------------------------------------------
    # * Load graphic
    #--------------------------------------------------------------------------
    def self.graphic(filename, hue)
      filename.slice!("#")
      self.load_bitmap("Graphics/", filename, hue)
    end
    #--------------------------------------------------------------------------
    # * Load GUI
    #--------------------------------------------------------------------------
    def self.gui(filename,hue=0)
      self.load_bitmap("Graphics/GUI/",filename,hue)
    end
  end
end

#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page 
#  switching via condition determinants, and running parallel process events.
#  It's used within the Game_Map class.
#==============================================================================
class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Public instance variables
  #--------------------------------------------------------------------------
  attr_reader :page
end
  
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end

You can now perfectly use this with guillaumes or tricksters Multi-Equipment. Should also work in N+ 2.X.X and later.
 
I don't know if it is me messing myself up or what but I can't seem to get any of the images I have made to show up. I've tried placing everything in the characters folder but to no avail. The version before this works fine but this one has me stumped.
 
Make a new map called Visual Equipment in the Graphics folder, and try:

Code:
return [FILENAME,HUE] if item_id == ID

Make sure Weapons are above the else and Armors are not.
 

Ark

Member

I have a request.

Is it possible for this system to be compatible with Mr. Mo's ABS? It would be great. (I mean of course compatible for battle animations too.
Or it would be great not onl update char pics, but update Battlers too.
 
Here's the code, I've tried different ways of defining the search string.
Code:
module Visual_Equipment
  module_function
  
  #--------------------------------------------------------------------------
  # * Configuration
  #--------------------------------------------------------------------------
  #    Width            : The default file width.
  #    Height           : The default file height.
  #    Event_equipments : How many comments will be used after Visual Equipment
  #    Frames           : How many frames do the sprites contain (left right)
  #    Directions       : How many directions do the sprites contain (up down)
  #    Guillaume777     : Set to true if you are using Guillaume777's script
  #    Trickster        : Set to true if you are using Tricksters Multi Equip
  #--------------------------------------------------------------------------
  Width                 = 128 
  Height                = 192 
  Event_equipments      = 5
  Frames                = 4
  Directions            = 4
  Guillaume777          = false
  Trickster             = false
  
  #--------------------------------------------------------------------------
  # * Gives the file name which corresponds to the item ^^
  #--------------------------------------------------------------------------
  def get_file(type, item_id)
    case type
     when 5
     #---------------------------------------------------------
     # Weapons should have type 5
     #---------------------------------------------------------
      #return ['#Characters/002-Fighter02',0] if item_id == 1
     #---------------------------------------------------------
     # Body Armors should have type 1
     #---------------------------------------------------------
     when 1
      return ['#Characters/Visual_Equipment/TNG/Naval/TNG (1)',0] if item_id == 1
     #---------------------------------------------------------
     # Helmets should have type 2
     #---------------------------------------------------------
     when 2
      return [false,0] if item_id == 5
     #---------------------------------------------------------
     # Assesoiry's should have type 3
     #---------------------------------------------------------
     when 3
      return ['Characters/Visual_Equipment/Comm',0] if item_id == 33
     #---------------------------------------------------------
     # Shields should have type 4
     #---------------------------------------------------------
     when 4
      return ['#Characters/004-Fighter04',0] if item_id == 6
    end
    # When not found, return nothing
    #return [false,0]
  end  
  #--------------------------------------------------------------------------
  # * Set the order or drawing the equipments / returns the id of the item
  #--------------------------------------------------------------------------
  def get_itemid(order_i,actor)
    return -1 if Guillaume777 == true or Trickster != true
    return -1 if actor == nil
    case order_i
     when 0 # Body (Skin/Eyes/Hair)
      return actor.body
     when 1 # Body Armor / Trousers
      return actor.armor3_id 
     when 2 # Helmet / Top
      return actor.armor2_id
     when 3 # Assesoiry / Extra
      return actor.armor4_id
     when 4 # Shield
      return actor.armor1_id 
     when 5 # Weapon
      return actor.weapon_id
    end
  end
  #--------------------------------------------------------------------------
  # * Set the order or drawing the equipments / returns the ids of the items
  #--------------------------------------------------------------------------
  def guill_trick_itemid(type, actor)
    return [] if Guillaume777 != true and Trickster != true
    return [] if actor == nil
    case type
     when 0
      return actor.body
     when 1...4 # Includes originial armors (armor1_id ... armor4_id)
      return actor.armor_ids 
     when 5 # Includes weapon 1
      return actor.weapon_ids
    end
  end
end

class Game_NetPlayer < Game_Actor
end
 
The Visual Equipment map is in the GRAPHICS folder right? not in Characters?

For Visual_Equipment items that are in that map use:

Code:
 return [PATH_WITHOUT VEMAP,HUE] if item_id == ID
so, TNG/Naval/TNG (1).

For images in OTHER directories then VE or subs from that, include a # (it will got o Graphics) and then the path, so for an image in the pictures folder use:
"#Pictures/NAME"
 

Azden

Member

I found bug, not sure if this was mentioned but: I am using Mr Mo's ABS and if I use this script, when I kill a creature the creature doesn't fade away or anything, it just sits there with the graphic still, and sometimes it even walks but I can't attack it once I kill it, so the creature doesn't fade red or anything.
 

Azden

Member

Oh right.. I thought some reason I put the scripts below the others.. damn I'm stupid.. Sorry about, and thanks it works now!
 

Glows

Member

it does't works!
Can anyone fix? does it works with NET+ 1.8.4? and in the new version of NET+?
If anyone have NET+ 2.0, can send it to me? Please!



Sorry my bad English...
 

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