vindaca510

V's State Transformations v0.1

Dec 22nd, 2013
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.60 KB | None | 0 0
  1. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  2. #                                                                              #
  3. #                          V's State Transformations                           #
  4. #                                 Version  0.1                                 #
  5. #                                                                              #
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  7. #                                Written By:  V                                #
  8. #                        Last Edited: December 21, 2013                        #
  9. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  10. #                                                                              #
  11. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  12.  
  13.  
  14. #==============================================================================#
  15. #------------------------------------------------------------------------------#
  16. # ** Disclaimer                                                                #
  17. #------------------------------------------------------------------------------#
  18. #                                                                              #
  19. # This script was intended for Non-commercial use only, if you wish to use     #
  20. # this script in a commercial game please PM me at which ever site you found   #
  21. # this script. Either way please give me credit in your game script as the     #
  22. # writer of this script, and send me a PM abuot the release of the game/demo.  #
  23. #                                                                              #
  24. #------------------------------------------------------------------------------#
  25. # ** How To Use                                                                #
  26. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  27. #                                                                              #
  28. # * This script is Plug & Play.                                                #
  29. #                                                                              #
  30. # * Add this tag to any state notebox that you want to transform.              #
  31. #                                                                              #
  32. #   <Transform State: character_name, character_index>                         #
  33. #                                                                              #
  34. #------------------------------------------------------------------------------#
  35. # ** Description                                                               #
  36. #------------------------------------------------------------------------------#
  37. #                                                                              #
  38. #  v0.1                                                                        #
  39. # ~=~=~=~                                                                      #
  40. #  * This script automatically transforms you into a new sprite when a state   #
  41. #    is added and automatically changes you back when the state is removed.    #
  42. #                                                                              #
  43. #------------------------------------------------------------------------------#
  44. #==============================================================================#
  45. #==============================================================================
  46. # ** V's State Transformations
  47. #==============================================================================
  48.  
  49. #==============================================================================
  50. # ** Game_Actor
  51. #------------------------------------------------------------------------------
  52. #  This class handles actors. It is used within the Game_Actors class
  53. # ($game_actors) and is also referenced from the Game_Party class ($game_party).
  54. #==============================================================================
  55.  
  56. class Game_Actor < Game_Battler
  57.  
  58.   #--------------------------------------------------------------------------
  59.   # * Public Instance Variables
  60.   #--------------------------------------------------------------------------
  61.   attr_reader   :original_character_name           # original character graphic filename
  62.   attr_reader   :original_character_index          # original character graphic index
  63.  
  64.   #--------------------------------------------------------------------------
  65.   # * Aliasing Method: Object Initialization
  66.   #--------------------------------------------------------------------------
  67.   alias :gas542434100 :setup
  68.  
  69.   #--------------------------------------------------------------------------
  70.   # * Setup
  71.   #--------------------------------------------------------------------------
  72.   def setup(actor_id)
  73.     gas542434100(actor_id)
  74.     @original_character_name = actor.character_name
  75.     @original_character_index = actor.character_index
  76.   end
  77.  
  78.   #--------------------------------------------------------------------------
  79.   # * Tranform State Method
  80.   #--------------------------------------------------------------------------
  81.   def transform_state(state_id)
  82.     note = /<Transform State:\s*(\w*)\S*\s*(\d*)\S*\s*(\w*)\S*\s*(\d*)\s*>/i
  83.     data = $data_states[state_id].note.scan(note)
  84.     if data != []
  85.       new_character_name = $1
  86.       new_character_index = $2.to_i
  87.       transform(new_character_name, new_character_index)
  88.       $game_player.refresh
  89.     end
  90.   end
  91.  
  92.   #--------------------------------------------------------------------------
  93.   # * Remove State
  94.   #--------------------------------------------------------------------------
  95.   def remove_state(state_id)
  96.     super(state_id)
  97.     revert_actor
  98.     $game_player.refresh
  99.   end
  100.  
  101.   #--------------------------------------------------------------------------
  102.   # * Add State
  103.   #--------------------------------------------------------------------------
  104.   def add_state(state_id)
  105.     super(state_id)
  106.     transform_state(state_id)
  107.   end
  108.  
  109.   #--------------------------------------------------------------------------
  110.   # * Revert Actor
  111.   #--------------------------------------------------------------------------
  112.   def revert_actor
  113.     @character_name = @original_character_name
  114.     @character_index = @original_character_index
  115.   end
  116.  
  117.   #--------------------------------------------------------------------------
  118.   # * Transform Actor
  119.   #--------------------------------------------------------------------------
  120.   def transform(character_name, character_index)
  121.     @character_name = character_name
  122.     @character_index = character_index
  123.   end
  124.  
  125. end
Advertisement
Add Comment
Please, Sign In to add comment