does anyone have a good way of doing custom channeled spells?
heres an example of what i mean, while the unit channels a spell, it deals damage to enemy units in the targetted area, each second increases the amount of damage done, and as soon as the unit stops channeling the damage stops. for a regular spell this is really easy
e: unit begins the effect of a spell
c: ability being cast equal to plague mist
a:
this will keep going even after the unit stops channeling, so i need some way to check if the unit is still channeling after the wait like...
global Unit Group called ChannelingGroup
this kind of works... but its just ghetto-rigged to work, and it is easily broken. it only checks if the unit is currently channeling a spell, it doesnt have to be the same cast of the spell, and it doesnt even have to be the same spell thats being channeled. if a unit started channeling this spell and then immediately started channeling a new spell this trigger would still keep looping through because the unit would be readded to the ChannelingGroup, so its works but its not reliable. anyone have a better way?
...wish there was a
"((Unit) is channeling Ability) Equal to True" boolean comparison....
edit: ok so i found a better way, but its still not perfect:
so now it has to be the same spell channeled, but if they stop and rechannel the same spell this trigger will keep going plus start a new instance of itself so its still not exactly right
heres an example of what i mean, while the unit channels a spell, it deals damage to enemy units in the targetted area, each second increases the amount of damage done, and as soon as the unit stops channeling the damage stops. for a regular spell this is really easy
e: unit begins the effect of a spell
c: ability being cast equal to plague mist
a:
Code:
local location targetloc = GetSpellTargetLoc()
local group targets = CreateGroup()
local unit caster = GetSpellAbilityUnit()
local unit tempTarget
local integer level = GetUnitAbilityLevel( caster, GetSpellAbilityId() )
local real dmgAmount = 50
local integer count = 0
local player owner = GetOwningPlayer( caster )
loop
exitwhen (count == (level+4))
call TriggerSleepAction(1.0)
call GroupEnumUnitsInRangeOfLoc( targets, targetloc, 200, null )
loop
set tempTarget = FirstOfGroup( targets )
exitwhen ( tempTarget == null )
call GroupRemoveUnit( targets, tempTarget )
if ( IsUnitEnemy( tempTarget, owner ) ) then
call UnitDamageTarget( caster, tempTarget, dmgAmount, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_SONIC, WEAPON_TYPE_WHOKNOWS )
endif
endloop
set dmgAmount = dmgAmount + 10
set count = count+1
endloop
call DestroyGroup( targets )
call RemoveLocation( targetloc )
set caster = null
set tempTarget = null
set owner = null
this will keep going even after the unit stops channeling, so i need some way to check if the unit is still channeling after the wait like...
global Unit Group called ChannelingGroup
Code:
start channeling
Events
Unit - A unit Begins channeling an ability
Conditions
Actions
Unit Group - Add (Casting unit) to ChannelingGroup
Code:
stop channeling
Events
Unit - A unit Stops casting an ability
Conditions
Actions
Unit Group - Remove (Casting unit) from ChannelingGroup
Code:
local location targetloc = GetSpellTargetLoc()
local group targets = CreateGroup()
local unit caster = GetSpellAbilityUnit()
local unit tempTarget
local integer level = GetUnitAbilityLevel( caster, GetSpellAbilityId() )
local real dmgAmount = 50
local integer count = 0
local player owner = GetOwningPlayer( caster )
loop
exitwhen (count == (level+4))
call TriggerSleepAction(1.0)
//==================================================================
// checks if unit is still channeling
exitwhen ( IsUnitInGroup( caster, udg_ChannelingGroup ) == false )
//==================================================================
call GroupEnumUnitsInRangeOfLoc( targets, targetloc, 200, null )
loop
set tempTarget = FirstOfGroup( targets )
exitwhen ( tempTarget == null )
call GroupRemoveUnit( targets, tempTarget )
if ( IsUnitEnemy( tempTarget, owner ) ) then
call UnitDamageTarget( caster, tempTarget, dmgAmount, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_SONIC, WEAPON_TYPE_WHOKNOWS )
endif
endloop
set dmgAmount = dmgAmount + 10
set count = count+1
endloop
call DestroyGroup( targets )
call RemoveLocation( targetloc )
set caster = null
set tempTarget = null
set owner = null
...wish there was a
"((Unit) is channeling Ability) Equal to True" boolean comparison....
edit: ok so i found a better way, but its still not perfect:
Code:
local location targetloc = GetSpellTargetLoc()
local group targets = CreateGroup()
local unit caster = GetSpellAbilityUnit()
local unit tempTarget
local integer level = GetUnitAbilityLevel( caster, GetSpellAbilityId() )
local real dmgAmount = 50
local integer count = 0
local player owner = GetOwningPlayer( caster )
local integer orderId = GetUnitCurrentOrder( caster )
loop
exitwhen (count == (level+4))
call TriggerSleepAction(1.0)
//==================================================================
// checks if unit is still channeling
exitwhen ( not (GetUnitCurrentOrder(caster) == orderId) )
//==================================================================
call GroupEnumUnitsInRangeOfLoc( targets, targetloc, 200, null )
loop
set tempTarget = FirstOfGroup( targets )
exitwhen ( tempTarget == null )
call GroupRemoveUnit( targets, tempTarget )
if ( IsUnitEnemy( tempTarget, owner ) ) then
call UnitDamageTarget( caster, tempTarget, dmgAmount, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_SONIC, WEAPON_TYPE_WHOKNOWS )
endif
endloop
set dmgAmount = dmgAmount + 10
set count = count+1
endloop
call DestroyGroup( targets )
call RemoveLocation( targetloc )
set caster = null
set tempTarget = null
set owner = null
so now it has to be the same spell channeled, but if they stop and rechannel the same spell this trigger will keep going plus start a new instance of itself so its still not exactly right