Advertisement
Fomar0153

Fomar0153 - Clone Actor Script 1.0

Feb 18th, 2012
1,671
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.60 KB | None | 0 0
  1. =begin
  2. Clone Actor Script
  3. by Fomar0153
  4. Version 1.0
  5. ----------------------
  6. Notes
  7. ----------------------
  8. No requirements
  9. Allows you to "clone" an actor. The clones will be an exact copy
  10. of the chosen actor in the database.
  11. ----------------------
  12. Instructions
  13. ----------------------
  14. You create a clone by calling:
  15. $game_actors[id,true]
  16. and it will return the physical id of the clone.
  17. I reccomend doing something like:
  18. $game_variables[1]=$game_actors[1,true]
  19. $game_party.add_actor($game_variables[1])
  20.  
  21. You will also need to set:
  22. CLONE_ID_START
  23. you'll find it at the top of the script.
  24. Anyone whose id is less than this number will work like normal.
  25. Anyone whose id is larger than or equal to this number can only exist
  26. as clones. So I reccomend using them as templates for the clones.
  27. ----------------------
  28. Known bugs
  29. ----------------------
  30. None
  31. =end
  32. class Game_Actors
  33.   #--------------------------------------------------------------------------
  34.   # ● Basically this protects the first 8 party members and lets them
  35.   #   function as normal. All clones will start from this id.
  36.   #--------------------------------------------------------------------------
  37.   CLONE_ID_START = 9
  38.   #--------------------------------------------------------------------------
  39.   # ● Aliases initialize
  40.   #--------------------------------------------------------------------------
  41.   alias clone_initialize initialize
  42.   def initialize
  43.     clone_initialize
  44.     @clone_index = CLONE_ID_START
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● Rewrites []
  48.   #--------------------------------------------------------------------------
  49.   def [](actor_id, clone = false)
  50.     if clone
  51.       @data[@clone_index] = Game_Actor.new(actor_id)
  52.       @data[@clone_index].clone_id = @clone_index
  53.       @clone_index += 1
  54.       return @clone_index - 1
  55.     else
  56.       if actor_id < CLONE_ID_START
  57.         return nil unless $data_actors[actor_id]
  58.         @data[actor_id] ||= Game_Actor.new(actor_id)
  59.       else
  60.         return @data[actor_id]
  61.       end
  62.     end
  63.   end
  64. end
  65.  
  66. class Game_Actor < Game_Battler
  67.   #--------------------------------------------------------------------------
  68.   # ● New accessor
  69.   #--------------------------------------------------------------------------
  70.   attr_accessor :clone_id
  71.   #--------------------------------------------------------------------------
  72.   # ● Aliases id
  73.   #--------------------------------------------------------------------------
  74.   alias clone_id id
  75.   def id
  76.     return @clone_id unless @clone_id.nil?
  77.     return clone_id
  78.   end
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement