RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Problem with Algebra's Visual Equipment

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 84
Above Characters
Hi everybody! Im new at rmvx and scripting so can someone help me?

At new game i got an error:
"Script 'Visual Equipment' line 87: RGSSError occurred.
failed to create bitmap"



Code: [Select]
#==============================================================================
#  Composite Characters / Visual Equipment
#  Version 1.0
#  Author: modern algebra (rmrk.net)
#  Date: July 5, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#
#    Place this script in between Materials and Main in the Script Editor
#
#    To set a graphic for an armor or weapon, all you need to do is place this
#  code in the Notes box of the item:
#
#    \CG[<Name of Character Set>, <index in character set>, <hue>]
#
#  If you leave out index, it defaults to 0 and if you leave out hue, it also
#  defaults to 0. You can put more than one graphic to an armor or weapon and
#  they will stack, first one on bottom last one on top.
#
#    Setting up an Event is similar - all you need to do is place a comment at
#  the very beginning of the event and put in the same code to generate a
#  composite character set for the event. Same rules apply, and remember, you
#  can stack character sets.
#
#  EXAMPLES:
#    \cg[Actor1, 2]     # Character Set = Actor1 : index = 2 : hue = 0
#    \CG[Evil]          # Character Set = Evil   : index = 0 : hue = 0
#    \cG[Actor2, 3, 50] # Character Set = Actor2 : index = 3 : hue = 50
#
#  Setting up your Actors is similar - see line 151 for details.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Compatibility:
#
#    Unfortunately, I did need to overwrite some methods for this script, and
#  as such there are likely to be compatibility problems. I know that my
#  Extra Movement Frames Script certainly will not work with this script, and
#  any script that tampers with the way a character set is drawn will also
#  likely encounter problems. Now, this is not to say that any script that
#  draws a character set will be incompatible - as long as that scripter uses
#  the draw_actor_graphic method of Window_Base it should work fine - it is
#  only scripts that change the way a character set is drawn that will cause
#  problems. Also, I tamper with the load_gamedata method of Window_SaveFile,
#  and so if another script overwrites that then there will again be
#  compatibility issues. If you find a script that seems to cause problems,
#  please post at the topic at rmrk.net and I will try my best to assist you.
#==============================================================================

#==============================================================================
# *** module Cache
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new method - composite_character
#==============================================================================

module Cache
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Composite Character
  #    char_array : An array holding the names of all parts of a graphic
  #--------------------------------------------------------------------------
  #  Composes a single character bitmap out of all the ones given.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def self.composite_character (char_array)
    @cache = {} if @cache == nil
    # Blank bitmap if there is nothing in the array.
    @cache[char_array] = Bitmap.new (32, 32) if char_array.empty?
    # If not in the cache
    if !@cache.include? (char_array) || @cache[char_array].disposed?
      # Create a template bitmap
      bitmap = Bitmap.new (32, 32)
      # Add in all other graphics
      char_array.each { |i|
        name, index, hue = i[0], i[1], i[2]
        # Bypass self.character in order to allow for setting hue
        bmp = load_bitmap ("Graphics/Characters/", name, hue)
        sign = name[/^[\!\$]./]
        # Get the width and height of the single character
        if sign != nil && sign.include? ('$')
          wdth, hght = bmp.width, bmp.height
        else
          wdth = bmp.width / 4
          hght = bmp.height / 2
        end
        # Expand bitmap if necessary
        if bitmap.width < wdth || bitmap.height < hght
          # Recreate bitmap
          temp_bmp = bitmap.dup
          bitmap = Bitmap.new ([temp_bmp.width, wdth].max, [temp_bmp.height, hght].max)
          bitmap.blt (0, 0, temp_bmp, temp_bmp.rect)
          temp_bmp.dispose
        end
        # Draw new character graphic onto bitmap
        src_rect = Rect.new ((index%4)*wdth, (index/4)*hght, wdth, hght)
        bitmap.blt (0, 0, bmp, src_rect)
      }
      @cache[char_array] = bitmap
    end
    return @cache[char_array]
  end
end

#==============================================================================
# ** RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new method - character_graphics
#==============================================================================

