I don't see why Channel doesn't work, neither do Life Drain and Siphon Mana.
-For Channel, there is a boolean field that says, disable other abilities, set this to false. There is a bit flag field that have a few options, toggle Visible, Unique Cast on. Channel was used by me in Omni Drain to simulate Life Drain, you may take a look.
-Life Drain: I'm sure in the Gameplay Constants there is a boolean field down at the bottom that has something to do with Life Drain able to target allies. Just toggle it.
Siphon Mana is the same with Life Drain. And for Life Drain, I understand now what you wanted and why it doesn't work. Because from everything I tried, you cannot make it target both enemy and friendly units. It will only target enemies. So Life Drain/Siphon Mana are out indeed.
The problem with channel is 1auses caster 2oesnt stop channeling when the target enemy dies. But it's ok, i got it to work, but unfortunatly had to pause the caster. Heres the code:
function Trig_Corruption_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A01B' ) ) then
return false
endif
return true
endfunction
function Trig_Corruption_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local player owner = GetOwningPlayer(target)
local integer range = (( GetUnitAbilityLevelSwapped('A01B', caster) ) * 500)
local trigger t = CreateTrigger()
local integer level = ( GetUnitAbilityLevelSwapped('A01B', caster) )
local integer x = 1
local integer expire
local effect fx
call TriggerSleepAction(0.25)
call PauseUnitBJ( true, caster )
call SetUnitAnimation( caster, "spell looping" )
call AddSpecialEffectTargetUnitBJ( "origin", caster, "Abilities\\Spells\\Orc\\Voodoo\\VoodooAura.mdl" )
set fx = GetLastCreatedEffectBJ()
call SetUnitOwner( target, GetOwningPlayer(caster), true )
if (level == 1) then
set expire = 30
elseif (level == 2) then
set expire = 40
elseif (level == 3) then
set expire = 50
else
set expire = 60
endif
loop
exitwhen ( IsUnitDeadBJ(target) == true )
exitwhen ( IsUnitDeadBJ(caster) == true )
exitwhen ( DistanceBetweenPoints(GetUnitLoc(caster), GetUnitLoc(target)) > I2R(range) )
exitwhen (x > expire)
set x = x+1
call TriggerSleepAction(0.10)
endloop
call SetUnitOwner( target, owner, true )
call PauseUnitBJ( false, caster )
call ResetUnitAnimation( caster )
call DestroyEffectBJ( fx )
set target = null
set caster = null
set t = null
set fx = null
endfunction
//===========================================================================
function InitTrig_Corruption takes nothing returns nothing
set gg_trg_Corruption = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Corruption, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Corruption, Condition( function Trig_Corruption_Conditions ) )
call TriggerAddAction( gg_trg_Corruption, function Trig_Corruption_Actions )
endfunction
I had to time it with integers because times werent working for some reason.
Arcanister, i notice you requested a similar spell (cant remember name). Want me to post it?
I'm having the same problem targeting an ally. Perhaps if you use a trigger to set either the caster or the target to an enemy, then cast the spell then change back it may work.