• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] AoE Heal Stacks

Status
Not open for further replies.
Level 12
Joined
Jul 26, 2007
Messages
164
Hey Guys, Im currently doing an AoE healing spell that should be able to stack up to four times per target and heal 10hp/3mana per stack per second, 1 stack lasts 5 seconds.
but it always just heals all at once.. someone maybe knows whats wrong with my code? thanks a lot in advance~
 

Attachments

  • spell.png
    spell.png
    108.3 KB · Views: 103
Level 12
Joined
Jul 26, 2007
Messages
164
oops sorry, i tried pasting correctly b4 but i did sthg wrong.. but thanks,
i didnt use sufficient debug messages yet, the ones i used didnt show up
heres the triggers:

  • Superstitious Aid
    • Events
      • Unit- A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equals Superstitious Aid
    • Actions
      • Unit Group- Pick every unit in (Units within 500.00 of (Position of (Triggering unit)) matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) equals True)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • ((Picked unit) is in SA_Group) Ungleich True
            • 'THEN'-Aktionen
              • Unit Group - Add (Picked unit) to SA_Group
              • Hashtabelle - Save 1.00 as SA_Stackcounter of (Key (Picked unit)) in LeHash
              • Hashtabelle - Save 5.00 as SA_TimerOfStack[1] of (Key (Picked unit)) in LeHash
            • 'ELSE'-Aktionen
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Conditions
                  • (Load SA_Stackcounter of (Key (Picked unit)) from LeHash) smaller than 4
                • 'THEN'-Aktionen
                  • Hashtabelle - Save ((Load SA_Stackcounter of (Key (Picked unit)) from LeHash) + 1.00) as SA_Stackcounter of (Key (Picked unit)) in LeHash
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • 'IF'-Conditions
                      • (Load SA_TimerOfStack[1] of (Key (Picked unit)) from LeHash) equals 0.00
                    • 'THEN'-Aktionen
                      • Hashtabelle - Save 5.00 as SA_TimerOfStack[1] of (Key (Picked unit)) in LeHash
                    • 'ELSE'-Aktionen
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • 'IF'-Conditions
                          • (Load SA_TimerOfStack[2] of (Key (Picked unit)) from LeHash) equals 0.00
                        • 'THEN'-Aktionen
                          • Hashtabelle - Save 5.00 as SA_TimerOfStack[2] of (Key (Picked unit)) in LeHash
                        • 'ELSE'-Aktionen
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • 'IF'-Conditions
                              • (Load SA_TimerOfStack[3] of (Key (Picked unit)) from LeHash) equals 0.00
                            • 'THEN'-Aktionen
                              • Hashtabelle - Save 5.00 as SA_TimerOfStack[3] of (Key (Picked unit)) in LeHash
                            • 'ELSE'-Aktionen
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • 'IF'-Conditions
                                  • (Load SA_TimerOfStack[4] of (Key (Picked unit)) from LeHash) Gleich 0.00
                                • 'THEN'-Aktionen
                                  • Hashtabelle - Save 5.00 as SA_TimerOfStack[4] of (Key (Picked unit)) in LeHash
                                • 'ELSE'-Aktionen
                • 'ELSE'-Aktionen


  • Superstitious Aid Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Aktionen
      • Unit Group - Pick every unit in SA_Group and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + ((Load SA_Stackcounter of (Key (Picked unit)) from LeHash) x SA_Heal))
          • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) + ((Load SA_Stackcounter of (Key (Picked unit)) from LeHash) x SA_Mana))
          • For each (Integer A) from 1 to 4, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Conditions
                  • (Load SA_TimerOfStack[(Integer A)] of (Key (Picked unit)) from LeHash) greater or equal 1
                • 'THEN'-Aktionen
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • 'IF'-Conditions
                      • (Load SA_TimerOfStack[(Integer A)] of (Key (Picked unit)) from LeHash) Gleich 1
                    • 'THEN'-Aktionen
                      • Hashtabelle - Save 0.00 as SA_TimerOfStack[(Integer A)] of (Key (Picked unit)) in LeHash
                      • Hashtabelle - Save ((Load SA_Stackcounter of (Key (Picked unit)) from LeHash) - 1.00) as SA_Stackcounter of (Key (Picked unit)) in LeHash
                    • 'ELSE'-Aktionen
                      • Hashtabelle - Save ((Load SA_TimerOfStack[(Integer A)] of (Key (Picked unit)) from LeHash) - 1.00) as SA_TimerOfStack[(Integer A)] of (Key (Picked unit)) in LeHash
                • 'ELSE'-Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • (Load SA_Stackcounter of (Key (Picked unit)) from LeHash) Gleich 0
            • 'THEN'-Aktionen
              • Unit Group - Remove (Picked unit) from SA_Group
              • Hashtabelle - Clear all child hashtables of child (Key (Picked unit)) in LeHash
            • 'ELSE'-Aktionen
 
Last edited:
it looks like u clicked each and every action to copy and paste the triggers. All u have to do is right click the trigger thing at the top of the trigger. this Superstitious Aid Loop and right click and click copy as text to copy and paste the whole thing.

Also can u translate this to english i cant read this lol

If the debug messages dont appear even at the top most part of ur trigger it means the event isnt firing or the condition is preventing it from firing. You can try to remove the condition and see if it fires still.
 
ok few things. Do any messages get displayed ?
get rid of integer A and use a tempint.

ur problem might be this. it looks like ur trying to load an integer variable when u have reals saved in the hashtable.
  • (Load SA_TimerOfStack[(Integer A)] of (Key (Picked unit)) from LeHash) greater or equal 1
umm reals are inaccurate so u should use integers instead.
Also this spell isnt MUI so it will break if cast twice b4 the first time ends.
You can take a look at my tutorial. The chapter labeled how to index will help u make it MUI. http://www.hiveworkshop.com/forums/tutorial-submission-283/things-gui-user-should-know-233242/
 
Also this spell isnt MUI so it will break if cast twice b4 the first time ends.
Of course it is MUI. What are you talking about?

@TO:
I have rewritten your trigger in pseudocode in order to make it more obvious (too many hashtable reads make it hard to read):

Code:
if unit is not in buffed group
  add unit to buffed group
  set stackcounter[unit] = 1
  set timer[1][unit] = 5
else
  if stackcounter[unit] < 4
    increment stackcounter[unit]
    if timer[1][unit] == 0              //use <= here! equal should never be used with reals!
      set timer[1][unit] = 5
    else
      if timer[2][unit] == 0
        set timer[2][unit] = 5
      else
        ...
      endif
    endif
  endif
endif

Every 1 second:
  Pick all units
    set life = life + stackcounter[unit] * heal
    set mana = mana + stackcounter[unit] * heal
    loop
    if timer[a][unit] >= 1
      if timer[a][unit] == 1           //use <= here!
        set timer[a][unit] = 0
        decrement stackcounter[unit]
      else
        decrement timer[a][unit]
      endif
    endif
    if
      if stackcounter[unit] == 0       //use <= here!
        remove from buffed group
        clear table of unit
      endif
    endif
    endloop

Are stackcounter and TimerOfStack constants? I don't quite get the reason why those variables are there, as you could just use constant integers instead.
If so, what are the values of those variables?

Aside from the use of "equal", which should never be used with reals, there's no bug in your triggers that I can see now. The logic should work.
Make sure you don't confuse integers with reals in your hashtable reads. If you store your value as real, you can't load them as integers and the opposite - just like deathismyfriend said.

I strongly recommend replacing all your reals with integers, as you actually use them as integers, not as reals. So there's no point in using reals in the first place.
 
Level 12
Joined
Jul 26, 2007
Messages
164
Thanks a lot guys for helping me. I converted the reals to ints and made more efficient comparisons. But I think the real/int stuff was not the problem because of autoboxing.

I have the stackcounter to count the stacks on each unit and the
Stacktimer[] as a timer indicator for each stack lying on a unit.

it shows that (now they're all ints, and i placed debugging messages) the definition of the timer(s) and the definition of the stackcounter in the main func are overwriting each other (realized when chnging their order).

My question is:
Can't there be arrays in a hashtable or two different integers for the same key handle?
 
My question is:
Can't there be arrays in a hashtable or two different integers for the same key handle?
I think you misunderstood the way hashtables work.
You don't "put an array" in the keys of the hashtable, they are just indices.

A hashtable is nothing else but a two dimensional array.

The parent is the first dimension, the child key the second dimension.
That's why I asked about those arrays and the integer you used.

Basicly, all you need is replace those arrays and the Counter variable by constant integers.

You could just use "0" for the counter variable and "1" to "4" for the timer values.

This way, you store the values for each unit like this:
table[Key of Unit][0] = counter
table[Key of Unit][1] = timer 1
table[Key of Unit][2] = timer 2
...

As the Key of a unit is a unique value that will only be assigned once at the same time, there is no way the values can actually collide.

However, you need to make sure you don't assign the childkeys based on the Key of Unit parent for other spells aswell.
Make sure that every spell uses different child keys.

So for example, if your first spell takes up the first 5 indices, make sure the second one starts from index 6, etc. - or just create another hashtable for it.

You can use constant integers defined on map init to make those indices configurable. Like for example:
"Spell_Heal_counter" = 0
"Spell_Heal_timer" = 1
...
"Spell_Buttkicker_counter" = 5
"Spell_Buttkicker_timer" = 6
...
etc.
 
Status
Not open for further replies.
Top