| 04-28-2006, 05:51 AM | #1 |
JASS:function FilterIsEnemy takes nothing returns boolean return IsUnitEnemy(GetFilterUnit(), bj_groupEnumOwningPlayer) and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) endfunction function DamageEnemiesArea takes unit damageUnit, real radius, real x, real y, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns nothing local group g = CreateGroup() local boolexpr b = Condition(function FilterIsEnemy) local unit u set bj_groupEnumOwningPlayer = GetOwningPlayer(damageUnit) call GroupEnumUnitsInRange(g, x, y, radius, b) call DestroyBoolExpr(b) loop set u = FirstOfGroup(g) exitwhen u == null call GroupRemoveUnit(g,u) call UnitDamageTarget(damageUnit,u,amount,attack, ranged,attackType,damageType,weaponType) endloop call DestroyGroup(g) set g = null set b = null endfunction any ideas taht when this is used, it damages all units in the area, whether ally or enemy, when it should jsut damage enemy structures? |
| 04-28-2006, 11:28 AM | #2 |
http://www.wc3jass.com/viewtopic.php?t=2370 Read that. IsUnitType is bugged when used in boolean expressions, you need to compare it to another boolean value to make it work. Just add a "== true", and it should work. |
| 04-28-2006, 01:48 PM | #3 |
i will try that again, but I am almost positive, ive tried them both w/o ==, both w/ ==, and both combos of 1w/ 1 w/o, with still no luck |
| 04-28-2006, 02:07 PM | #4 |
you can avoid the whole boolexpr problem JASS:function DamageEnemiesArea takes unit damageUnit, real radius, real x, real y, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns nothing local group g = CreateGroup() local unit u set bj_groupEnumOwningPlayer = GetOwningPlayer(damageUnit) call GroupEnumUnitsInRange(g, x, y, radius, null) call DestroyBoolExpr(b) loop set u = FirstOfGroup(g) exitwhen u == null call GroupRemoveUnit(g,u) if (IsUnitEnemy(u, bj_groupEnumOwningPlayer) and IsUnitType(u,UNIT_TYPE_STRUCTURE)) then call UnitDamageTarget(damageUnit,u,amount,attack, ranged,attackType,damageType,weaponType) endif endloop call DestroyGroup(g) set g = null endfunction |
| 04-29-2006, 10:54 AM | #5 |
I have tried this but I have been unsuccessful.. Maybe become my problem is slightly more complex. I want to able to damage a certain type of buildings. There is a workaround for this. However I am already using this work already to handle another kind of target This is to make the attack, effect or spell only target wards. And give the building a ward classifcation. |
| 04-29-2006, 10:49 PM | #6 |
Now if only emjlr3 was around :(. |
| 05-01-2006, 02:27 AM | #7 |
well that didnt work, just as I predicted... :( anywho, if anyone smarter then I wants to take a look here u go |
| 05-01-2006, 07:45 AM | #8 |
The reason it is damaging all the units is because of your Blizzard spell which it based off. You set the maximum damage to 0, which actually means infinite (so no cap), meaning the blizzard damage is still being dealt to all units in the area. Set the 'Damage' field of blizzard to 0 (you need to shift click to do it) and it works fine. |
| 05-01-2006, 01:45 PM | #9 |
^^ yea i figured that out last night rofl |
