Advertisement
SSTrihan

HorrorVale Jekyll system script

Mar 17th, 2022 (edited)
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.50 KB | None | 0 0
  1. #-------------------------------------------------------------------------------
  2. # Don't remove this header!
  3. #-------------------------------------------------------------------------------
  4. # Jekyll Transformation System Script
  5. # by Trihan
  6. #
  7. # Version : 1.2
  8. #
  9. # This script is commissioned by Batworks Software.
  10. #-------------------------------------------------------------------------------
  11.  
  12. #-------------------------------------------------------------------------------
  13. # Version History
  14. #-------------------------------------------------------------------------------
  15. # 1.2 - Fixed a bug where Jekyll would transform while walking even if he
  16. #       wasn't in the battle party.
  17. # 1.1 - Added a check that prevents the transform turns from going down if
  18. #       Jekyll was resurrected that turn.
  19. # 1.0 - Initial script.
  20. #-------------------------------------------------------------------------------
  21.  
  22. #-------------------------------------------------------------------------------
  23. # The script is plug and play. Just set up the config and you're good to go.
  24. #
  25. # JEKYLL_ACTOR - The actor ID of the Jekyll character
  26. # TRANSFORM_STATES - An array containing, in order, the state IDs Jekyll cycles
  27. #                    through, starting with Jekyll 3.
  28. # TRANSFORM_TURNS - The number of actions Jekyll will take between transforms.
  29. # TRANSFORM_STEPS - The number of steps on the map before Jekyll will move to
  30. #                   the next stage. This will reset after battle.
  31. # RESET_STEPS_AFTER_BATTLE - If true, steps will revert to default after battle.
  32. # NERD_CLASS - The ID of the initial Jekyll nerd class.
  33. # JOCK_CLASS - The ID of the jock class to transform into.
  34. # NERD_CHAR - The name of the image for the Nerd appearance.
  35. # NERD_CHAR_INDEX - The index to use from the Nerd image.
  36. # NERD_FACE - The name of the image for the Nerd face.
  37. # NERD_FACE_INDEX - The index to use from the Nerd face image.
  38. # JOCK_CHAR - The name of the image for the Jock appearance.
  39. # JOCK_CHAR_INDEX - The index to use from the Jock image.
  40. # JOCK_FACE - The name of the image for the Jock face.
  41. # JOCK_FACE_INDEX - The index to use from the Jock face image.
  42. # TRANSFORM_SOUND - The name of the SE to play when transforming.
  43. # TRANSFORM_VOLUME - The volume at which to play the transform sound.
  44. # TRANSFORM_PITCH - The pitch at which to play the transform sound.
  45. # HYDE_SWITCH - The ID of the Hyde switch.
  46. # MJISHI_SWITCH - The ID of the Mjishi switch.
  47. #-------------------------------------------------------------------------------
  48.  
  49. module TLBJekyll
  50. #-------------------------------------------------------------------------------
  51. #  Config
  52.  
  53.   JEKYLL_ACTOR = 4
  54.   TRANSFORM_STATES = [79, 80, 81, 26, 77, 78]
  55.   TRANSFORM_TURNS = 3
  56.   TRANSFORM_STEPS = 100
  57.   RESET_STEPS_AFTER_BATTLE = true
  58.   NERD_CLASS = 3
  59.   JOCK_CLASS = 4
  60.   NERD_CHAR = "$jekyll"
  61.   NERD_CHAR_INDEX = 0
  62.   NERD_FACE = "$jekyllportrait"
  63.   NERD_FACE_INDEX = 0
  64.   JOCK_CHAR = "$chad"
  65.   JOCK_CHAR_INDEX = 0
  66.   JOCK_FACE = "$chadportrait"
  67.   JOCK_FACE_INDEX = 0
  68.   TRANSFORM_SOUND = "Transformation"
  69.   TRANSFORM_VOLUME = 100
  70.   TRANSFORM_PITCH = 100
  71.   HYDE_SWITCH = 79
  72.   MJISHI_SWITCH = 108
  73.  
  74. #  ** End Config **
  75. #
  76. # WARNING: Editing anything beyond this point may result in the script no
  77. # longer functioning as intended.
  78. #-------------------------------------------------------------------------------
  79. end
  80.  
  81.  
  82. module DataManager
  83.   class << self; alias :tlb_jekyll_setup_new_game :setup_new_game; end
  84.   def self.setup_new_game
  85.     tlb_jekyll_setup_new_game
  86.     $game_actors[TLBJekyll::JEKYLL_ACTOR].add_state(TLBJekyll::TRANSFORM_STATES[0])
  87.   end
  88.  
  89.   class << self; alias :tlb_jekyll_setup_battle_test :setup_battle_test; end
  90.   def self.setup_battle_test
  91.     tlb_jekyll_setup_battle_test
  92.     $game_actors[TLBJekyll::JEKYLL_ACTOR].add_state(TLBJekyll::TRANSFORM_STATES[0])
  93.   end
  94. end
  95.  
  96. module BattleManager
  97.   class << self; alias :tlb_jekyll_battle_end :battle_end; end
  98.   def self.battle_end(result)
  99.     tlb_jekyll_battle_end(result)
  100.     if TLBJekyll::RESET_STEPS_AFTER_BATTLE && $game_party.members.include?($game_actors[TLBJekyll::JEKYLL_ACTOR])
  101.       $game_actors[TLBJekyll::JEKYLL_ACTOR].transform_steps = TLBJekyll::TRANSFORM_STEPS
  102.     end
  103.   end
  104. end
  105.  
  106. class Game_Actor < Game_Battler
  107.   attr_accessor :transform_turns
  108.   attr_accessor :transform_steps
  109.   attr_accessor :transform_state_index
  110.  
  111.   alias :tlb_jekyll_game_actor_setup :setup
  112.   def setup(actor_id)
  113.     tlb_jekyll_game_actor_setup(actor_id)
  114.     if actor_id == TLBJekyll::JEKYLL_ACTOR
  115.       @transform_turns = TLBJekyll::TRANSFORM_TURNS
  116.       @transform_steps = TLBJekyll::TRANSFORM_STEPS
  117.       @transform_state_index = 0
  118.     end
  119.   end
  120.  
  121.   def transform_into_chad
  122.     change_class(TLBJekyll::JOCK_CLASS, true)
  123.     sound_name = TLBJekyll::TRANSFORM_SOUND
  124.     sound_vol = TLBJekyll::TRANSFORM_VOLUME
  125.     sound_pitch = TLBJekyll::TRANSFORM_PITCH
  126.     RPG::SE.new(sound_name, sound_vol, sound_pitch).play
  127.     @name = "Chad"
  128.     char = TLBJekyll::JOCK_CHAR
  129.     char_index = TLBJekyll::JOCK_CHAR_INDEX
  130.     face = TLBJekyll::JOCK_FACE
  131.     face_index = TLBJekyll::JOCK_FACE_INDEX
  132.     set_graphic(char, char_index, face, face_index)
  133.     $game_switches[TLBJekyll::HYDE_SWITCH] = true
  134.     $game_switches[TLBJekyll::MJISHI_SWITCH] = true
  135.     @transform_turns = TLBJekyll::TRANSFORM_TURNS
  136.     $game_player.refresh
  137.   end
  138.  
  139.   def transform_into_jekyll
  140.     change_class(TLBJekyll::NERD_CLASS, true)
  141.     sound_name = TLBJekyll::TRANSFORM_SOUND
  142.     sound_vol = TLBJekyll::TRANSFORM_VOLUME
  143.     sound_pitch = TLBJekyll::TRANSFORM_PITCH
  144.     RPG::SE.new(sound_name, sound_vol, sound_pitch).play
  145.     @name = "Jekyll"
  146.     char = TLBJekyll::NERD_CHAR
  147.     char_index = TLBJekyll::NERD_CHAR_INDEX
  148.     face = TLBJekyll::NERD_FACE
  149.     face_index = TLBJekyll::NERD_FACE_INDEX
  150.     set_graphic(char, char_index, face, face_index)
  151.     $game_switches[TLBJekyll::HYDE_SWITCH] = false
  152.     $game_switches[TLBJekyll::MJISHI_SWITCH] = false
  153.     @transform_turns = TLBJekyll::TRANSFORM_TURNS
  154.     $game_player.refresh
  155.   end
  156.  
  157.   def update_transform_state
  158.     unless @result.removed_states.include?(1)
  159.       @transform_turns -= 1
  160.       if @transform_turns == 0
  161.         SceneManager.scene.display_transform if SceneManager.scene.is_a?(Scene_Battle)
  162.         if @class_id == TLBJekyll::NERD_CLASS
  163.           transform_into_chad
  164.         else
  165.           transform_into_jekyll
  166.         end
  167.       end
  168.       old_state = TLBJekyll::TRANSFORM_STATES[@transform_state_index]
  169.       remove_state(old_state)
  170.       @transform_state_index += 1
  171.       @transform_state_index = 0 if @transform_state_index == TLBJekyll::TRANSFORM_STATES.size
  172.     end
  173.     new_state = TLBJekyll::TRANSFORM_STATES[@transform_state_index]
  174.     add_state(new_state)
  175.   end
  176. end
  177.  
  178. class Game_Party < Game_Unit
  179.   alias :tlb_jekyll_increase_steps :increase_steps
  180.   def increase_steps
  181.     tlb_jekyll_increase_steps
  182.     actor = $game_actors[TLBJekyll::JEKYLL_ACTOR]
  183.     if battle_members.include?(actor)
  184.       actor.transform_steps -= 1
  185.       if actor.transform_steps == 0
  186.         actor.update_transform_state
  187.         actor.transform_steps = TLBJekyll::TRANSFORM_STEPS
  188.       end
  189.     end
  190.   end
  191. end
  192.  
  193. class Scene_Battle < Scene_Base
  194.   alias :tlb_jekyll_process_action_end :process_action_end
  195.   def process_action_end
  196.     @subject.update_transform_state if @subject == $game_actors[TLBJekyll::JEKYLL_ACTOR]
  197.     tlb_jekyll_process_action_end
  198.   end
  199.  
  200.   def display_transform
  201.     @log_window.add_text("#{$game_actors[TLBJekyll::JEKYLL_ACTOR].name} transforms!")
  202.   end
  203. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement