estriole

Effect - Recruit Enemy

Dec 9th, 2012
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.83 KB | None | 0 0
  1. =begin
  2. Effect -  Recruit Enemy
  3. requested by : pikalyze
  4.  
  5. SCRIPT Requirement:
  6. 1)EST - BRIBE AND BATTLE ROYALE
  7. http://pastebin.com/Nd8nXkaa
  8.  
  9. 2)EST - Clone Actor
  10. http://pastebin.com/w0TfMS8G
  11.  
  12. 3)Tsukihime - Effect Manager
  13. http://www.rpgmakervxace.net/topic/7395-effect-manager/
  14.  
  15. 4)Tsukihime - simple text input script
  16. http://www.rpgmakervxace.net/topic/4238-simple-text-input/page__hl__%2Btsukihime+%2Btext+%2Binput
  17.  
  18.  
  19.  
  20. tag the enemy with:
  21.  
  22. <eff: enemy_recruit x y rename? rand? sex>
  23.  
  24. x = actor id #required
  25. y = level #required
  26. rename? = true/false #true  - will be able to rename actor when adding it.
  27.                      #false - use default name in actor database
  28.                      #default true if nil
  29. rand? = true/false   #random name when the entered name is blank
  30.                      #true  - will pick name using random name array in module
  31.                      #false - will use default name for that actor_id
  32.                      #default false if nil
  33. sex = male or female #male  - will pick name from RANDOM_NAME_ARRAY_MALE
  34.                      #female- will pick name from RANDOM_NAME_ARRAY_FEMALE
  35.                      #default pick male name
  36.  
  37. example usage:
  38. <eff: enemy_recruit 3 10>
  39. will recruit actor using base actor 3 and will have lv 10
  40. able to rename actor when adding it to party.
  41. when naming it with blank name....
  42. it will use default name in database (actor 3 name)
  43.  
  44. <eff: enemy_recruit 3 10 true true male>
  45. will recruit actor using base actor 3 and will have lv 10
  46. able to rename when adding it to party,
  47. random name when naming it with blank name
  48. will choose male name in array
  49.  
  50. <eff: enemy_recruit 3 10 false>
  51. will recruit actor using base actor 3 and will have lv 10
  52. cannot rename when adding it to party,
  53. it will use default name in database (actor 3 name)
  54.  
  55. that enemy will recruited to party.
  56. for the scene where you able to reject it. i use common event instead.
  57. it's simpler than writing my own scene. too lazy :D.
  58.  
  59. =end
  60. $imported = {} if $imported.nil?
  61. $imported["Effect Enemy Recruit"] = true
  62. #==============================================================================
  63. # ** Rest of the script
  64. #==============================================================================
  65. module ESTRIOLE
  66.   RECRUIT_ENEMY_COMMON_EVENT = 1
  67.   TEXT_SHOWN_WHEN_NAMING_ENEMY = "Give it a name"
  68.   RANDOM_NAME_ARRAY_MALE = [#don't remove this
  69.   "Peter",
  70.   "Ray",
  71.   "Ganta",
  72.   "Blanc",
  73.   "Rocky",
  74.   "Rambo",
  75.   ]#don't remove this
  76.  
  77.   RANDOM_NAME_ARRAY_FEMALE = [#don't remove this
  78.   "Prita",
  79.   "Rie",
  80.   "Rose",
  81.   "Tifa",
  82.   "Lightning",
  83.   "Yuna",
  84.   ]#don't remove this
  85.  
  86. end
  87.  
  88. module Effect
  89.   module Manual_Opponents
  90.     Effect_Manager.register_effect(:enemy_recruit)
  91.   end
  92. end
  93.  
  94. class Game_Party < Game_Unit
  95.   attr_accessor :recruit_enemy
  96.   alias game_party_initialize_recruit_actor initialize
  97.   def initialize
  98.     game_party_initialize_recruit_actor
  99.     @recruit_enemy=[]
  100.   end
  101. end
  102.  
  103. class Game_Enemy < Game_Battler  
  104.  
  105.   def enemy_effect_enemy_recruit_battle_end(state, effect)
  106.     return if self.dead?
  107.     return if !self.bribed?
  108.     actor_id = effect.value1[0].to_i
  109.     actor_lv = effect.value1[1].to_i
  110.     rename = effect.value1[2]
  111.     rename = rename == "false"? false : true
  112.     random = effect.value1[3]
  113.     random = random == "true"? true : false
  114.     sex    = effect.value1[4]
  115.     sex    = sex    == "female"? "female" : "male"
  116.     $game_party.recruit_enemy.push([actor_id,actor_lv,rename,random,sex])
  117.   end
  118.  
  119. end
  120.  
  121.  
  122. module BattleManager
  123.   class <<self; alias battle_end_recruit_enemy battle_end; end
  124.   def self.battle_end(result)
  125.     battle_end_recruit_enemy(result)
  126.     if $game_party.recruit_enemy.size !=0
  127.     $game_temp.reserve_common_event(ESTRIOLE::RECRUIT_ENEMY_COMMON_EVENT)
  128.     end
  129.   end
  130. end
  131.  
  132. class Game_Interpreter
  133.   def recruit_enemy_yes
  134.   id = $game_party.recruit_enemy[0][0]
  135.   level = $game_party.recruit_enemy[0][1]
  136.   size = $data_actors.size
  137.   name = nil
  138.  
  139.   rename = $game_party.recruit_enemy[0][2]  
  140.   random = $game_party.recruit_enemy[0][3]
  141.   sex    = $game_party.recruit_enemy[0][4]
  142.  
  143.   if rename
  144.   enter_text(text=ESTRIOLE::TEXT_SHOWN_WHEN_NAMING_ENEMY,Tsuki::Text_Input::Text_Variable,Tsuki::Text_Input::Max_Chars)
  145.   name = $game_variables[Tsuki::Text_Input::Text_Variable]
  146.     if random
  147.       if sex = "female"
  148.       name = ESTRIOLE::RANDOM_NAME_ARRAY_FEMALE.sample if $game_variables[Tsuki::Text_Input::Text_Variable]==""
  149.       else
  150.       name = ESTRIOLE::RANDOM_NAME_ARRAY_MALE.sample if $game_variables[Tsuki::Text_Input::Text_Variable]==""      
  151.       end
  152.     else
  153.     name = nil if $game_variables[Tsuki::Text_Input::Text_Variable]==""
  154.     end
  155.   end
  156.   $game_party.add_custom_actor(id,level,name)
  157.   end
  158.  
  159.   def remove_first_recruit_stack
  160.     return if $game_party.recruit_enemy.size == 0
  161.     $game_party.recruit_enemy.delete_at(0)
  162.   end
  163. end
Advertisement
Add Comment
Please, Sign In to add comment