Howdy, I'm creaing a "Drain" spell. It's based on Drain Life. What differs is that for the duration of it both the caster and the target are paused, with the caster being invulnerable. After the spell is done, the caster gains "Well Fed" buff which increases attack speed for a few seconds.
To do this, I used as base ability Drain Life, as said before. The ability itself won't give the targeted unit no buff for some reason, so I made a dummy ability based on bloodlust to give the target a "drain" buff, so the triggers knows when the abillity end when the buff wears off.
For Well Fed I used another abillity also based on bloodlust.
-The problem is, the trigger doesn't fire, it doesn't pause the units or anything.
To do this, I used as base ability Drain Life, as said before. The ability itself won't give the targeted unit no buff for some reason, so I made a dummy ability based on bloodlust to give the target a "drain" buff, so the triggers knows when the abillity end when the buff wears off.
For Well Fed I used another abillity also based on bloodlust.
-The problem is, the trigger doesn't fire, it doesn't pause the units or anything.
JASS:
function Trig_Drain_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction
function Trig_Drain_Actions takes nothing returns nothing
local unit affected
local unit bloodhunter
local unit dummy
set affected = GetSpellTargetUnit()
set bloodhunter = GetTriggerUnit()
call PauseUnitBJ( true , affected )
call PauseUnitBJ( true , bloodhunter )
call SetUnitInvulnerable( bloodhunter , true )
set udg_DeletingLeaks = GetUnitLoc(affected)
call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(affected), udg_DeletingLeaks, bj_UNIT_FACING )
set dummy = GetLastCreatedUnit()
call RemoveLocation(udg_DeletingLeaks)
call UnitAddAbilityBJ( 'A001', dummy )
call IssueTargetOrderBJ( dummy, "bloodlust", affected )
call UnitRemoveAbilityBJ( 'A001', dummy )
call KillUnit( dummy )
loop
exitwhen ( UnitHasBuffBJ(affected, 'B005') == false )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 1))
endloop
call SetUnitInvulnerable(bloodhunter,false)
call PauseUnitBJ(false,affected)
call PauseUnitBJ(false,bloodhunter)
set udg_DeletingLeaks = GetUnitLoc(bloodhunter)
call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(bloodhunter), udg_DeletingLeaks, bj_UNIT_FACING )
set dummy = GetLastCreatedUnit()
call RemoveLocation(udg_DeletingLeaks)
call UnitAddAbilityBJ( 'A009', dummy )
call IssueTargetOrderBJ( dummy, "bloodlust", bloodhunter )
call UnitRemoveAbilityBJ( 'A001', dummy )
call KillUnit( dummy )
set dummy = null
set affected = null
set bloodhunter = null
endfunction
//===========================================================================
function InitTrig_Drain takes nothing returns nothing
set gg_trg_Drain = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Drain, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Drain, Condition( function Trig_Drain_Conditions ) )
call TriggerAddAction( gg_trg_Drain, function Trig_Drain_Actions )
endfunction