//Made by Paskovich. It creates a Floating Text at coordinates, while lets you choose color,
//fading time, text, speed and lifespan.
//This can be done in every trigger as well, but using it like a system is better and saves
//some lanes of the code.
function FloatText takes string msg, integer red, integer green, integer blue, real x, real y, real spd, real fadetime, real life returns nothing
local texttag t=CreateTextTag()
call SetTextTagText(t,msg,0.024)
call SetTextTagPos(t,x,y, 0.00)
call SetTextTagColor(t,red,green,blue,255)
call SetTextTagVelocity(t,0,spd)
call SetTextTagVisibility(t, true)
call SetTextTagFadepoint(t, fadetime)
call SetTextTagLifespan(t, life)
call SetTextTagPermanent(t, false)
set t=null
endfunction
Name | Type | is_array | initial_value |
damage_group | group | No | |
getdamager | unit | No | |
Hostile | unit | No | |
NowHash | hashtable | No | |
RestoreGroup | group | No | |
SS_Bool | boolean | No |
function Trig_Revive_Hostiles_Conditions takes nothing returns boolean
return GetOwningPlayer(GetDyingUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE)
endfunction
function Trig_Revive_Hostiles_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local location l = GetUnitLoc(u)
call TriggerSleepAction(10)
call CreateNUnitsAtLoc(1, GetUnitTypeId(u), GetOwningPlayer(u), l, 0.00)
call RemoveLocation(l)
set u = null
endfunction
//===========================================================================
function InitTrig_Revive_Hostiles takes nothing returns nothing
set gg_trg_Revive_Hostiles = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Revive_Hostiles, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Revive_Hostiles, Condition( function Trig_Revive_Hostiles_Conditions ) )
call TriggerAddAction( gg_trg_Revive_Hostiles, function Trig_Revive_Hostiles_Actions )
endfunction
function Trig_Hero_Revive_Conditions takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true
endfunction
function Trig_Hero_Revive_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
call TriggerSleepAction( 1.00 )
call ReviveHero( u, GetPlayerStartLocationX(p), GetPlayerStartLocationY(p), true )
if (GetLocalPlayer() == p) then
call PanCameraToTimed( GetPlayerStartLocationX(p), GetPlayerStartLocationY(p), 0.5)
endif
call SetUnitLifePercentBJ( u, 100 )
call SetUnitManaPercentBJ( u, 100 )
call UnitResetCooldown( u )
set u = null
set p = null
endfunction
//===========================================================================
function InitTrig_Hero_Revive takes nothing returns nothing
set gg_trg_Hero_Revive = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Hero_Revive, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Hero_Revive, Condition( function Trig_Hero_Revive_Conditions ) )
call TriggerAddAction( gg_trg_Hero_Revive, function Trig_Hero_Revive_Actions )
endfunction
//================================================================================================================================
//* This trigger will initilize the Hashtable, and global variables needed for spells. Make a global variable of
//* type hashtable, name it Hash, and copy this trigger in your map before
//* copying the spells.
//================================================================================================================================
function InitTrig_InitHashtabe takes nothing returns nothing
set udg_NowHash = InitHashtable()
call SaveGroupHandle(udg_NowHash, StringHash("Global G"), 0, CreateGroup())
endfunction
//***************************************************************************************************
//* ========================
//* Venom Orb ver.1.0
//* ========================
//* Made by Shdow89
//*
//*
//* How to implement:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* 1. Copy the spell "Venom Orb" to your map.
//*
//* 2. - Copy the unit "Venom Orb Dummy" to your map.
//* - Change the rawcode of the unit in the spell code.
//* - You can change the dummy unit model path (if you would like to look different), and it's scaling value (size).
//*
//* 3. Make a global variable of type unit group and name it damage_group (case sensitive).
//*
//* 4, Make a global variable of type unit and name it getdamager (case sensitive).
//*
//* 5. - Copy the trigger InitHashtable to your map.
//* - Copy the enitre enitre costum script section to your's in your map (icon, with the map name is the costum script section)
//* - Copy the trigger Venom Orb to your map.
//* - Change the spell raw codes in the spell code, and other data to what you desire.
//* - Enjoy
//* Choosable/Effects:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* Go down through constant function and change to what you like. Units affected are:
//* Enemy Units, Non-Structure, Non-Magic Immune and living. You can change this in
//* function Venom_Orb_Pick_ActionFilter, after the if call.
//*
//*
//* Editor's Word:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* This spell should acheive MUI grouping without having to use dynamic group creation.
//* At some point it's working, but as you may see I'm still using one dynamic group creation
//* (or maybe not). This spell should really be MUI and leak-less.
//*
//* Spells Action:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* Sends an orb to the targeted area, dealing damage to unit it passes by, while leaving
//* a deadly posion on them. Units will take damage each 0.5 seconds for a short duration.
//* If the unit is moving it will receive 50 % more damage.
//*
//* Credits:
//* ¯¯¯¯¯¯¯¯
//* dgriff for help with groups.
//* Paskovich for floating text as an external system.
//*
//**************************************************************************************************************
constant function Venom_Orb_End_SFX takes nothing returns string
return "Abilities\\Weapons\\ChimaeraAcidMissile\\ChimaeraAcidMissile.mdl" // This effect is spawned when orb reaches it's destination, and when units get hit by it.
endfunction
constant function Venom_Orb_DoT_SFX takes nothing returns string
return "Abilities\\Spells\\Undead\\DeathCoil\\DeathCoilSpecialArt.mdl" // This effect is spawned every 0.5 (choosable) seconds on the poison affected unit.
endfunction
constant function Venom_Orb_ID takes nothing returns integer
return 'A000' // Venom Orb spell raw code. Change to yours.
endfunction
constant function Venom_Orb_Dummy_ID takes nothing returns integer
return 'h000' // Venom Orb Dummy unit raw code. Change to yours.
endfunction
constant function Venom_Orb_Travel_Dist takes integer i returns real
return 400.0 * i // How far does the orb travel before it's destroyed. 400 * level of Venom Orb.
endfunction
constant function Venom_Orb_Move_Speed takes nothing returns real
return 30.0 // How fast is the orb moving.
endfunction
constant function Venom_Orb_Pick_Radius takes nothing returns real
return 175.0 // Collision radius of the orb (with enemy units). AOE of the spell.
endfunction
constant function Venom_Orb_DoT_Time takes integer i returns real
return 1.0 * i // The duration of the Damage over Time effect. 1 * level of the Venom Orb seconds.
endfunction
constant function Venom_Orb_Init_Damage takes integer i returns real
return 25.0 * i // Initial damage that orb deals. When it coolides with the enemy units.
endfunction
constant function Venom_Orb_DoT_Damage takes integer i returns real
return 20.0 * i // The DoT damage. Damage enemy unit receives every -x- seconds.
endfunction
constant function Venom_Orb_DoT_MoveInc takes nothing returns real
return 0.5 // If the unit is moving, how much should damage be increased. 0.5 stands for 50 %. 1 stands for 100 %.
endfunction
constant function Venom_Orb_DoTimer_Loop takes nothing returns real
return 0.5 // Damage over Time durational loop effect. This means every 0.5 seconds unit will get damaged, until the DoT duration expires.
endfunction
constant function Venom_Orb_MoveTimer_Loop takes nothing returns real
return 0.03 // Timer loop speed for moving the dummy unit. I suggest you leave this as it is.
endfunction
//Done with constants. Don't touch anything below this if you are unsure.
//======================================================================================================================
function Venom_Orb_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Venom_Orb_ID()
endfunction
//======================================================================================================================
//The DoT function for enemy units.
//===================================
function Venom_Orb_DoT takes nothing returns nothing
local timer dmg = GetExpiredTimer()
local unit tar = LoadUnitHandle(udg_NowHash, GetHandleId(dmg), 1)
local unit damager = LoadUnitHandle(udg_NowHash, GetHandleId(dmg), 4)
local real dur = LoadReal (udg_NowHash, GetHandleId(dmg), 2)
local real curDur = LoadReal (udg_NowHash, GetHandleId(dmg), 5)
local real x = LoadReal (udg_NowHash, GetHandleId(dmg), 6)
local real y = LoadReal (udg_NowHash, GetHandleId(dmg), 7)
local real x1 = GetUnitX (tar)
local real y1 = GetUnitY (tar)
local real damage = LoadReal (udg_NowHash, GetHandleId(dmg), 8)
if curDur < dur and IsUnitType(tar, UNIT_TYPE_DEAD) == false then
if x != x1 or y != y1 then
set damage = damage + (damage * Venom_Orb_DoT_MoveInc())
call UnitDamageTarget (damager, tar, damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_POISON, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect (AddSpecialEffect (Venom_Orb_DoT_SFX(), x1, y1))
//Creating a floating text.
call FloatText (I2S(R2I(damage)) + "!", 0, 255, 0, x1, y1, 0.07, 0.5, 1.5)
call SaveReal (udg_NowHash, GetHandleId(dmg), 5, curDur + Venom_Orb_DoTimer_Loop())
call SaveReal (udg_NowHash, GetHandleId(dmg), 6, x1)
call SaveReal (udg_NowHash, GetHandleId(dmg), 7, y1)
set tar = null
set damager = null
set dmg = null
else
call UnitDamageTarget (damager, tar, damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_POISON, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect (AddSpecialEffect (Venom_Orb_DoT_SFX(), x1, y1))
call SaveReal (udg_NowHash, GetHandleId(dmg), 5, curDur + Venom_Orb_DoTimer_Loop())
//Another floating text.
call FloatText (I2S(R2I(damage)) + "!", 0, 255, 0, x1, y1, 0.07, 0.5, 1.5)
call SaveReal (udg_NowHash, GetHandleId(dmg), 6, x1)
call SaveReal (udg_NowHash, GetHandleId(dmg), 7, y1)
set tar = null
set damager = null
set dmg = null
endif
else
call PauseTimer(dmg)
call DestroyTimer(dmg)
call FlushChildHashtable(udg_NowHash, GetHandleId(dmg))
set dmg = null
set tar = null
set damager = null
endif
endfunction
//===================================================================================
//Filter pick and add to DoT function for enemy units. Boolexpr as callback for group
//===================================================================================
function Venom_Orb_Pick_ActionFilter takes nothing returns boolean
local unit u = GetFilterUnit()
local timer dmg = null
if IsUnitEnemy(u, GetOwningPlayer(udg_getdamager)) == true and IsUnitType(u, UNIT_TYPE_STRUCTURE) == false and IsUnitType(u, UNIT_TYPE_DEAD) == false and IsUnitInGroup(u, udg_damage_group) == false then
call DestroyEffect (AddSpecialEffect(Venom_Orb_End_SFX(), GetUnitX(u), GetUnitY(u)))
call UnitDamageTarget(udg_getdamager, u, Venom_Orb_Init_Damage(GetUnitAbilityLevel(udg_getdamager, Venom_Orb_ID())), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_POISON, WEAPON_TYPE_WHOKNOWS)
set dmg = CreateTimer()
call SaveUnitHandle (udg_NowHash, GetHandleId(dmg), 1, u)
call SaveUnitHandle (udg_NowHash, GetHandleId(dmg), 4, udg_getdamager)
call SaveReal (udg_NowHash, GetHandleId(dmg), 2, Venom_Orb_DoT_Time(GetUnitAbilityLevel(udg_getdamager, Venom_Orb_ID())))
call SaveReal (udg_NowHash, GetHandleId(dmg), 5, 0.0)
call SaveReal (udg_NowHash, GetHandleId(dmg), 6, GetUnitX(u))
call SaveReal (udg_NowHash, GetHandleId(dmg), 7, GetUnitY(u))
call SaveReal (udg_NowHash, GetHandleId(dmg), 8, Venom_Orb_DoT_Damage(GetUnitAbilityLevel(udg_getdamager, Venom_Orb_ID())))
call TimerStart (dmg, Venom_Orb_DoTimer_Loop(), true, function Venom_Orb_DoT)
set dmg = null
call GroupAddUnit (udg_damage_group, u)
endif
set u = null
return false
endfunction
//=======================================
//The function for moving the dummy unit.
//=======================================
function Venom_Orb_Move takes nothing returns nothing
local timer move = GetExpiredTimer()
local timer dmg = null
local unit miss = LoadUnitHandle(udg_NowHash, GetHandleId(move), 1)
local real tarX = LoadReal (udg_NowHash, GetHandleId(move), 2)
local real tarY = LoadReal (udg_NowHash, GetHandleId(move), 3)
local real uniX = GetUnitX (miss)
local real uniY = GetUnitY (miss)
local real dist = SquareRoot ((uniX - tarX) * (uniX - tarX) + (uniY - tarY) * (uniY - tarY))
local real angle = Atan2 (tarY - uniY, tarX - uniX)
local real moveX = uniX + Venom_Orb_Move_Speed() * Cos(angle)
local real moveY = uniY + Venom_Orb_Move_Speed() * Sin(angle)
if dist <= Venom_Orb_Move_Speed() or IsTerrainPathable(moveX, moveY, PATHING_TYPE_FLYABILITY) == true then
call PauseTimer(move)
call DestroyTimer(move)
call FlushChildHashtable(udg_NowHash, GetHandleId(move))
set move = null
call DestroyEffect(AddSpecialEffect(Venom_Orb_End_SFX(), uniX, uniY))
call RemoveUnit(miss)
call GroupClear(udg_damage_group)
set miss = null
else
call SetUnitPosition (miss, moveX, moveY)
set udg_getdamager = LoadUnitHandle(udg_NowHash, GetHandleId(move), 5)
set udg_damage_group = LoadGroupHandle(udg_NowHash, GetHandleId(move), 20)
call GroupEnumUnitsInRange(LoadGroupHandle(udg_NowHash, StringHash("Global G"), 0), moveX, moveY, Venom_Orb_Pick_Radius(), Condition(function Venom_Orb_Pick_ActionFilter))
call SaveGroupHandle(udg_NowHash, GetHandleId(move), 20, udg_damage_group)
set miss = null
set move = null
endif
endfunction
//===============================================
//The starting function. Action, on cast function
//=================================================
function Venom_Orb_Actions takes nothing returns nothing
local timer move = CreateTimer()
local unit cast = GetTriggerUnit()
local real angle = Atan2 (GetSpellTargetY() - GetUnitY(cast), GetSpellTargetX() - GetUnitX(cast))
local real crX = GetUnitX(cast) + 15.0 * Cos(angle)
local real crY = GetUnitY(cast) + 15.0 * Sin(angle)
local unit miss = CreateUnit(GetOwningPlayer(cast), Venom_Orb_Dummy_ID(), crX, crY, angle * bj_RADTODEG)
local real targetX = GetUnitX(cast) + Venom_Orb_Travel_Dist(GetUnitAbilityLevel(cast, Venom_Orb_ID())) * Cos(angle)
local real targetY = GetUnitY(cast) + Venom_Orb_Travel_Dist(GetUnitAbilityLevel(cast, Venom_Orb_ID())) * Sin(angle)
call SaveUnitHandle (udg_NowHash, GetHandleId(move), 1, miss)
call SaveUnitHandle (udg_NowHash, GetHandleId(move), 5, cast)
call SaveGroupHandle(udg_NowHash, GetHandleId(move), 20, CreateGroup())
call SaveReal (udg_NowHash, GetHandleId(move), 2, targetX)
call SaveReal (udg_NowHash, GetHandleId(move), 3, targetY)
call TimerStart (move, Venom_Orb_MoveTimer_Loop(), true, function Venom_Orb_Move)
set cast = null
set miss = null
set move = null
endfunction
//=====================================================================================================================================
// **INIT TRIGGER**
//============================
function InitTrig_Venom_Orb takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Venom_Orb_Conditions))
call TriggerAddAction(t, function Venom_Orb_Actions)
call Preload(Venom_Orb_End_SFX())
call Preload(Venom_Orb_DoT_SFX())
call PreloadStart()
endfunction
//***************************************************************************************************
//* ========================
//* Pain Sludge ver.1.1
//* ========================
//* Made by Shdow89
//*
//*
//* How to implement:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* 1. Copy the spell "Pain Sludge" to your map.
//*
//* 2, Make a global variable of type unit and name it getdamager (case sensitive).
//* If you already have a variable of same name, or you already made this variable for
//* the other spell, just skip this step.
//*
//* 5. - Copy the trigger InitHashtable to your map.
//* - Copy the enitre enitre costum script section to your's in your map (top icon, with the map name is the costum script section)
//* - Copy the trigger Pain Sludge to your map.
//* - Change the spell raw codes in the spell code, and other data to what you desire.
//* - Enjoy
//* Choosable/Effects:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* Go down through constants and change the data what you like (special effects, damage, etc.).
//* Units affected are Non-Structure, Non-Magic immune, Living and Enemy units.
//* This can be adjusted in the Pain_Sludge_Action_Filter function, after if call.
//*
//*
//* Editor's Word:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* This spell doesn't have dummy units, and no dynamic group creation. I belive I did a
//* good job here, but I'm not sure, any comments are most wellcome.
//*
//* Spells Action:
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* Inflicts a target area with a sticky sludge, dealing minor damage to units in it.
//* Sludges will spawn at all enemy units in the targeted area, pulling them back slightly
//* to that position. Every 0.5 seconds they will receive damage, and farther away they are
//* from their sludge more damage they will receive.
//*
//* Credits:
//* ¯¯¯¯¯¯¯¯
//* dgriff for help with groups.
//* Paskovich for floating text as an external system.
//*
//* Changelog 1.1:
//* ¯¯¯¯¯¯¯¯
//* - Add a preload action.
//**************************************************************************************************************
constant function Pain_Sludge_Midd_SFX takes nothing returns string
return "Objects\\Spawnmodels\\Naga\\NagaBlood\\NagaBloodWindserpent.mdl" // This SFX is spawned when spell is casted in the center of casting point.
endfunction
constant function Pain_Sludge_Pull_SFX takes nothing returns string
return "Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl" // This SFX is spawned at the affected unit position, and it represents the sludge to which it's respective unit is being pulled.
endfunction
constant function Pain_Sludge_DoT_SFX takes nothing returns string
return "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl" // This SFX is spawned every x seconds on enemy units, that take damage from sludge.
endfunction
constant function Pain_Sludge_ID takes nothing returns integer
return 'A001' // The raw code of the Pain Sludge ability. Change to yours if used.
endfunction
constant function Pain_Sludge_AOE takes integer i returns real
return 200.0 * i // Area of Effect of the spell. This means 200 * level of Pain Sludge.
endfunction
constant function Pain_Sludge_Cast_Dmg takes integer i returns real
return 50.0 * i // Damage dealt to units when right after cast, to the units in casting area. This means 50 * level of Pain Sludge ability.
endfunction
constant function Pain_Sludge_Default_Pull_Dmg takes integer i returns real
return 20.0 * i // The damage dealt when unit is being pulled (DoT damage). This means 20 * level of Pain Sludge ability.
endfunction
constant function Pain_Sludge_Distance_Inc takes nothing returns real
return 0.1 // How much of distance (%) should be converted into damage. Distance between point on cast, and enemy units current position. 0.1 means 10 %.
endfunction
constant function Pain_Sludge_Pull_Dur takes integer i returns real
return 2.0 + i // The total duration of the Pain Sludge pull action. This means 2 + level of Pain Sludge ability.
endfunction
constant function Pain_Sludge_DmG_Rep takes nothing returns integer
return 17 // This integer presents when should damage be dealt (in pull function). This means every 16th shot of the Pain_Sludge_Timer_Loop. With default data it is 0.03 * 17 = 0.51 seconds.
endfunction
constant function Pain_Sludge_Pull_Speed takes nothing returns real
return 4.0 // The speed at which unit is being pulled to it's sludge. Please consider if this is to high, unit won't be able to run away from it.
endfunction
constant function Pain_Sludge_Timer_Loop takes nothing returns real
return 0.03 // How fast does the timer repeats itself. I suggest you leave this as it is, unless you know exactly what you're doing.
endfunction
//Done with constants. Don't touch anything below this line, if you are unsure.
//=======================================================================================================================
function Pain_Sludge_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Pain_Sludge_ID()
endfunction
//================================================================================================================================
function Pain_Sludge_Pull_Actions takes nothing returns nothing
local timer pull = GetExpiredTimer()
local effect f = LoadEffectHandle(udg_NowHash, GetHandleId(pull), 9)
//Settings for the time:
local unit dmg = LoadUnitHandle (udg_NowHash, GetHandleId(pull), 2)
local unit tar = LoadUnitHandle (udg_NowHash, GetHandleId(pull), 1)
local real ddmg = LoadReal (udg_NowHash, GetHandleId(pull), 7)
local real dur = LoadReal (udg_NowHash, GetHandleId(pull), 3)
local integer dmgR = LoadInteger (udg_NowHash, GetHandleId(pull), 8)
local real cDur = LoadReal (udg_NowHash, GetHandleId(pull), 6)
//Settings for the pull:
local real curX = GetUnitX (tar)
local real curY = GetUnitY (tar)
local real pulX = LoadReal (udg_NowHash, GetHandleId(pull), 4)
local real pulY = LoadReal (udg_NowHash, GetHandleId(pull), 5)
local real angle = Atan2 (pulY - curY, pulX - curX)
local real moveX = curX + Pain_Sludge_Pull_Speed() * Cos(angle)
local real moveY = curY + Pain_Sludge_Pull_Speed() * Sin(angle)
local real dist = SquareRoot((pulX - curX)*(pulX - curX) + (pulY - curY)*(pulY - curY))
if cDur < dur and IsUnitType(tar, UNIT_TYPE_DEAD) == false then
call SetUnitX(tar, moveX)
call SetUnitY(tar, moveY)
if dmgR == Pain_Sludge_DmG_Rep() then
call UnitDamageTarget(dmg, tar, ddmg + (dist * Pain_Sludge_Distance_Inc()), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_POISON, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect (AddSpecialEffect(Pain_Sludge_DoT_SFX(), GetUnitX(tar), GetUnitY(tar)))
call FloatText (I2S(R2I(ddmg + (dist * Pain_Sludge_Distance_Inc()))) + "!", 0, 255, 0, GetUnitX(tar), GetUnitY(tar), 0.07, 0.5, 1.5)
call SaveInteger (udg_NowHash, GetHandleId(pull), 8, 0)
else
call SaveInteger (udg_NowHash, GetHandleId(pull), 8, dmgR + 1)
endif
call SaveReal(udg_NowHash, GetHandleId(pull), 6, cDur + Pain_Sludge_Timer_Loop())
set dmg = null
set tar = null
set pull = null
set f = null
else
call PauseTimer(pull)
call DestroyTimer(pull)
call FlushChildHashtable(udg_NowHash, GetHandleId(pull))
set pull = null
call DestroyEffect(f)
set f = null
set dmg = null
set tar = null
endif
endfunction
function Pain_Sludge_Action_Filter takes nothing returns boolean
local unit u = GetFilterUnit()
local effect f = null
local timer pull = null
if IsUnitEnemy(u, GetOwningPlayer(udg_getdamager)) == true and IsUnitType(u, UNIT_TYPE_STRUCTURE) == false and IsUnitType(u, UNIT_TYPE_DEAD) == false and IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false then
call UnitDamageTarget(udg_getdamager, u, Pain_Sludge_Cast_Dmg (GetUnitAbilityLevel(udg_getdamager, Pain_Sludge_ID())), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_POISON, WEAPON_TYPE_WHOKNOWS)
set pull = CreateTimer()
call SaveUnitHandle(udg_NowHash, GetHandleId(pull), 1, u)
call SaveUnitHandle(udg_NowHash, GetHandleId(pull), 2, udg_getdamager)
call SaveReal (udg_NowHash, GetHandleId(pull), 3, Pain_Sludge_Pull_Dur(GetUnitAbilityLevel(udg_getdamager, Pain_Sludge_ID())))
call SaveReal (udg_NowHash, GetHandleId(pull), 4, GetUnitX(u))
call SaveReal (udg_NowHash, GetHandleId(pull), 5, GetUnitY(u))
call SaveReal (udg_NowHash, GetHandleId(pull), 6, 0.0)
call SaveReal (udg_NowHash, GetHandleId(pull), 7, Pain_Sludge_Default_Pull_Dmg(GetUnitAbilityLevel(udg_getdamager, Pain_Sludge_ID())))
call SaveInteger (udg_NowHash, GetHandleId(pull), 8, 0)
set f = AddSpecialEffect(Pain_Sludge_Pull_SFX(), GetUnitX(u), GetUnitY(u))
call SaveEffectHandle(udg_NowHash, GetHandleId(pull), 9, f)
call TimerStart (pull, Pain_Sludge_Timer_Loop(), true, function Pain_Sludge_Pull_Actions)
set f = null
set pull = null
endif
set u = null
return false
endfunction
function Pain_Sludge_Actions takes nothing returns nothing
local unit cast = GetTriggerUnit()
local real castX = GetSpellTargetX()
local real castY = GetSpellTargetY()
call DestroyEffect(AddSpecialEffect(Pain_Sludge_Midd_SFX(), castX, castY))
set udg_getdamager = cast
call GroupEnumUnitsInRange(LoadGroupHandle(udg_NowHash, StringHash("Global G"), 0), castX, castY, Pain_Sludge_AOE(GetUnitAbilityLevel(cast, Pain_Sludge_ID())), Condition(function Pain_Sludge_Action_Filter))
set cast = null
endfunction
//=====================================================================================================================================
// **INIT TRIGGER**
//============================
function InitTrig_Pain_Sludge takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Pain_Sludge_Conditions))
call TriggerAddAction(t, function Pain_Sludge_Actions)
call Preload(Pain_Sludge_Pull_SFX())
call Preload(Pain_Sludge_Midd_SFX())
call Preload(Pain_Sludge_DoT_SFX())
call PreloadStart()
endfunction