Simple JASS question, multiple instances

svenski

New Member
Reaction score
1
I'm brand new here, and new to map making, so my dilemma is relatively basic.

I've got a very simple spell i want to have castable on multiple units who's effects can stack. It simply does:

set life of target unit of ability being cast = life of target unit + healed amount

every 1 second after the spell is cast, for 15 seconds, and then destroys the created unit-attached spell effect.

I thought i could have it stack without using JASS by using manipulating triggers and variable arrays, but it got REALLY messy and impossible to write... trying to use the time of day as a reference of expiration and checking every tenth of a second to see if the first instance of the spell cast was done, to remove the associated effect, and to cut off the healing to that target... :banghead:

It would be way simpler if the target unit variable and the associated spell effect variable could be stored in multiple instances.

Can this be done in JASS? And, would it be easy to write?
Or would there be an easy way of doing it in the regular editor?

Thanks for any help -
 

svenski

New Member
Reaction score
1
To anyone who might have cared, I got something to work, REALLY roughly done in JASS, but i figured out how local variables allow for stacking of the spell, and it seems to be working!


This is the action taken after the trigger pops:

JASS:
function Trig_TESTREJUV_Actions takes nothing returns nothing
    local unit target = GetSpellTargetUnit()
    local effect healfx = AddSpecialEffectTargetUnitBJ( "origin", target, "Abilities\\Spells\\NightElf\\Rejuvenation\\RejuvenationTarget.mdl" )
    call SetUnitLifeBJ( target, ( GetUnitStateSwap(UNIT_STATE_LIFE, target) + udg_RejuvHealedAmount ) )
    call TriggerSleepAction( 1.00 )
    call SetUnitLifeBJ( target, ( GetUnitStateSwap(UNIT_STATE_LIFE, target) + udg_RejuvHealedAmount ) )
    call TriggerSleepAction( 1.00 ) //...keep healing and waiting till 15 heals happen
    call DestroyEffectBJ( healfx )
endfunction


I would rather do this with a timer, but not sure how to do it yet. Teaching myself as I go here...

Another problem here is that the spell effect sticks around when the unit dies/revives during the 15 seconds. I suppose i could add an If statement to check if the unit is alive each time the heal rolls... but i'll work that in if i can get a timer to roll the heals.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top