Advertisement
TheSixth

Sneak States Addon for Falcao's ABS by Sixth

Oct 24th, 2015
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.58 KB | None | 0 0
  1. #===============================================================================
  2. # * [ACE] Sneak States Addon for Falcao's Pearl ABS Liquid v3
  3. #===============================================================================
  4. # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
  5. # * Version: 1.3
  6. # * Updated: 06/01/2016
  7. # * Requires: Falcao's Pearl ABS Liquid v3
  8. #-------------------------------------------------------------------------------
  9. # * < Change Log >
  10. #-------------------------------------------------------------------------------
  11. # * Version 1.0 (24/10/2015)
  12. #   - Initial release.
  13. # * Version 1.1 (25/10/2015)
  14. #   - Added opacity change settings for sneaking mode.
  15. # * Version 1.2 (03/11/2015)
  16. #   - Added a script call to check if the player got any sneak states inflicted
  17. #     or not.
  18. # * Version 1.3 (06/01/2016)
  19. #   - Added a compatibility edit for my Multi-Elements script.
  20. #-------------------------------------------------------------------------------
  21. # * < Description >
  22. #-------------------------------------------------------------------------------
  23. # * This script will let you make sneak states.
  24. #   Enemies will not be able to see you if you got the sneak state inflicted
  25. #   on your party leader.
  26. # * Can setup a blend effect for showing that the player is in sneaking mode.
  27. #   If the blend effect is not enough, you can change the opacity of the
  28. #   sneaking character too.
  29. # * Can add bonus effects for tools executed during sneak mode. The effects are:
  30. #   Hit Rate, Critical Rate, Damage, and Critical Damage multipliers!
  31. # * Can set up enemies which ignore the sneaking mode.
  32. # * Can also set up tools which ignore the sneaking effects.
  33. #-------------------------------------------------------------------------------
  34. # * < Note-Tags >
  35. #-------------------------------------------------------------------------------
  36. # * If you don't want a tool to gain any sneaking bonuses, or if you want an
  37. #   enemy to ignore the sneaking effect, you can tag your tools/enemies with the
  38. #   following note-tag:
  39. #
  40. #     <ignore sneak>
  41. #
  42. #   Enemies with this note-tag will still chase you even if you are in
  43. #   sneaking mode!
  44. #   Tools with this note-tag will not give any bonus effects even if you are in
  45. #   sneaking mode!
  46. #-------------------------------------------------------------------------------
  47. # * < Script Calls >
  48. #-------------------------------------------------------------------------------
  49. # * To check if the player is in sneak mode (got any sneak states inflicted),
  50. #   you can use this script call in conditional branches:
  51. #
  52. #     player_sneaking?
  53. #
  54. #   It returns true if the player got a sneaking state inflicted, otherwise
  55. #   it returns false.
  56. #-------------------------------------------------------------------------------
  57. # * < Installation >
  58. #-------------------------------------------------------------------------------
  59. # * Place this scipt below the last script from Falcao's Pearl ABS Liquid v3
  60. #   script series but above Main!
  61. #-------------------------------------------------------------------------------
  62. # * < Compatibility Info >
  63. #-------------------------------------------------------------------------------
  64. # * No known incompatibilities.
  65. #-------------------------------------------------------------------------------
  66. # * < Known Issues >
  67. #-------------------------------------------------------------------------------
  68. # * No known issues.
  69. #-------------------------------------------------------------------------------
  70. # * < Terms of Use >
  71. #-------------------------------------------------------------------------------
  72. # * Free to use for whatever purposes you want.
  73. # * Credit me (Sixth) in your game, pretty please! :P
  74. # * Posting modified versions of this script is allowed as long as you notice me
  75. #   about it with a link to it!
  76. #===============================================================================
  77. $imported = {} if $imported.nil?
  78. $imported["SixthSneakStates"] = true
  79. #===============================================================================
  80. # Settings:
  81. #===============================================================================
  82. module SneakStates
  83.   #-----------------------------------------------------------------------------
  84.   # Sneak State Settings:
  85.   #-----------------------------------------------------------------------------
  86.   # Any state IDs entered in the array below will be marked as a sneak state.
  87.   #-----------------------------------------------------------------------------
  88.   States = [44]
  89.  
  90.   #-----------------------------------------------------------------------------
  91.   # Sneak Effect Settings:
  92.   #-----------------------------------------------------------------------------
  93.   # You can set up a visual effect for your sneaking characters and some extra
  94.   # effects for the attacks made while in sneaking mode.
  95.   # The sneak state will be removed immediately if the player uses a tool!
  96.   # But the tool used in sneaking mode can give additional benefits, such as
  97.   # extra damage, hit and critical rate.
  98.   # All of the effect settings are multiplier settings! This means that the
  99.   # default value will be used to determine the bonus effects by multiplying
  100.   # that value with the one you set up here. The result of this calculation
  101.   # will be added to the final result.
  102.   # So, anything above 0 will be considered as a bonus value, anything below 0
  103.   # will be considered as a negative bonus, and 0 will not change anything.
  104.   #-----------------------------------------------------------------------------
  105.   Effects = {
  106.     :blend => 2,     # blend mode, can be: 0 - normal, 1 - add, 2 - sub
  107.     :opacity => 150, # opacity of the characters on sneak state
  108.     :damage => 1.0,  # 1.0 means +100% damage bonus
  109.     :hit => 1.0,     # 1.0 means +100% hit bonus
  110.     :crit => 2.5,    # 2.5 means +250% critical rate
  111.     :cridmg => 5.0   # 1.0 means +100% critical damage
  112.   }
  113.  
  114. end  
  115. #===============================================================================
  116. # End of Settings! Do not edit below this line unless pink pigs are flying!
  117. #===============================================================================
  118.  
  119. class Game_Interpreter
  120.  
  121.   def player_sneaking?
  122.     return SneakStates::States.any? {|st| $game_party.leader.state?(st)}
  123.   end
  124.  
  125. end
  126.  
  127. class RPG::UsableItem < RPG::BaseItem
  128.  
  129.   attr_accessor :ignore_sneak
  130.  
  131.   def ignore_sneak
  132.     set_ignore_sneak if @ignore_sneak.nil?
  133.     return @ignore_sneak
  134.   end
  135.  
  136.   def set_ignore_sneak
  137.     @ignore_sneak = @note.include?("<ignore sneak>")
  138.   end
  139.  
  140. end
  141.  
  142. class Game_Battler < Game_BattlerBase
  143.  
  144.   attr_accessor :sneak_effect
  145.  
  146.   alias kill_sneak_effects0086 use_item
  147.   def use_item(item)
  148.     if !item.ignore_sneak && SneakStates::States.any? {|st| state?(st)}
  149.       @sneak_effect = true
  150.     else
  151.       @sneak_effect = false
  152.     end
  153.     kill_sneak_effects0086(item)
  154.     SneakStates::States.each {|st| remove_state(st) if state?(st)}
  155.   end
  156.  
  157.   alias add_sneak_eff4432 item_hit
  158.   def item_hit(user, item)
  159.     val = add_sneak_eff4432(user, item)
  160.     if user.sneak_effect
  161.       val += val * SneakStates::Effects[:hit]
  162.     end
  163.     return val
  164.   end
  165.  
  166.   alias add_sneak_eff5532 item_cri
  167.   def item_cri(user, item)
  168.     val = add_sneak_eff5532(user, item)
  169.     if user.sneak_effect
  170.       val += val * SneakStates::Effects[:crit]
  171.     end
  172.     return val
  173.   end
  174.  
  175.   alias add_sneak_eff6632 item_element_rate
  176.   def item_element_rate(*args)
  177.     user = args[0]
  178.     val = add_sneak_eff6632(*args)
  179.     if user.sneak_effect
  180.       val += val * SneakStates::Effects[:damage]
  181.     end
  182.     return val
  183.   end
  184.  
  185.   alias add_sneak_eff7732 apply_critical
  186.   def apply_critical(damage)
  187.     val = add_sneak_eff7732(damage)
  188.     if @sneak_effect
  189.       val += damage * SneakStates::Effects[:cridmg]
  190.     end
  191.     return val
  192.   end
  193.    
  194. end
  195.  
  196. class Sprite_Character < Sprite_Base
  197.  
  198.   alias add_sneak_effect6654 update
  199.   def update
  200.     add_sneak_effect6654
  201.     if @character && @character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
  202.       update_sneak_effect
  203.     end
  204.   end
  205.  
  206.   def update_sneak_effect
  207.     if SneakStates::States.any? {|st| $game_player.battler.state?(st)}
  208.       if self.blend_type != SneakStates::Effects[:blend]
  209.         @old_blend = self.blend_type
  210.         self.blend_type = SneakStates::Effects[:blend]
  211.       end
  212.       if self.opacity != SneakStates::Effects[:opacity]
  213.         @old_opa = self.opacity
  214.         self.opacity = SneakStates::Effects[:opacity]
  215.       end
  216.     else
  217.       if @old_blend && self.blend_type != @old_blend
  218.         self.blend_type = @old_blend
  219.         @old_blend = nil
  220.       end
  221.       if @old_opa && self.opacity != @old_opa
  222.         self.opacity = @old_opa
  223.         @old_opa = nil
  224.       end
  225.     end
  226.   end
  227.  
  228. end
  229.  
  230. class Game_Event < Game_Character
  231.  
  232.   def ignore_sneak
  233.     return false unless @enemy
  234.     return @enemy.enemy.note.include?("<ignore sneak>")
  235.   end
  236.  
  237.   alias add_sneak_eff8875 update_enemy_sensor
  238.   def update_enemy_sensor
  239.     if !ignore_sneak && SneakStates::States.any? {|st| $game_player.battler.state?(st)}
  240.       return if @hookshoting[0]
  241.       return if @epassive
  242.       return if collapsing?
  243.       data = [$game_map.map_id, @id, PearlKernel::Enemy_Sensor]
  244.       $game_self_switches[data] = false if $game_self_switches[data]
  245.       @inrangeev = nil if @inrangeev
  246.     else
  247.       add_sneak_eff8875
  248.     end
  249.   end
  250.  
  251. end
  252. #==============================================================================
  253. # !!END OF SCRIPT - OHH, NOES!!
  254. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement