Advertisement
estriole

Effect - Manual Target

Dec 7th, 2012
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.00 KB | None | 0 0
  1. =begin
  2. Add on requested by Non Ya
  3. for EST - BRIBE AND BATTLE ROYALE
  4. Agro system
  5.  
  6. requirement:
  7. EST - BRIBE AND BATTLE ROYALE
  8. Tsukihime Effect Manager 2.4 or above
  9. EST - PERMANENT STATES SNIPPET (BELOW THIS SCRIPT IN SPOILER TAG)
  10.  
  11. to add the agro system.
  12. -) every faction MUST have their own unique agro states
  13. example faction a state is 45
  14. faction a agro check state is 44
  15. faction b state is 46
  16. faction b agro check state is 47
  17.  
  18. from above example create states:
  19. then in notetags add this:
  20.  
  21. for faction a agro check state:
  22. <eff: manual_opponents 3 x true>
  23. <eff: manual_friends 2 x true>
  24. x is the faction a states.
  25.  
  26. for faction b agro check state:
  27. <eff: manual_friends 2 x true>
  28. <eff: manual_friends 2 x true>
  29. x is the faction b states.
  30.  
  31. then at battle start add the faction states to each battler
  32. then add the correct agro check states on top that faction state
  33. example
  34. slime a is faction a
  35. slime b is faction b
  36.  
  37. at battle start:
  38. slime a add state faction a
  39. slime a add state agro check faction a
  40. slime b add state faction b
  41. slime b add state agro check faction b
  42.  
  43. thus both slime will attack each other ignoring the party.
  44. but if party decide to attack slime b.
  45. then state agro check faction b will removed and it will act as faction b behavior
  46. (attack party and faction a)
  47.  
  48. #==============================================================================
  49. this script general usage: (not only used for agro system)
  50.  
  51.   tag the state with this:
  52.    
  53.     <eff: manual_opponents x y z>
  54. x= array
  55. 1: game_party
  56. 2: game_troop_same_state
  57. 3: game_troop_different_state
  58.  
  59. y= state used in same/different state check. if not used will use the tagged state
  60. instead
  61.  
  62. z= true/false - default false
  63. that state removed upon hit by allies/actor or not. (for agro system)
  64.  
  65. example 1:
  66.     <eff: manual_opponents [1,3] 45>
  67. translate to:
  68. set the opponents to game party and all game troop which state not 45.
  69. and that state not removed even when hit by actor/friends unit.
  70.  
  71. example 2:
  72.     <eff: manual_opponents [3]>
  73.     you add that notetags to state 23
  74. set the opponents to game troop which state not 23.
  75. and will remove the state 23 whenever hit by friend units / actor.
  76.  
  77.  
  78. #==============================================================================
  79. =end
  80. $imported = {} if $imported.nil?
  81. $imported["Manual_Opponents"] = true
  82. #==============================================================================
  83. # ** Rest of the script
  84. #==============================================================================
  85. module Effect
  86.   module Manual_Opponents
  87.     Effect_Manager.register_effect(:manual_opponents)
  88.     Effect_Manager.register_effect(:manual_friends)
  89.   end
  90. end
  91.  
  92. class Game_Enemy < Game_Battler  
  93.  
  94.   def state_effect_manual_opponents_turn_start(state, effect)
  95.     @manual_opponents_unit = nil if bribed?
  96.     return if bribed?
  97.     enemy_mode = effect.value1[0].to_i
  98.     enemy_mode = [effect.value1[0].to_i] if effect.value1[0].is_a?(String)
  99.     enemy_mode = effect.value1[0].to_a if effect.value1[0].is_a?(Range)
  100.     check_state = state.id
  101.     check_state = effect.value1[1].to_i if effect.value1[1]
  102.     added_unit = []
  103.     for mode in enemy_mode
  104.       case mode
  105.       when 1
  106.         added_unit = $game_party.battle_members
  107.       when 2
  108.           for enemy in $game_troop.members
  109.             if enemy.state?(check_state)
  110.               added_unit.push(enemy)
  111.             end
  112.           end #all troop that not faction member        
  113.       when 3
  114.           for enemy in $game_troop.members
  115.             if !enemy.state?(check_state)
  116.               added_unit.push(enemy)
  117.             end
  118.           end #all troop that not faction member
  119.  
  120.       end #end case
  121.      
  122.     end#end for
  123.     manual_unit = Game_Troop.new
  124.     manual_unit.add_enemies_group(added_unit)
  125.     @manual_opponents_unit = manual_unit
  126.    
  127.   end#end state effect add
  128.  
  129.   def state_effect_manual_opponents_guard(user, state, effect)
  130.     remove_upon_hit = false
  131.     remove_upon_hit = effect.value1[2] if effect.value1[2]
  132.     remove_state(state.id) if (user.actor? || friends_unit.members.include?(user)) && remove_upon_hit
  133.   end
  134.  
  135.   def state_effect_manual_opponents_remove(state, effect)
  136.     @manual_opponents_unit = nil
  137.   end
  138.  
  139.   #friends section
  140.     def state_effect_manual_friends_turn_start(state, effect)
  141.     @manual_friends_unit = nil if bribed?
  142.     return if bribed?
  143.    
  144.     enemy_mode = effect.value1[0].to_i
  145.     enemy_mode = [effect.value1[0].to_i] if effect.value1[0].is_a?(String)
  146.     enemy_mode = effect.value1[0].to_a if effect.value1[0].is_a?(Range)
  147.     check_state = state.id
  148.     check_state = effect.value1[1].to_i if effect.value1[1]
  149.     added_unit = []
  150.     for mode in enemy_mode
  151.       case mode
  152.       when 1
  153.         added_unit = $game_party.battle_members
  154.       when 2
  155.           for enemy in $game_troop.members
  156.             if enemy.state?(check_state)
  157.               added_unit.push(enemy)
  158.             end
  159.           end #all troop that not faction member        
  160.       when 3
  161.           for enemy in $game_troop.members
  162.             if !enemy.state?(check_state)
  163.               added_unit.push(enemy)
  164.             end
  165.           end #all troop that not faction member
  166.  
  167.       end #end case
  168.      
  169.     end#end for
  170.     manual_unit = Game_Troop.new
  171.     manual_unit.add_enemies_group(added_unit)
  172.     @manual_opponents_unit = manual_unit
  173.    
  174.   end#end state effect add
  175.  
  176.   def state_effect_manual_friends_guard(user, state, effect)
  177.     remove_upon_hit = false
  178.     remove_upon_hit = effect.value1[2] if effect.value1[2]
  179.     remove_state(state.id) if (user.actor? || friends_unit.members.include?(user)) && remove_upon_hit
  180.   end
  181.  
  182.   def state_effect_manual_friends_remove(state, effect)
  183.     @manual_opponents_unit = nil
  184.   end
  185.  
  186.  
  187. end
  188.  
  189. class Game_Troop < Game_Unit
  190.   alias manual_opponents_initialize initialize
  191.   def initialize
  192.     manual_opponents_initialize
  193.     @enemies = []
  194.   end
  195.  
  196.   def add_enemies_group(unit)
  197.     for enemy in unit
  198.     @enemies.push(enemy)
  199.     end
  200.   end
  201.  
  202. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement