- Joined
- Oct 20, 2004
- Messages
- 68
Its a channel spell, what I'm trying to do is, It slowly sucks the health out of the enemy, but gives back mana to the user. So far I've been unseccesful(and a little bit lazy) so can anyone assist me with this?
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to your ability
action:
set caster = caster
set target = target
for each loop integer a from 1 to (e.g.) 30, do multiple actions:
loop actions:
Unit - Set life of target to ((Life of target) - 10.00)
Unit - Set mana of caster to ((Mana of caster) + 10.00)
wait (1.00 sec.)
The_Raven said:Yea, but (casting unit) can only apply to one unit at a time and (target of ability being cast) is reset after a wait. This is why I love local variables.
~The_Raven
function condtition_check takes nothing returns boolean
return ( GetSpellAbilityId() == 'yourspellabilityID' )
endfunction
function spell_effects takes nothing returns nothing
local unit caster = GetSpellAbilityUnit ()
local unit target = GetSpellTargetUnit ()
local integer a = 1
loop
exitwhen (a > 30) or ( UnitHasBuffBJ(caster, 'BPSE') == true ) //'BPSE' = e.g. Buff of stormbolt
call SetUnitLifeBJ( target, ( GetUnitStateSwap(UNIT_STATE_LIFE, target) - 10 ) )
call SetUnitLifeBJ( caster, ( GetUnitStateSwap(UNIT_STATE_MANA, caster) + 10 ) )
call PolledWait (2)
endloop
//==================================================
function Init_Trig_spell takes nothing returns nothing
set gg_trg_spell = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_spell, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_spell, Condition( function condition_check ) )
call TriggerAddAction( gg_trg_spell, function spell_effects)
endfunction