HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Action "Unit - Damage Area" restrictions

08-17-2006, 11:45 PM#1
Zalvurek
Right now I'm using the "Unit - Damage Area" trigger to deal the damage apart of one of the complex spells in my map, however I don't want it to deal damage to specific unit conditions (like structures). How would I go about doing this?

I have thought about making a dummy unit and ability to use an aoe that would do just that but I want to know if there is a simpler way to do that.

Note: I don't know if this makes a difference to any of you but it did to me when I was trying to figure it out, but, the action is already using "picked unit" for the unit casting the spell.

Thank You
08-17-2006, 11:58 PM#2
Mezzer
You could put all the units you wanted into a group and damage them individualy or cast a dummy spell. There's no problem with using GetEnumUnit() (the picked unit) since it always returns the unit that's picked in the current ForGroup loop
08-18-2006, 12:25 AM#3
Zalvurek
Well, the problem i was running into with the picked unit was that it was a ForGroup loop inside another ForGroup loop so it wouldnt pick the unit from the first loop. I was going to damage each individually that way but I couldn't pick the unit in the first loop.

I may just end up with dummy unit and dummy spell.
08-18-2006, 07:56 AM#4
BertTheJasser
Just use
Collapse JASS:
GroupEnumUnitsInRange takes group,real x,real y,real radius,filter fil

Use as filter your condition and then loop through the units of the group.

[do not forget to destroy the filter and the group]
08-18-2006, 09:55 AM#5
zeroXD
I dont know if the bug is fixed, but last time i tried "Damage Area" my guy killed evrything in there, even if i did 0 damage. But that was back in the time of 1.17 wc3, so it might have changed. But the trigger below works very fine, and you can also define what kind of targets you want to hit.
The damage, area and conditions can be changed.

Trigger:
Actions
Collapse Unit Group - Pick every unit in (Units within 500.00 of (Center of (Playable map area)) matching ((((Matching Unit) is A structure) Equal to False) and (((Matching Unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))) and do (Actions)
Collapse Loop - Actions
Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal

EDIT: I wrote wrong. U must remember to use "Matching Unit" in the conditions when you pick the targets.
08-18-2006, 09:59 AM#6
The)TideHunter(
Yep, Bert said it, so did Mezzer.

Collapse JASS:
function DamageLocEx takes unit Credit, real AoE, real X, real Y, real damage, attacktype Attacktype, damagetype Damagetype, boolexpr filter returns nothing
    local group g = CreateGroup()
    local unit CurrentUnit
    call GroupEnumUnitsInRange(g, X, Y, AoE, filter)
    loop
        set CurrentUnit = FirstOfGroup(g)
        exitwhen CurrentUnit==null
        call UnitDamageTarget(Credit, CurrentUnit, damage, true, false, Attacktype, Damagetype, null)
        call GroupRemoveUnit(g, CurrentUnit)
    endloop
    call DestroyGroup(g)
    set g = null
endfunction
08-19-2006, 07:40 AM#7
BertTheJasser
@ zeroXD : Your GUI code is really bad, it is a for group call aswell, even if it does not show to you to be one.
@ The)TideHunter( :Destroy the boolexpr, most GUI-guys never heared of the leakage of boolexpr/filter/condtions/triggaeractions/triggerconditions.
08-21-2006, 08:01 PM#8
The)TideHunter(
I dont normally put the destroy boolexp in, because they might need to use it again.
Most probally not, but why take the chance?
08-21-2006, 08:12 PM#9
wonder_priest
Just say to use a null argument if there is not one, and to just convert a gui condition into custom script and use that if there is one.