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.

[RMVX]Multiple Copies Of Same Actor

Hi im looking for a script on RMVX to allow multiple copies of the same actor, nothing fancy. I just want it so that I can use the add member command for the same character twice. I am creating sort of a creature scripts kit adapted from the RMXP version which was helpful to many.

Thank you.
 

Tdata

Sponsor

Code:
class Game_Party < Game_Unit
 def add_actor(actor_id)
    if @actors.size < MAX_MEMBERS
      @actors.push(actor_id)
      $game_player.refresh
    end
  end
Add this in your 'â–¼ Materials' section.
 
You need to replace Game_Actors (NOT Game_Actor) with this:

Code:
#==============================================================================
# ** Game_Actors
#------------------------------------------------------------------------------
#  This class handles the actor array. The instance of this class is
# referenced by $game_actors.
#==============================================================================

class Game_Actors
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @data = {}
  end
  #--------------------------------------------------------------------------
  # * Get Actor
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def [](actor_id, instance = 0)
    if @data[actor_id, instance] == nil and $data_actors[actor_id] != nil
      @data[actor_id, instance] = Game_Actor.new(actor_id)
    end
    return @data[actor_id, instance]
  end
end

Then add this in the materials section:

Code:
class Game_Party
  #--------------------------------------------------------------------------
  # * Get Members
  #--------------------------------------------------------------------------
  def members
    result = []
    indeces = []
    for i in @actors
      num = 0
      indeces.each {|val| num += 1 if val == i}
      result.push($game_actors[i, num])
      indeces.push(i)
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Add an Actor
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def add_actor(actor_id)
    if @actors.size < MAX_MEMBERS
      @actors.push(actor_id)
      $game_player.refresh
    end
  end
end
 

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