adiktuzmiko

Custom Skill/Item Repeat v1.00

Oct 20th, 2014
862
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.72 KB | None | 0 0
  1. =begin
  2.  ==============================================================================
  3.  
  4.  Custom Skill/Item Repeat v1.00
  5.  by AdiktuzMiko
  6.  --- Date Created: 10/20/2014
  7.  --- Last Date Updated: 10/20/2014
  8.  --- Level: Easy
  9.  
  10.  ==============================================================================
  11.  Overview
  12.  ==============================================================================
  13.  
  14.  This script provides the ability to run RGSS3 methods/formulas to determine
  15.  how many times the skill/item repeats. The script takes first the repeats
  16.  set in the skill tab, then adds any custom repeat you have set.
  17.  
  18.  This can also be used to simply have more than 9 repeats.
  19.  
  20.  ==============================================================================
  21.  Set-Up
  22.  ==============================================================================
  23.  
  24.  Just put this script into a blank slot above main but below materials
  25.  (see compatibility section) and start tagging and making your own formulas
  26.  
  27.  ==============================================================================
  28.  Tags
  29.  ==============================================================================
  30.  
  31.  -------------------------------------------------------------------
  32.  For global repeat
  33.  -------------------------------------------------------------------
  34.  <start_custom_repeat_g>
  35.    formula
  36.  <end_custom_repeat_g>
  37.  
  38.  -------------------------------------------------------------------
  39.  For target specific repeat
  40.  -------------------------------------------------------------------
  41.  <start_custom_repeat_s>
  42.    formula
  43.  <end_custom_repeat_s>
  44.  
  45.  Use user to denote the user, item to denote the skill
  46.  If using the specific repeat, use target to denote the target
  47.  
  48.  -------------------------------------------------------------------
  49.  For repeating animation
  50.  -------------------------------------------------------------------
  51.  
  52.  <repeat_anim>
  53.  
  54.  Example: If we want to hit 2 times if user's agi is above 100
  55.  
  56.  <start_custom_repeat_s>
  57.    1 if user.agi >= 100
  58.  <end_custom_repeat_s>
  59.  
  60.  We used 1 since we already have 1 repeat at the skill tab (which is the minimum)
  61.  
  62.  We also put the number directly instead of putting return before it because
  63.  that causes the script to skip the next actions all together
  64.  
  65.  ==============================================================================
  66.  Compatibility
  67.  ==============================================================================
  68.  
  69.  This script overwrites Scene_Battle's use_item method and Scene_ItemBase's
  70.  use_item_on_actor method
  71.  
  72.  ==============================================================================
  73.  Terms and Conditions
  74.  ==============================================================================
  75.  
  76.  View it here: http://lescripts.wordpress.com/terms-and-conditions/
  77.  
  78.  ==============================================================================
  79. =end
  80.  
  81. # ==============================================================================
  82. # DO NOT EDIT BELOW THIS LINE
  83. # ==============================================================================
  84.  
  85. module ADIK
  86.   module CUSTOM_REPEAT
  87.     GLOBAL = /<start_custom_repeat_g>(.*)<end_custom_repeat_g>/m
  88.     SPECIFIC = /<start_custom_repeat_s>(.*)<end_custom_repeat_s>/m
  89.     REPEAT_ANIMATION = /<repeat_anim>/
  90.   end
  91. end
  92.  
  93.  
  94. class RPG::UsableItem
  95.  
  96.   def custom_repeat_global
  97.     return $1.to_s if self.note =~ ADIK::CUSTOM_REPEAT::GLOBAL
  98.     return "0"
  99.   end
  100.  
  101.   def custom_repeat
  102.     return $1.to_s if self.note =~ ADIK::CUSTOM_REPEAT::SPECIFIC
  103.     return "0"
  104.   end
  105.  
  106.   def repeat_anim
  107.     return self.note =~ ADIK::CUSTOM_REPEAT::REPEAT_ANIMATION
  108.   end
  109.  
  110. end
  111.  
  112. class Scene_ItemBase
  113.  
  114.   def use_item_to_actors
  115.     repeats = item.repeats
  116.     targets = item_target_actors
  117.     repeats += eval(item.custom_repeat_global)
  118.     targets.each do |target|
  119.       specific_repeat = repeats
  120.       specific_repeat += eval(item.custom_repeat)
  121.       specific_repeats.times { target.item_apply(user, item) }
  122.     end
  123.   end
  124.  
  125. end
  126.  
  127. class Scene_Battle
  128.  
  129.   def use_item
  130.     item = @subject.current_action.item
  131.     @log_window.display_use_item(@subject, item)
  132.     @subject.use_item(item)
  133.     refresh_status
  134.     targets = @subject.current_action.make_targets.compact
  135.     show_animation(targets, item.animation_id) unless item.repeat_anim
  136.     user = @subject
  137.     repeats = item.repeats
  138.     repeats += eval(item.custom_repeat_global)
  139.     targets.each do |target|
  140.       specific_repeat = repeats
  141.       specific_repeat += eval(item.custom_repeat)
  142.       targs = [target]
  143.       specific_repeat.times do
  144.         show_animation(targs, item.animation_id) if item.repeat_anim
  145.         invoke_item(target, item)
  146.       end
  147.     end
  148.   end
  149.  
  150. end
Advertisement
Add Comment
Please, Sign In to add comment