Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.86 KB | None | 0 0
  1. print("Ally System Version 1 - Loaded - Pandex292")
  2.  
  3. --[[Item Locals]]--
  4. local itemf = 45645
  5. local itemh = 45646
  6. local itemb = 45647
  7. local itemd = 45648
  8. --Figher Ally
  9. local fighter = 222333
  10. --Healer Ally
  11. local healer = 222334
  12. --Buffer Ally
  13. local buffer = 222335
  14. --Damage Ally
  15. local damage = 222336
  16.  
  17.  
  18. function OnEnterCombat_Ally_Fighter(event, player, target)
  19.     local px = player:GetX()
  20.     local py = player:GetY()
  21.     local pz = player:GetZ()
  22.     local po = player:GetO()
  23.     if (player:HasItem(itemf) == true) then
  24.         if (player:IsInCombat() == true) then
  25.         player:SpawnpCreature(fighter, px, py-2, pz, po, 35, 120)
  26.         end
  27.     end
  28. end
  29.  
  30. function Fighter_OnSpawn(pCreature, event)
  31.     local tar = pCreature:GetClosestEnemy()
  32.     local tar2 = pCreature:GetClosestFriend()
  33.     if (pCreature:IsAttackable(tar)) then
  34.         pCreature:FullCastSpellOnTarget(3631, tar2)
  35.         pCreature:RegisterEvent(Fighter_Daze, 30, 0)
  36.         end
  37.     end
  38.  
  39. function Fighter_Daze(pCreature, event)
  40.     local tar = pCreature:GetClosestEnemy()
  41.     local tar2 = pCreature:GetClosestFriend()
  42.     pCreature:FullCastSpellOnTarget(42435, tar)
  43. end
  44.  
  45. function Fighter_OnLeaveCombat(pCreature, event, lasttarget)
  46.     pCreature:Despawn(15, 0)
  47.     pCreature:SendBroadcastMessage("My time here is done, I hope I was able to help you.")
  48. end
  49.  
  50. function OnEnterCombat_Ally_Healer(event, player, target)
  51.     local px = player:GetX()
  52.     local py = player:GetY()
  53.     local pz = player:GetZ()
  54.     local po = player:GetO()
  55.     if (player:HasItem(itemh) == true) then
  56.         if (player:IsInCombat() == true) then
  57.         player:SpawnpCreature(healer, px, py-2, pz, po, 35, 120)
  58.         end
  59.     end
  60. end
  61.  
  62. function Healer_OnSpawn(pCreature, event)
  63.     local tar = pCreature:GetClosestEnemy()
  64.     local tar2 = pCreature:GetClosestFriend()
  65.     if (pCreature:IsAttackable(tar)) then
  66.         pCreature:RegisterEvent(Healer_Heal, 45, 0)
  67.         end
  68.     end
  69.  
  70. function Healer_Heal(pCreature, event)
  71.     local tar = pCreature:GetClosestEnemy()
  72.     local tar2 = pCreature:GetClosestFriend()
  73.     pCreature:FullCastSpellOnTarget(32546, tar2)
  74. end
  75.  
  76. function Healer_OnLeaveCombat(pCreature, event, lasttarget)
  77.     pCreature:Despawn(15, 0)
  78.     pCreature:SendBroadcastMessage("My time here is done, I hope I was able to help you.")
  79. end
  80.  
  81. function OnEnterCombat_Ally_Buffer(event, player, target)
  82.     local px = player:GetX()
  83.     local py = player:GetY()
  84.     local pz = player:GetZ()
  85.     local po = player:GetO()
  86.     if (player:HasItem(itemb) == true) then
  87.         if (player:IsInCombat() == true) then
  88.         player:SpawnpCreature(buffer, px, py-2, pz, po, 35, 120)
  89.         end
  90.     end
  91. end
  92.  
  93. function Buffer_OnSpawn(pCreature, event)
  94.     local tar = pCreature:GetClosestEnemy()
  95.     local tar2 = pCreature:GetClosestFriend()
  96.     if (pCreature:IsAttackable(tar)) then
  97.         pCreature:FullCastSpellOnTarget(34199, tar2)
  98.         pCreature:FullCastSpellOnTarget(31305, tar2)
  99.         pCreature:FullCastSpellOnTarget(35912, tar2)
  100.         pCreature:FullCastSpellOnTarget(36001, tar2)
  101.         pCreature:FullCastSpellOnTarget(35874, tar2)
  102.         pCreature:FullCastSpellOnTarget(38734, tar2)
  103.         end
  104.     end
  105.  
  106.  
  107. function Buffer_OnLeaveCombat(pCreature, event, lasttarget)
  108.     pCreature:Despawn(15, 0)
  109.     pCreature:SendBroadcastMessage("My time here is done, I hope I was able to help you.")
  110. end
  111.  
  112. function OnEnterCombat_Ally_Damage(event, player, target)
  113.     local px = player:GetX()
  114.     local py = player:GetY()
  115.     local pz = player:GetZ()
  116.     local po = player:GetO()
  117.     if (player:HasItem(itemd) == true) then
  118.         if (player:IsInCombat() == true) then
  119.         player:SpawnpCreature(damage, px, py-2, pz, po, 35, 120)
  120.         end
  121.     end
  122. end
  123.  
  124. function Damage_OnSpawn(pCreature, event)
  125.     local tar = pCreature:GetClosestEnemy()
  126.     local tar2 = pCreature:GetClosestFriend()
  127.     if (pCreature:IsAttackable(tar)) then
  128.         pCreature:RegisterEvent(Damage_Dmg, 15, 0)
  129.         end
  130.     end
  131.    
  132. function Damage_Dmg(pCreature, event)
  133.     local tar = pCreature:GetClosestEnemy()
  134.     local tar2 = pCreature:GetClosestFriend()
  135.     pCreature:FullCastSpellOnTarget(69869, tar)
  136.     pCreature:RegisterEvent(Damage_Dmg2, 25, 0)
  137. end
  138.  
  139. function Damage_Dmg2(pCreature, event)
  140.     local tar = pCreature:GetClosestEnemy()
  141.     local tar2 = pCreature:GetClosestFriend()
  142.     pCreature:FullCastSpellOnTarget(36876, tar)
  143. end
  144.  
  145. function Damage_OnLeaveCombat(pCreature, event, lasttarget)
  146.     pCreature:Despawn(15, 0)
  147.     pCreature:SendBroadcastMessage("My time here is done, I hope I was able to help you.")
  148. end
  149.  
  150. RegisterServerHook(9, "OnEnterCombat_Ally_Fighter")
  151. RegisterUnitEvent(fighter, 18, "Fighter_OnSpawn")
  152. RegisterUnitEvent(fighter, 2, "Fighter_OnLeaveCombat")
  153. RegisterServerHook(9, "OnEnterCombat_Ally_Healer")
  154. RegisterUnitEvent(healer, 18, "Healer_OnSpawn")
  155. RegisterUnitEvent(healer, 2, "Healer_OnLeaveCombat")
  156. RegisterServerHook(9, "OnEnterCombat_Ally_Buffer")
  157. RegisterUnitEvent(buffer, 18, "Buffer_OnSpawn")
  158. RegisterUnitEvent(buffer, 2, "Buffer_OnLeaveCombat")
  159. RegisterServerHook(9, "OnEnterCombat_Ally_Damage")
  160. RegisterUnitEvent(damage, 18, "Damage_OnSpawn")
  161. RegisterUnitEvent(damage, 2, "Damage_OnLeaveCombat")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement