Advertisement
SSTrihan

HorrorVale - Jekyll transform fix

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