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!

Nice script. I will just add a tip.
To make it compatible with f0tz!baerchen caterpilar and pixel movement (click here) look for the following:
Code:
    elsif SDK.state('Caterpillar') == true and character.is_a?(Game_Party_Actor)
      @actor = character.actor
and add the folowing
Code:
    elsif SDK.state('Pixelmovement') == true and character.is_a?(Game_Party_Actor)
      @actor = $game_party.actors[character.id - 1]
and add the following somewhere after the script last line
Code:
class Game_Party_Actor
  attr_accessor :id
end
 
I am using the side-view CBS found here. however, the equipment is not showing up in battle.':| Anyone got any ideas?

Thanks,

Rytheon
 
Rytheon;130623 said:
I am using the side-view CBS found here. however, the equipment is not showing up in battle.':| Anyone got any ideas?

Thanks,

Rytheon

You will need to change something in the following code in your CBS script (Sprite_Battler class). Try looking in the visual equip script and adding some coding here.
Code:
        if @battler.is_a?(Game_Actor)
          @battler_name = @battler.character_name
          @battler_hue = @battler.character_hue
          @bitmap = RPG::Cache.character(@battler_name, @battler_hue)
          @width = @bitmap.width / 4
          @height = @bitmap.height / 4
        else
 
Hmm...I still can't figure it out. In addition it might be helpful to know that the CBS uses the character sprite rather than a battler. And since I'm awful at coding, I don't know if that affects what we're trying to do or not.

Rytheon
 
@Me(tm)
When using Character Icon Graphics from SephirothSpawn with this script, the icons will not work. That's because you are not aliasing the update method from Sprite_Character class. I think you should check if the char has equip to show, and if it's not execute the aliased method...

@Rytheon
What I've posted is where your CBS is drawing the characters, so is where you have to write something to draw the equips too. If you look into the visual equip script how the equips are drawn and write something like that there.
 
can i make a suggestion on this line
Code:
  Width                 = 128 
  Height                = 192 
  Event_equipments      = 5
  Frames                = 4
  Directions            = 4
  Guillaume777          = true

why not do this

Code:
Width                 = 128 
  Height                = 192 
  Event_equipments      = 5
  Frames                = Width/32
  Directions            = Height/32
  Guillaume777          = true
 
Maybe because one frame is not 32 pixels width or height?

When using Character Icon Graphics from SephirothSpawn with this script, the icons will not work. That's because you are not aliasing the update method from Sprite_Character class. I think you should check if the char has equip to show, and if it's not execute the aliased method...
My last version is aliased. I have found a lot of bugs too, will upload it one of these days. You could just put this above sephsscript ...
 
I was wondering if I could get this script to determine what faceset is displayed in the menu? I'm creating a game where the uniform displayed on the character will show you a picture on the collar. But with the latest version every time I try and tell it to read from the Game_Actor Class it keeps telling me that one or more of my methods aren't defined. Other scripts that I've hooked into it work perfectly but this one. Any Suggestions?
 
Code:
#==============================================================================
# â–  Visual Equipment
#------------------------------------------------------------------------------
# Author  | Meâ„¢ / me@solarsoft.nl
# Version | 2.3.65
# Date    | 18 / 11 / 06
# Credit  | Raitaime - Geso Chiku
#==============================================================================
#
#   â–¼ 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
  #--------------------------------------------------------------------------
  Width                 = 128 
  Height                = 192 
  Event_equipments      = 5
  Frames                = 4
  Directions            = 4
  Guillaume777          = 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 [false,0] if item_id == 1
    else
      #---------------------------------------------------------
      # Body Armors should have type 1
      #---------------------------------------------------------
      return ["sur_top",0]      if item_id == 2
      return ["sur_bottom",0]   if item_id == 1
      
      return ["sav_top",0]      if item_id == 4
      return ["sav_bottom",0]   if item_id == 3
      
      return ["hir_top",0]      if item_id == 7
      return ["hir_bottom",0]   if item_id == 6
      return ["hir_shoes",0]    if item_id == 13
      
      return ["brwn_top",0]     if item_id == 8
      return ["brown_gloves",0] if item_id == 14

      return ["adv_top",0]      if item_id == 10
      return ["adv_bottom",0]   if item_id == 12
      return ["adv_shoes",0]    if item_id == 11
      
      return ["bl_top",0]       if item_id == 9
      return ["mage_robe",0]    if item_id == 5
      
      return ["brd_top",0]      if item_id == 15
      return ["brd_bottom",0]   if item_id == 16
      return ["brd_cap",0]      if item_id == 17
      
      return ["str_bottom",0]   if item_id == 18
      return ["str_top",0]      if item_id == 19
      return ["str_gog",0]      if item_id == 20
      
      
      #---------------------------------------------------------
      # Helmets should have type 2
      #---------------------------------------------------------
      #---------------------------------------------------------
      # Assesoiry's should have type 3
      #---------------------------------------------------------
      #---------------------------------------------------------
      # Shields should have type 4
      #---------------------------------------------------------
    end
    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
    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_itemid(type, actor)
    return [] if Guillaume777 != 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

