Guest User

Split Oozelings Lua

a guest
Dec 21st, 2015
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.00 KB | None | 0 0
  1. function SplitOozelingsInitialize()
  2.     oozeling_charges = 0
  3.     damage_counter = 0
  4.     print("test")
  5.     print(oozeling_charges)
  6.     print(damage_counter)
  7. end
  8.  
  9. function SplitOozelingsCharges( keys )
  10.     local caster = keys.caster
  11.     local ability = keys.ability
  12.     local damage = keys.DamageTaken
  13.     print(damage)
  14.    
  15.     local max_charges = ability:GetLevelSpecialValueFor("max_charges", (ability:GetLevel() - 1))
  16.     local threshold = ability:GetLevelSpecialValueFor("threshold", (ability:GetLevel() - 1))
  17.     damage_counter = damage_counter + damage
  18.     print(damage_counter)
  19.     while (damage_counter > threshold) do
  20.         if oozeling_charges < max_charges then
  21.             oozeling_charges = oozeling_charges + 1
  22.             if not caster:HasModifier("modifier_split_oozelings_charges") then
  23.                 caster.ooze_stack = ParticleManager:CreateParticle("particles/viscous_ooze_oozeling_stack.vpcf", PATTACH_OVERHEAD_FOLLOW, caster)
  24.                 ParticleManager:SetParticleControl(caster.ooze_stack, 1, Vector(0, 1, 0))
  25.                 ability:ApplyDataDrivenModifier(caster, caster, "modifier_split_oozelings_charges", {})
  26.             else
  27.                 ParticleManager:SetParticleControl(caster.ooze_stack, 1, Vector(0, oozeling_charges, 0))
  28.                 caster:SetModifierStackCount("modifier_split_oozelings_charges", ability, oozeling_charges)
  29.             end
  30.         end
  31.         damage_counter = damage_counter - threshold
  32.         print(damage_counter)
  33.     end
  34. end
  35.  
  36.  
  37. function SplitOozelingsSpendCharges( keys )
  38.     local caster = keys.caster
  39.     local ability = keys.ability
  40.     local health = caster:GetHealth()
  41.  
  42.     oozeCount = oozeling_charges
  43.     oozeVector = caster:GetForwardVector()
  44.    
  45.     if caster:HasModifier("modifier_split_oozelings_charges") then
  46.         caster:RemoveModifierByName("modifier_split_oozelings_charges")
  47.     end
  48.  
  49.  
  50.     repeat
  51.         ability:ApplyDataDrivenModifier(caster, caster, "modifier_split_oozelings_spend_charges", {})
  52.         oozeling_charges = oozeling_charges - 1
  53.         if caster:GetMaxHealth() > 150 then
  54.             ability:ApplyDataDrivenModifier(caster, caster, "modifier_ooze_health_modifier", {Duration = 20})
  55.             caster:SetModelScale(caster:GetModelScale() - 0.015)
  56.         end
  57.     until( oozeling_charges < 0 )
  58.  
  59.     if health > caster:GetHealth() then
  60.         caster:SetHealth(health)
  61.     end
  62.     oozeling_charges = 0
  63. end
  64.  
  65. function OozeGrow( keys )
  66.     local caster = keys.caster
  67.  
  68.     caster:SetModelScale(caster:GetModelScale() + 0.015)
  69. end
  70.  
  71. function LoseParticles( keys )
  72.     local caster = keys.caster
  73.  
  74.     ParticleManager:DestroyParticle(caster.ooze_stack, true)
  75. end
  76.  
  77. function GetSummonPoints( keys )
  78.     local caster = keys.caster
  79.     local ability = keys.ability
  80.     local origin = caster:GetAbsOrigin()
  81.  
  82.     local vector = origin + oozeVector * 16
  83.     local oozeAngle = 360 / (oozeCount + 1)
  84.  
  85.     local angle = QAngle(0, oozeAngle, 0)
  86.  
  87.     if not oozeAngle2 then oozeAngle2 = 0 end
  88.     oozeAngle2 = oozeAngle2 + oozeAngle
  89.  
  90.     angle2 = QAngle(0, oozeAngle2, 0)
  91.     point = RotatePosition(origin, angle2, vector)
  92.  
  93.  
  94.     local result = { }
  95.     table.insert(result, point)
  96.     return result
  97. end
  98.  
  99. function OozelingTracker( keys )
  100.     local target = keys.target
  101.     local ability = keys.ability
  102.    
  103.     local contact_radius = ability:GetLevelSpecialValueFor("contact_radius", (ability:GetLevel() - 1))
  104.     local target_team = DOTA_UNIT_TARGET_TEAM_ENEMY
  105.     local target_types = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC
  106.     local target_flags = DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES
  107.  
  108.     -- Find the valid units in the trigger radius
  109.     local units = FindUnitsInRadius(target:GetTeamNumber(), target:GetAbsOrigin(), nil, contact_radius, target_team, target_types, target_flags, FIND_CLOSEST, false)
  110.  
  111.     if #units > 0 then
  112.         target:ForceKill(true)
  113.     end
  114. end
  115.  
  116. function OozelingAttack( keys )
  117.     keys.attacker:ForceKill(true)
  118. end
  119.  
  120. function OozelingDeath( keys )
  121.     print( keys.target:GetHealth() )
  122.     if not keys.target:IsAlive() then
  123.         local particleName = "particles/viscous_ooze_toxic_ooze.vpcf"
  124.         local soundEventName = "Ability.SandKing_CausticFinale"
  125.        
  126.         local fxIndex = ParticleManager:CreateParticle( particleName, PATTACH_ABSORIGIN, keys.target )
  127.         StartSoundEvent( soundEventName, keys.target )
  128.     end
  129. end
Advertisement
Add Comment
Please, Sign In to add comment