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?
base your spell off either Siphn Mana or Life Drain, and set it so that it does zero (0) life or mana steal. Then use triggers to detect when your spell is active, and trigger periodic life loss for the targetted unit and periodic mana gain for the caster.
I know that! but my problem is i dunno how, i get the event and condition but theres about 5 million different options for action and finding just 1 can be a real pain in the tookish. So can someone tell me where the right action is, or post a copied thing of it.
Events Unit - A unit Starts the effect of an ability Conditions (Ability being cast) Equal to H to M Actions Trigger - Run health <gen> (ignoring conditions)
then create another trigger
Events Time - Every 1.00 seconds of game time Conditions Actions Set caster = (Casting unit) Set target = (Target unit of ability being cast) Wait 0.05 seconds Unit - Set life of target to ((Life of target) - 1.00) Trigger - Run mana <gen> (ignoring conditions) and put this trigger on initially on to off
then create another trigger.....
Events Time - Every 1.00 seconds of game time Conditions Actions Set caster = (Casting unit) Wait 0.05 seconds Unit - Set mana of caster to ((Mana of caster) + 100.00) Wait 10.00 seconds Trigger - Turn off (This trigger)
i would use loops instead of those "every x sec." events.
if i would do it, it would look sth. like:
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.)
btw, u can't wait 0.05 sec., the WE waits at least 0.33 sec.
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.
Umm... what happens if the spell is stopped? You could use a "Skip Remaining Actions" though and that is a solution but you didn't mention it. Good idea though... I like it more!
The_RavenYea, 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
of course could be local variables added to make it multiple unit compatible
@ daelin: the "spell stopped" would be implemented too (look at the "exitwhen"), if it would look like this:
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