#==============================================================================
# ** 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
    # 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_equipments
    return [] if Visual_Equipment::Guillaume777 != 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_itemid(5, self)
    armors     = Visual_Equipment.guill_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?
    if Visual_Equipment::Guillaume777 != true
      number = 5
    elsif Visual_Equipment::Guillaume777 == true
      number = G7_MS_MOD::WEAPON_KINDS.size + G7_MS_MOD::ARMOR_KINDS.size
    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
    # 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_changed_equipment?
    return false if Visual_Equipment::Guillaume777 != 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_itemid(5, @actor)
      armors   = Visual_Equipment.guill_itemid(2, @actor)
      for id in 0..armors.size
        start = id
        return true if @equips_id[id] != armors[id]
      end
      for id in (start+1)..weapons.size
        return true if @equips_id[id] != weapons[id]
      end
      body = Visual_Equipment.guill_itemid(0, @actor)
      for i in 0..3
        return true if @body_id[i] != body[i]
      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
  end
  #--------------------------------------------------------------------------
  # * Update known equipment
  #--------------------------------------------------------------------------
  def update_equipment
    return false if Visual_Equipment::Guillaume777 == 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.get_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_update_equipment
    return false if Visual_Equipment::Guillaume777 != 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_itemid(1, @actor)
      armors   = Visual_Equipment.guill_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_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_changed_equipment?
      # First, update the information known
      if Visual_Equipment::Guillaume777 != true
        update_equipment
      elsif Visual_Equipment::Guillaume777 == true
        guill_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
          equips = @actor.get_equipments
        elsif Visual_Equipment::Guillaume777 != false
          equips = @actor.guill_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
      equips = actor.get_equipments
    elsif Visual_Equipment::Guillaume777 != false
      equips = actor.guill_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

No time to make the demo, having exams.
 
Two things regarding this new script. There's a problem with the script crashing to desktop when put into a N+ game or if it is inserted into a normal game it comes up with an error about Game_NetPlayer not being present. Also is there a way to tell you're script to work off of variables. For example my game has a military in it and I would like the uniforms they wear to change as years go on. I have a bridge script running dubealex's Active Time Script and Kylock's Time System. What I need is to make your script work off of my scripts variables. The exact problem is that it won't read any methods in the Game_Actor class. Any help would be appreciated, thanks.
 
For the error put this above it:

Code:
class Game_NetPlayer < Game_Actor
end

For example my game has a military in it and I would like the uniforms they wear to change as years go on
You could make the page change (of the event)

The exact problem is that it won't read any methods in the Game_Actor class. Any help would be appreciated, thanks.
Events go with the pages, not the game_actor class but Game_Event.
 
Well I was hoping the script could read the Actor class because my characters need to change cloths not only depending on the armor they are wearing, but the time period is also a factor in how the character looks. The way I had is before the last two updates was:

"#{actor.time}/#{actor.class_name}/#{actor.time} (#{actor.class_id})

But for some reason it doesn't take too well to it.
 
I would like to request a merge with the Train Actor script. I don't think the script is meant for SDK therefore it did not work with your visual equipment script. I really liked your script, Me, it was really cool. However is it possible to make it compatible with this script?

# train_actor

=begin
Caterpillar walking script

Copyright © 2005 fukuyama

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

http://www.gnu.org/licenses/lgpl.html
http://www.opensource.gr.jp/lesser/lgpl.ja.html

=end

# Config.rb
#==============================================================================
# â–  Train_Actor::Config
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

# ●Switch setup for transparent status
# When true, switch control is used
# TRANSPARENT_SWITCH = true
TRANSPARENT_SWITCH = true

