The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: Infinate X on March 26, 2011, 06:55:32 AM

Title: [RESOLVED] Actor Clones
Post by: Infinate X on March 26, 2011, 06:55:32 AM
Can somebody make a script where you can have more than 1 of the same actor in your party at once? It would be a lot better then making 60 of the same actor...

It would be appreciated.

Only 2 scripters have said this is useless which is why I can't request this on RPGRevolution.net ( I removed the emotico because dricc threatened me... I think it was what he was talking about!)

I have decidied to simplify my request for how readers understand it

Actor Clones
February 27 2011


--------------------------------------------------------------------------------

Summary
I need a script that allows you to have ininate of the same actor all with different stats, different level/experience, same initail level, if an item is used on one doesn't affect all unless it's supposed to, different states, and I also need it so when an actor joins your party it is given similar stats to the initial level and a similar exp. curve (Stat and Exp. Variations)    (Actors will not be named in my game except for database names)      (That means no name inputs from events except for one that won't be duplicated and possibly a species of an actor that has not been discovered since all of the duplicated actors are orginized into monster species)

Features Desired

•Stat and Experience Variations
•Infinate of each actor
•Items only affects 1 if items are only supposed to affect 1
•Actors don't share stats, states, or experience/level
•Initial Level Variations
•Should be EXTREMLY easy to edit and almost everything should be editable (every variation should be able to be turned on and off per actor and edit to how much higher or lower from the initial [variation name here] it was)  (basicly everything i the databse should be editable with the script except for what the initial stats, experience curve and level are)

Mockups
not needed since you don't see anything different

Games its been in

•Pokemon
•Digimon
•Dungeon Siege 2

What other scripts are you using?

•One of modern algebra's CMS scripts
•Party Organizer Script (i think it's this link: http://www.rpgrevolution.com/forums/index.php?showtopic=38215 )


--------------------------------------------------------------------------------

Did you search?
Yes

What did you search?
•Multi-actor
•Actor Clones
•Infinate Actors

Where did you search?
•rmrk.net
•rpgrevolution.net

I restarted the topic because nobody seemed to care...
Title: Re: [REQUEST] Actor Clones
Post by: dricc on March 28, 2011, 02:12:08 PM
First of all , show more respect and delete this infamous icon asap or i use the "alert the moderator" button .

Well , you're lucky , i have already made a small script like that :

Code: [Select]
class Game_Actors
  def clone(actor_id_orig,actor_id_dest)
    @data[actor_id_dest] = Game_Actor.new(actor_id_dest,actor_id_orig)
  end
end

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :actor_model_id                # accessory ID
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def initialize(actor_id,actor_model_id=nil)
    super()
    setup(actor_id,actor_model_id)
    @last_skill_id = 0
#    p actor_model_id if actor_id == 10
  end
 def setup(actor_id,actor_model_id=nil)
    @actor_model_id = actor_model_id if @actor_model_id == nil
    @actor_id = actor_id
    actor = $data_actors[actor_id]
    actor = $data_actors[@actor_model_id] if @actor_model_id != nil
    @name = actor.name
    @character_name = actor.character_name
    @character_index = actor.character_index
    @face_name = actor.face_name
    @face_index = actor.face_index
    @class_id = actor.class_id
    @weapon_id = actor.weapon_id
    @armor1_id = actor.armor1_id
    @armor2_id = actor.armor2_id
    @armor3_id = actor.armor3_id
    @armor4_id = actor.armor4_id
    @level = actor.initial_level
    @exp_list = Array.new(101)
    make_exp_list
    @exp = @exp_list[@level]
    @skills = []
    for i in self.class.learnings
      learn_skill(i.skill_id) if i.level <= @level
    end
    clear_extra_values
    recover_all
  end
    #--------------------------------------------------------------------------
  # * Get Actor Object
  #--------------------------------------------------------------------------
  def actor
    return $data_actors[@actor_model_id] if @actor_model_id != nil
    return $data_actors[@actor_id]
  end
end

In an event , use :
Call script : $game_actors.clone(1,10)

And the actor 1 will be duplicated in the actor 10 .
After that , if you add the actor 10 to your team , you will have 2 ralph (of course , it is 2 different ralph with their own level and equipment) .
By using variables and common event , you can make all that you need , i think .

for exemple , to duplicate the actor in variable 1 to the actor in variable 2 :
$game_actors.clone($game_variables[1],$game_variables[2])
Title: Re: [REQUEST] Actor Clones
Post by: Infinate X on April 01, 2011, 07:10:06 PM
Thank you SOOOOOOOOOOO MUUUUUUUUUUUUUCH for this!!!!!!!!!!!

If I knew who you were I would give you a pie.  :lol:

EDIT: Is there a way to make it the next unused actor ID?

I'll search through the script but I suck at scripting so I probably won't figure it out (It took me like 3 weeks to figure out how to make the name box in modern algebra's Advanced Text System script big enough to fit over 5 letters...
Title: Re: [RESOLVED BUT NOT FINISHED WITH] Actor Clones
Post by: dricc on April 04, 2011, 08:37:37 AM
Keep the next unused actor id in a variable ...
Title: Re: [RESOLVED BUT NOT FINISHED WITH] Actor Clones
Post by: Infinate X on April 05, 2011, 12:51:25 AM
Keep the next unused actor id in a variable ...

OMG!!!!! I FORGET IF I THOUGHT ABOUT THAT BUT I DON"T THINK I DID!!!! How do I use a Variable ID with this script?
Title: Re: [RESOLVED BUT NOT FINISHED WITH] Actor Clones
Post by: LoganF on April 05, 2011, 02:48:49 AM
Bit of a hack, but it works well enough.

In dricc's script, add the following to Class Game_Actors (top if his script) somewhere:

Code: [Select]
attr_reader :data

Without it, $game_actors doesn't want to give away too much about the @data variable which holds all the actors - that information is private - but this allows us to read the data and find out what we need to know (we cannot write to it from outside the class so it's safe.)

Anyway, to get this next slot put:

$game_variables[x] = $game_actors.data.size

replacing 'x' with the variable id you want this information to be stored in (be sure to reserve this variable only for this information or you'll have some funny things happen in your game). This bit goes in the Advanced -> Script... option of an event or common event somewhere, not in the Script database section.

Then when you want to clone an idea and drop this actor into the next free space, you can put:

$game_actors.clone(actor_id, $game_variables[x])

Where the 'x' is replaced by the id of that variable you made to keep track of the next free space. What you can do is put those two lines together in one event whenever you make a clone of an actor:

Code: [Select]
$game_variables[x] = $game_actors.data.size
$game_actors.clone(actor_id, $game_variables[x])

First line gets where the next free slot will be (because of the way arrays store data) and then clones the desired actor into this slot.

I did mess about with a few other ideas, but making @data readable seemed the easiest.
Title: Re: [RESOLVED BUT NOT FINISHED WITH] Actor Clones
Post by: dricc on April 05, 2011, 01:21:58 PM
A good idea , loganForrests .

That's not really what I was thinking . It is more something like this :
in the case of a PNJ would like to give you 2 actors like the actor 32 , You can make like this in your event :

Condition : If variable 299 == 0 Then : variable 299=101 end condition
Call script : $game_actors.clone(32,$game_variables[299])
Call script : $game_party.add_actor($game_variables[299])
Opération : variable 299 : +1
Call script : $game_actors.clone(32,$game_variables[299])
Call script : $game_party.add_actor($game_variables[299])
Opération : variable 299 : +1

I use the variable 299 there for the last unused actor id . And i am starting at 101 .
Rules to respect in this case : use 1 to 100 actor ids for your actor models . Never add one these actors to your party .

After that , you have 2 actors like the actor 32 in your party (real ids=101 and 102) .

A good news : i have tried to use this script with modern algebra's reserve party script ... and it works fine . I have tried with 4 ralph !
Title: Re: [RESOLVED BUT NOT FINISHED WITH] Actor Clones
Post by: Infinate X on April 06, 2011, 08:01:18 PM
@LoganForrests

I'm not a good scripter so it would be a miracle if I found where to put it, but I like how your idea works with the script calls

(EDIT: I forgot to mention I will try but I might not get it...)

@dricc

I know it's your script but I think Logan's idea for the script calls was A LOT simpilar...

BTW can I or you post this script on RPGRevolution.net? I wasn't allowed to request this there because one of the moderators and a scripter didn't like my request and said it was useless...   (The edit was an "I" was changed to an "a")
Title: Re: [RESOLVED BUT NOT FINISHED WITH] Actor Clones
Post by: Infinate X on April 13, 2011, 08:41:00 PM
I am about to attempt the script edit...

Never did it...
                                                       
Title: Re: [RESOLVED BUT NOT FINISHED WITH] Actor Clones
Post by: dricc on April 14, 2011, 06:57:02 PM
Use my script as you want ...
I will not post it on rmrk or rpgrevolution at this time . It is incomplete , i have to make something more "packaged" . I am already work on it but you can make your own version if you want .
Title: Re: [RESOLVED BUT NOT FINISHED WITH] Actor Clones
Post by: Infinate X on April 18, 2011, 08:34:00 PM
the only real script edit I made was the jump script I made it so if your not walking you can set a different amount of tiles to jump...


EDIT: I almost forgot when you finish the script will you be able to post it???
Title: Re: [NOW SCRIPT SUPPORT] Actor Clones
Post by: Infinate X on April 28, 2011, 09:02:08 PM
 8)
Title: Re: [NOW SCRIPT SUPPORT] Actor Clones
Post by: dricc on May 02, 2011, 08:18:37 AM
A more proper version .

Now , you can use the "Modify party : Add actor" option normally . If the actor is identified as a clonable one (a tag in the name) , you will have a clone instead of the model .
you can also open automatically the name window to give a new name .

Code: [Select]
# actor clones
# par dricc
# http://www.rpgmakervx-fr.com/
# USAGE :
# Utiliser "Modifier l'équipe : ajouter un membre" normallement
# Mais au lieu de l'acteur correspondant , ce sera un clone qui sera ajouté .
# Du coup , vous pouvez ajouter plusieurs fois le meme acteur .
# use "Modify party : Add actor" as usual
# But instead of the actor itself , it is a copy that will be added to your party

# Clone paramétrage : A vérifier avant usage !!
# Clone setup : check all these parameters before use !

module CLONE_SETUP
  # If true , the player will be asked to rename the clone
  RENAME_CLONE = true
  # if rename_clone at true , what is the max size for the name ?
  NAME_MAX_SIZE = 8
  # starting index for cloned actors
  ACTOR_CLONE_INDEX = 1000
  # the pattern to add to the name in the DB . add / before and after exemple : /<Pokemon>/
  # Note : if you put // , all actors will be cloned
  ACTOR_CLONE_PATTERN = /<model>/
end

# end setup
# fin paramétrage

# CODE

class Game_Actors
  attr_accessor :actor_clone_index
  alias dricc_initialize initialize
  def initialize
    @actor_clone_index = CLONE_SETUP::ACTOR_CLONE_INDEX
    dricc_initialize
  end
  def clone(actor_id_orig,actor_id_dest)
    @data[actor_id_dest] = Game_Actor.new(actor_id_dest,actor_id_orig)
  end
  def chg_name(actor_id,new_name)
    @data[actor_id].name = new_name
  end
end

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :actor_model_id                # accessory ID
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def initialize(actor_id,actor_model_id=nil)
    super()
    setup(actor_id,actor_model_id)
    @last_skill_id = 0
  end
 def setup(actor_id,actor_model_id=nil)
    @actor_model_id = actor_model_id if @actor_model_id == nil
    @actor_id = actor_id
    actor = $data_actors[actor_id]
    actor = $data_actors[@actor_model_id] if @actor_model_id != nil
    @name = actor.name
    @character_name = actor.character_name
    @character_index = actor.character_index
    @face_name = actor.face_name
    @face_index = actor.face_index
    @class_id = actor.class_id
    @weapon_id = actor.weapon_id
    @armor1_id = actor.armor1_id
    @armor2_id = actor.armor2_id
    @armor3_id = actor.armor3_id
    @armor4_id = actor.armor4_id
    @level = actor.initial_level
    @exp_list = Array.new(101)
    make_exp_list
    @exp = @exp_list[@level]
    @skills = []
    for i in self.class.learnings
      learn_skill(i.skill_id) if i.level <= @level
    end
    clear_extra_values
    recover_all
  end
    #--------------------------------------------------------------------------
  # * Get Actor Object
  #--------------------------------------------------------------------------
  def actor
    return $data_actors[@actor_model_id] if @actor_model_id != nil
    return $data_actors[@actor_id]
  end
end


class Game_Interpreter
 #--------------------------------------------------------------------------
  # * Change Party Member
  #--------------------------------------------------------------------------
  alias dricc_command_129 command_129
  def command_129
    actor = $game_actors[@params[0]]
    pattern = actor.name =~ CLONE_SETUP::ACTOR_CLONE_PATTERN ? 0 : 1
    if pattern == 0
      temp_name = actor.name.gsub(CLONE_SETUP::ACTOR_CLONE_PATTERN) {nil}
      if actor != nil
        if @params[1] == 0    # Add
# no initialize case in this script
#          if @params[2] == 1  # Initialize
            $game_actors.clone(@params[0],$game_actors.actor_clone_index)
            $game_actors.chg_name($game_actors.actor_clone_index,temp_name)
#$game_actors[@params[0]].setup(@params[0])
#          end
          $game_party.add_actor($game_actors.actor_clone_index)
          if CLONE_SETUP::RENAME_CLONE
            $game_temp.next_scene = "name"
            $game_temp.name_actor_id = $game_actors.actor_clone_index
            $game_temp.name_max_char = CLONE_SETUP::NAME_MAX_SIZE
          end
          $game_actors.actor_clone_index+=1
        else                  # Remove
          $game_party.remove_actor(@params[0])
        end
        $game_map.need_refresh = true
      end
    else
       dricc_command_129
    end
    return true
  end
end
Title: Re: [NOW SCRIPT SUPPORT] Actor Clones
Post by: modern algebra on May 02, 2011, 03:04:31 PM
Nice work dricc!
Title: Re: [NOW SCRIPT SUPPORT] Actor Clones
Post by: Infinate X on May 04, 2011, 07:47:28 PM
This is awesome since I don't need uber amounts of scripting in the events now


Thank you! Do you want a cookie?