• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Damage a unit only once

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

I have a little problem. I want make a spell. In this spell some dummies are created and after some duration, these dummies should cast a thunderclap.

The problem is now, if these dummies are to close to each other, the targets (who get damage by thunderclap) can get damaged more then one time. How to prevent this problem?

The problem is now, that all thunderclaps are casted at the same time, so I thought, to check if a target unit already has the thunderclap buff doesn't work. Same I thought about, to damage all nearby units with a trigger and I add these units into a unit group and make a condition, if the unit isn't in this group = damage.
But again, I think this doesn't work, because all thunderclaps are casted at the same time.

So someone here can help me with this little problem please? =)

Greetings ~ Thanks ~ Peace
Dr. Boom
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
This does work:

JASS:
function damageUnits takes nothing returns nothing
    call GroupEnumUnitsInRange(bj_lastCreatedGroup, -100., 0., 300., null)
    call GroupEnumUnitsInRange(bj_lastCreatedGroup, 100., 0., 300., null)
    
    call ForGroup(bj_lastCreatedGroup, function dealDamage)
    call GroupClear(bj_lastCreatedGroup)
endfunction

A unit can only be inside a unit group once, so he won't get twice the damage.
You just need to make the thunderclap a dummy ability.
 
Thunder Claps won't be cast at the same time. Even if you use a loop, the units will be ordered one after another to cast the ability, so, when you pick units in the position around the first dummy and add them in a unit group, the next dummy in the loop won't damage them again.
You of course need to trigger the damage though, because you cannot control which units you may damage with preset damage abilities, like Thunderclap, unless you want to add some sort of Unit Classification.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

Ahh good to hear from you :goblin_yeah:

But I have a question, why you use two "GroupEnumUnitsInRange" with 100 and -100. Can I do this in just one action with the same effect?

Edit: Ohh I saw Pharaoh's post ... Well I know this, but I thought, they do it at the same time in a loop, but if you say they don't, well I will try this then =)
 
Status
Not open for further replies.
Top