# ●Switch number for transparent status
# When TRANSPARENT_SWITCH is true, transparency will be activated when the switch of this number is on
TRANSPARENT_SWITCHES_INDEX = 1

# ●Maximum number of actors
# There will be support for a large number of people in a party in the future...
TRAIN_ACTOR_SIZE_MAX = 4

# Constants
DOWN_LEFT = 1
DOWN_RIGHT = 3
UP_LEFT = 7
UP_RIGHT = 9
JUMP = 5

# Put any actor IDs who should have a "stopped animation" if in the caterpillar
# i.e. if a party member "is floating" it will look stupid if he suddenly stops
# moving in the air.
# - added by Blizzard
ACTOR_IDS = [2, 3, 4]

end

# rgss

# Spriteset_Map_Module.rb
#==============================================================================
# â–  Spriteset_Map_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

module Spriteset_Map_Module
def setup_actor_character_sprites?
return @setup_actor_character_sprites_flag != nil
end
def setup_actor_character_sprites(characters)
if !setup_actor_character_sprites?
for character in characters.reverse
@character_sprites.unshift(
Sprite_Character.new(@viewport1, character)
)
end
@setup_actor_character_sprites_flag = true
end
end
end

end

class Spriteset_Map
include Train_Actor::Spriteset_Map_Module
end

# Scene_Map_Module.rb
#==============================================================================
# â–  Scene_Map_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

module Scene_Map_Module
def setup_actor_character_sprites(characters)
@spriteset.setup_actor_character_sprites(characters)
end
end

end

class Scene_Map
include Train_Actor::Scene_Map_Module
end

# Game_Party_Module.rb
#==============================================================================
# â–  Game_Party_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

module Game_Party_Module

attr_reader :characters

def update_party_order() return actors end

def setup_actor_character_sprites
if @characters.nil?
@characters = []
for i in 1 ... TRAIN_ACTOR_SIZE_MAX
@characters.push(Game_Party_Actor.new)
end
end
setup_actors = update_party_order
for i in 1 ... TRAIN_ACTOR_SIZE_MAX
@characters[i - 1].setup(setup_actors)
end
if $scene.class.method_defined?('setup_actor_character_sprites')
$scene.setup_actor_character_sprites(@characters)
end
end

def update_party_actors
update_party_order
setup_actor_character_sprites
transparent = $game_player.transparent
if transparent == false and TRANSPARENT_SWITCH
transparent = $game_switches[TRANSPARENT_SWITCHES_INDEX]
end
for character in @characters
character.transparent = transparent
character.move_speed = $game_player.move_speed
if ACTOR_IDS.include?(character.cp_id) # Blizzard's support for stopped animation
character.step_anime = true # Blizzard's support for stopped animation
else # Blizzard's support for stopped animation
character.step_anime = $game_player.step_anime
end # Blizzard's support for stopped animation
character.update
end
end

def moveto_party_actors( x, y )
setup_actor_character_sprites
for character in @characters
character.moveto( x, y )
end
@move_list = [] if @move_list == nil
move_list_setup
end

def move_party_actors
if @move_list == nil
@move_list = []
move_list_setup
end
@move_list.each_index do |i|
if @characters != nil
case @move_list.type
when Input::DOWN
@characters.move_down(@move_list.args[0])
when Input::LEFT
@characters.move_left(@move_list.args[0])
when Input::RIGHT
@characters.move_right(@move_list.args[0])
when Input::UP
@characters.move_up(@move_list.args[0])
when DOWN_LEFT
@characters.move_lower_left
when DOWN_RIGHT
@characters.move_lower_right
when UP_LEFT
@characters.move_upper_left
when UP_RIGHT
@characters.move_upper_right
when JUMP
@characters.jump(@move_list.args[0],@move_list.args[1])
end
end
end
end

class Move_List_Element

def initialize(type,args)
@type = type
@args = args
end

def type() return @type end

def args() return @args end

end

def move_list_setup
for i in 0 .. TRAIN_ACTOR_SIZE_MAX
@move_list = nil
end
end

def add_move_list(type,*args)
@move_list.unshift(Move_List_Element.new(type,args)).pop
end

def move_down_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::DOWN,turn_enabled)
end

def move_left_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::LEFT,turn_enabled)
end

def move_right_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::RIGHT,turn_enabled)
end

def move_up_party_actors(turn_enabled = true)
move_party_actors
add_move_list(Input::UP,turn_enabled)
end