class RPG::BaseItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Character Graphics
  #--------------------------------------------------------------------------
  #  Retrieves Character Graphics from Note Field
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def character_graphics
    graphics = []
    # Retrieve Note Field
    text = self.note.dup
    while text.sub! (/\\cg\[([\w\s]+),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
      graphics.push ([$1.to_s, $2.to_i, $3.to_i])
    end
    return graphics
  end
end


#==============================================================================
# ** Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new method - composite_character
#    aliased_method - initialize, change_equip
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_writer :composite_character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initalization
  #-------------------------------------------------------------------------
  #  Initializes stacked_character variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_arclght_vsual_equip_init_4t6h initialize
  def initialize (id)
    # Run Original Method
    modalg_arclght_vsual_equip_init_4t6h (id)
    @composite_character = []
    case @actor_id
    #---------------------------------------------------------------------
    # EDITABLE REGION
    #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
    #  An actor will automatically have whatever you set in the database
    #  as a bottom layer for him, but if you need to have other character
    #  sets piled on top, then put them in this format:
    #
    #  when <actor_id>
    #    @composite_character.push (['graphic_name', index, hue])
    #      *for as many graphics as you want - first ones drawn first. If you
    #       want to know what each is, see the Instructions in the header.
    #----------------------------------------------------------------------
    when 1 # 1st Actor
      # Create Hair Sprite
      @composite_character.push (['charsettest', 3, 100])
      @composite_character.push (['charsettest', 2, 100])
    when 3 # 3rd Actor
      # Create skin sprite with different hue
      @composite_character.push (['charsettest', 0, 20])
      # Create Hair Sprites
      @composite_character.push (['charsettest', 1, 75])
    #----------------------------------------------------------------------
    # END EDITABLE REGION
    #----------------------------------------------------------------------
    end
    @composite_character.each { |i|
      i[1] = 0 if i[1] == nil
      i[2] = 0 if i[2] == nil
    }
    @composite_character.unshift ([@character_name, @character_index, 0]) if @character_name != ''
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Composite Character
  #--------------------------------------------------------------------------
  #  Returns Graphic Array for the actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def composite_character
    armor_graphics = []
    weapon_graphics = []
    # Body Armor, then Helmet, then Shield, then all others
    dup_armors = armors.dup
    for i in 0...2
      j = 2 - i
      armor_graphics += dup_armors[j].character_graphics if dup_armors[j] != nil
      dup_armors.delete_at (j)
    end
    # If there is some multi-equip script, will get accessories and rest in order
    dup_armors.each { |armr| armor_graphics += armr.character_graphics if armr != nil }
    weapons.each { |wpn| weapon_graphics += wpn.character_graphics if wpn != nil }
    return @composite_character + armor_graphics + weapon_graphics
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Equipment (designate object)
  #--------------------------------------------------------------------------
  #  Refresh Player to demonstrate armor cg
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_rfrsh_plyer_eq_chnge_8mj2 change_equip
  def change_equip(equip_type, item, test = false)
    modalg_rfrsh_plyer_eq_chnge_8mj2 (equip_type, item, test)
    $game_player.refresh
  end
end

#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party
  attr_reader :actors
end

#==============================================================================
# ** Game_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    new instance variable - composite_character
#==============================================================================

class Game_Character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader :composite_character
end

#==============================================================================
# ** Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased methods - setup
#==============================================================================

class Game_Event
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Event page setup
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malgbr_rclgh_req_comp_char_setup_5msk setup
  def setup(new_page)
    malgbr_rclgh_req_comp_char_setup_5msk (new_page)
    # Create Composite Character
    @composite_character = []
    @composite_character.push ([@character_name, @character_index, 0]) unless @character_name.nil?
    # If page == nil, return
    return if @page == nil
    # Retrieve  first line comments
    comments = []
    @page.list.each { |i| i.code == 108 || i.code == 408 ? comments.push (i) : break }
    # Evaluate comments for \CG codes
    comments.each { |i|
      text = i.parameters[0].dup
      while text.sub! (/\\cg\[([\w\s]+),*\s*(\d*),*\s*(\d*)\]/i) { '' } != nil
        @composite_character.push ([$1.to_s, $2.to_i, $3.to_i])
      end
    }
  end
end

#==============================================================================
# ** Game_Player
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased method - refresh
#==============================================================================

class Game_Player
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdalg_arc_comp_character_find_rfrsh_8kwi refresh
  def refresh
    mdalg_arc_comp_character_find_rfrsh_8kwi
    return if $game_party.members.empty?
    @composite_character = $game_party.members[0].composite_character
  end
end

#==============================================================================
# ** Sprite_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased method - update_bitmap
#==============================================================================

class Sprite_Character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Transfer Origin Bitmap
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modern_alg_arclightrequest_visual_equip_bmp_update update_bitmap
  def update_bitmap
    if @tile_id != @character.tile_id or
       @character_name != @character.character_name or
       @character_index != @character.character_index ||
       @composite_character != @character.composite_character
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_index = 0
      @composite_character = @character.composite_character
      if @tile_id > 0
        sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
        sy = @tile_id % 256 / 8 % 16 * 32;
        self.bitmap = tileset_bitmap(@tile_id)
        self.src_rect.set(sx, sy, 32, 32)
        self.ox = 16
        self.oy = 32
      else
        if @composite_character == nil
          # Regular Character Picture
          self.bitmap = Cache.character(@character_name)
          sign = @character_name[/^[\!\$]./]
          if sign != nil and sign.include?('$')
            @cw = bitmap.width / 3
            @ch = bitmap.height / 4
          else
            @cw = bitmap.width / 12
            @ch = bitmap.height / 8
          end
        else
          self.bitmap = Cache.composite_character(@composite_character)
          @cw = self.bitmap.width / 3
          @ch = self.bitmap.height / 4
        end
          self.ox = @cw / 2
          self.oy = @ch
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Transfer Origin Rectangle
  #--------------------------------------------------------------------------
  def update_src_rect
    if @tile_id == 0
      index = 0
      pattern = @character.pattern < 3 ? @character.pattern : 1
      sx = (index % 4 * 3 + pattern) * @cw
      sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
      self.src_rect.set(sx, sy, @cw, @ch)
    end
  end
end

#==============================================================================
# ** Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    overwritten method - draw_character_graphic
#==============================================================================

class Window_Base 
  #--------------------------------------------------------------------------
  # * Draw Actor Walking Graphic
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y)
    bitmap = Cache.composite_character (actor.composite_character)
    cw = bitmap.width / 3
    ch = bitmap.height / 4
    rect = Rect.new (cw, 0, cw, ch)
    self.contents.blt (x - (cw / 2), y - ch, bitmap, rect)
  end
end

#==============================================================================
# ** Window_SaveFile
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    overwritten_methods - load_gamedata,
#==============================================================================

class Window_SaveFile < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Load Partial Game Data
  #--------------------------------------------------------------------------
  #  The same as the original method with the exception that it gets all of
  #  that file's data up to @game_party - necessary for composite graphics
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def load_gamedata
    @time_stamp = Time.at(0)
    @file_exist = FileTest.exist?(@filename)
    if @file_exist
      file = File.open(@filename, "r")
      @time_stamp = file.mtime
      begin
        @characters     = Marshal.load(file)
        @frame_count    = Marshal.load(file)
        @last_bgm       = Marshal.load(file)
        @last_bgs       = Marshal.load(file)
        @game_system    = Marshal.load(file)
        @game_message   = Marshal.load(file)
        @game_switches  = Marshal.load(file)
        @game_variables = Marshal.load(file)
        # Bypass self-switches
        @game_self_switches = Marshal.load(file)
        # Bypass Actors
        @game_actors = Marshal.load(file)
        # Get Party
        @game_party = Marshal.load (file)
        @total_sec = @frame_count / Graphics.frame_rate
      rescue
        @file_exist = false
      ensure
        file.close
      end
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Party Characters
  #     x : Draw spot X coordinate
  #     y : Draw spot Y coordinate
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def draw_party_characters(x, y)
    for i in 0...@game_party.actors.size
      draw_actor_graphic (@game_actors[@game_party.actors[i]], x + i * 48, y)
    end
  end
end

something wrong with the script or i missing something?
i've done everything just like in a description but the error still pops up
i also tested it without non-default scripts with the same result
i would be very appreciated if someone could give at least an advice or something  :-\

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Hmm, my first thought would be a problem with your resource specifications. What are the graphics you are using?

**
Rep: +0/-0Level 84
Above Characters
Im just modified a bit your character set to test a script



a usual png with tranparency




**
Rep: +0/-0Level 84
Above Characters
Suddenly ive found a cause - i used parallaxes for backgrounds and shadows.
Without them game runs properly.
Please dont tell me i cant use parallaxes with this awesome script ;9
Maybe there is a way to use them both?

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
If it's the parallaxes causing this, then I will certainly fix it. Could you upload your project (or recreate the error in a separate project and upload that) and I will try to find a fix.

**
Rep: +0/-0Level 84
Above Characters
 here
 http://www.mediafire.com/file/uqno5r5xuxm/Error.rar

i noticed that error occurres only when im using gigantic overlay parallaxes

**
Rep: +0/-0Level 84
Above Characters