Warcraft III resources & community, 2003–2006 · archived

Can someone help me here

16 posts
#1

Can someone help me here

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?
#2
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.
#3
Could you be just a little more descriptive....
#4
What he's trying to say is that you need trigger which periodically activates, drains life from the unit and gives mana to the original caster.
#5
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.
#6
ok ok here it is..... i think

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)

and set it too on off
#7
You mean Turn On instead of Run. Right?

And you should make another trigger which turns off. The trigger would be something like:

Event - An unit stops casting an ability
Conditions - Ability being cast to (Whatever)
Actions - Turn off Trigger 1
- Turn off Trigger 2.
#8
oh yeah.... i forgot about that one, sry
#9
Wrong, have the first trigger say Set caster=Triggering unit, and Set target=target and ability being caster, not the second one.
#10
oooh.. didn't notice that.
#11
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.
#12
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
#13
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!
#14
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 :wink:

@ 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
#15
Jass... yeah right. I don't get a thing from it anyway... Good example though :P