def move_lower_left_party_actors
move_party_actors
add_move_list(DOWN_LEFT)
end

def move_lower_right_party_actors
move_party_actors
add_move_list(DOWN_RIGHT)
end

def move_upper_left_party_actors
move_party_actors
add_move_list(UP_LEFT)
end

def move_upper_right_party_actors
move_party_actors
add_move_list(UP_RIGHT)
end

def jump_party_actors(x_plus, y_plus)
move_party_actors
add_move_list(JUMP,x_plus, y_plus)
end

end

end

class Game_Party
include Train_Actor::Game_Party_Module
end

# Game_Player_Module.rb
#==============================================================================
# â–  Game_Player_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

module Game_Player_Module

attr_reader :move_speed
attr_reader :step_anime

def update_party_actors
$game_party.update_party_actors
$game_party.actors.each do |actor|
@character_name = actor.character_name
@character_hue = actor.character_hue
break
end
end

def update
update_party_actors
super
end

def moveto( x, y )
$game_party.moveto_party_actors( x, y )
super( x, y )
end

def move_down(turn_enabled = true)
if passable?(@x, @y, Input::DOWN)
$game_party.move_down_party_actors(turn_enabled)
end
super(turn_enabled)
end

def move_left(turn_enabled = true)
if passable?(@x, @y, Input::LEFT)
$game_party.move_left_party_actors(turn_enabled)
end
super(turn_enabled)
end

def move_right(turn_enabled = true)
if passable?(@x, @y, Input::RIGHT)
$game_party.move_right_party_actors(turn_enabled)
end
super(turn_enabled)
end

def move_up(turn_enabled = true)
if passable?(@x, @y, Input::UP)
$game_party.move_up_party_actors(turn_enabled)
end
super(turn_enabled)
end

def move_lower_left
# When possible to move from down→left or from left→down
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
$game_party.move_lower_left_party_actors
end
super
end

def move_lower_right
# When possible to move from down→right or from right→down
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
$game_party.move_lower_right_party_actors
end
super
end

def move_upper_left
# When possible to move from up→left or from left→up
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
$game_party.move_upper_left_party_actors
end
super
end

def move_upper_right
# When possible to move from up→right or from right→up
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
$game_party.move_upper_right_party_actors
end
super
end

def jump(x_plus, y_plus)
# New coordinates are calculated
new_x = @x + x_plus
new_y = @y + y_plus
# When addition values are (0,0), it is possible to jump to the destination
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
$game_party.jump_party_actors(x_plus, y_plus)
end
super(x_plus, y_plus)
end

end

end

class Game_Player
include Train_Actor::Game_Player_Module
end

# Game_Event_Module.rb
#==============================================================================
# â–  Game_Event_Module
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

module Game_Event_Module
#--------------------------------------------------------------------------
# ● Judgement determined
# x : X coordinates
# y : Y coordinates
# d : Direction (0,2,4,6,8) ※ 0 = Checks if all directions are not able to be passed (for a jump)
# return : Passing is impossible (false), possible (true)
#--------------------------------------------------------------------------
def passable?(x, y, d)
result = super(x, y, d)
if result
# New coordinates are searched for
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# Loops for actor in train
for actor in $game_party.characters
# When displayed
if not actor.character_name.empty?
# When actor's coordinates correspond to the destination
if actor.x == new_x and actor.y == new_y
# When event
return false if self != $game_player
end
end
end
end
return result
end

end

end

class Game_Event
include Train_Actor::Game_Event_Module
end

# Game_Party_Actor.rb
#==============================================================================
# â–  Game_Party_Actor
#------------------------------------------------------------------------------
# Caterpillar movement of actor is carried out on map
#==============================================================================

module Train_Actor

class Game_Party_Actor < Game_Character

attr_reader :cp_id
attr_writer :move_speed
attr_writer :step_anime

def initialize
super()
@through = true
end

def setup(actor)
# The file name and hue of the character are set
@cp_id = $data_actors[actor.id].id
if actor != nil
@character_name = actor.character_name
@character_hue = actor.character_hue
# Opacity and blending method are initialized
@opacity = 255
@blend_type = 0


# YBM edited this to show character dead graphic


if actor.dead?
case @cp_id
when 1
@opacity = 100
when 2
@character_name = 'empty'
when 3
@character_name = 'whitemage'
@opacity = 150
else
@character_name = 'amberdown'
end
end
# YBM


else
@character_name = ""
@character_hue = 0
# Opacity and blending method are initialized
@opacity = 255
@blend_type = 0
end

# Opacity and blending method are initialized
#YBM @opacity = 255
#YBM @blend_type = 0
end

def screen_z(height = 0)
if $game_player.x == @x and $game_player.y == @y
return $game_player.screen_z(height) - 1
end
super(height)
end
#--------------------------------------------------------------------------
# ● Move down
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
# Face down
turn_down if turn_enabled
# When possible to pass
if passable?(@x, @y, Input::DOWN)
# Face down
turn_down
# Update coordinates
@y += 1
end
end
#--------------------------------------------------------------------------
# ● Move left
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
# Face left
turn_left if turn_enabled
# When possible to pass
if passable?(@x, @y, Input::LEFT)
# Face left
turn_left
# Update coordinates
@x -= 1
end
end
#--------------------------------------------------------------------------
# ● Move right
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
# Face right
turn_right if turn_enabled
# When possible to pass
if passable?(@x, @y, Input::RIGHT)
# Face right
turn_right
# Update coordinates
@x += 1
end
end
#--------------------------------------------------------------------------
# ● Move up
# turn_enabled : Flag that permits direction change on the spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
# Face up
turn_up if turn_enabled
# When possible to pass
if passable?(@x, @y, Input::UP)
# Face up
turn_up
# Update coordinates
@y -= 1
end
end
#--------------------------------------------------------------------------
# ● Move lower left
#--------------------------------------------------------------------------
def move_lower_left
# When no direction fixation
unless @direction_fix
# Turn left when facing right, turn down when facing up
@direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::UP ? Input::DOWN : @direction)
end
# When possible to move from down→left or from left→down
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN))
# Update coordinates
@x -= 1
@y += 1
end
end
#--------------------------------------------------------------------------
# ● Move lower right
#--------------------------------------------------------------------------
def move_lower_right
# When no direction fixation
unless @direction_fix
# Turn right when facing left, turn down when facing up
@direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::UP ? Input::DOWN : @direction)
end
# When possible to move from down→right or from right→down
if (passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN))
# Update coordinates
@x += 1
@y += 1
end
end
#--------------------------------------------------------------------------
# ● move upper left
#--------------------------------------------------------------------------
def move_upper_left
# When no direction fixation
unless @direction_fix
# Turn left when facing right, turn up when facing down
@direction = (@direction == Input::RIGHT ? Input::LEFT : @direction == Input::DOWN ? Input::UP : @direction)
end
# When possible to move from up→left or from left→up
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT)) or
(passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP))
# Update coordinates
@x -= 1
@y -= 1
end
end
#--------------------------------------------------------------------------
# ● move upper right
#--------------------------------------------------------------------------
def move_upper_right
# When no direction fixation
unless @direction_fix
# Turn right when facing left, turn up when facing down
@direction = (@direction == Input::LEFT ? Input::RIGHT : @direction == Input::DOWN ? Input::UP : @direction)
end
# When possible to move from up→right or from right→up
if (passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT)) or
(passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP))
# Update coordinates
@x += 1
@y -= 1
end
end

end

end


And do I have to change anything if I want the visual equipment script to work with larger charactersets? I know your script supports even Half Kaizer sprites but if I want to have some standard RTP sized chars and some Half Kaizer sized chars, would I have to change any settings in your script? And what should I edit if I want the visual equipment overlay to disappear if the actor is knocked out? Or is it possible to have another set of 'down' armor sprites overlayed if the actor is 'down' to show the armor overlay even when the actor's graphic has changed? I am really interested to know. Thanks.
 
train_actor
I am still working on that one. Should be not that hard, but did not figured it out yet however. I willl alsp try to make it work with Spehies one.

different_sizes
the script looks to the base image. So if the actors graphic is a RTP sized, all the equipments will be adapted to that, if the actors graphic is a Hal-Faizer, all the equipments will be adapdet to that. So yes, you can use both.

knock_out
Good Idea, I should write a little code for this.

btw... I am working to make thos work with Tricksters Mutli-Equip Script.
 
How about actor "battlers"? Granted, it would probably mean a single size/shape/pose for all the battler images so the armor and weapons would show on any battler... assuming that the armor/weapons are usable by all the battlers.

I know that Rytheon and tibuda mentioned it a month ago, but that seems to be a logical extension to the system.
 

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