PurgeandFire
zxcvmkgdfg
- Reaction score
- 509
UnitDamageArea() - v4
Well, the Jump spell is just an addition. I just literally whipped it up fast and it was just as an example.
Note: Yes, the jump spell is not part of the submission.
Import Difficulty: It is a snippet... 1/10
MUI: Yes, the snippet is MUI. As well as the spell.
GUI/JASS/vJASS: Snippet - JASS (Spell - vJASS)
Systems Used: None (Spell uses HSAS v.3.6)
Now here is proof that this works and damages units:
As you can see, the unit was damaged.
The jump spell is a simple jump, so here is the description of my thing:
Description/Purpose:
Enums units in a target area, and allows you to damage them for a certain amount. This has the same features as the UnitDamagePoint except there aren't the booleans for "ranged" and "attack" and it allows you to specify a boolexpr. I'm not positive but I think that if you specify null it will use the safe filter to avoid leaking. But you should probably just directly use the safe filter if you don't want to filter units out.
Why did I make this?
Captain Griffen said:UnitDamagePointLoc is a big no no (as for that matter is UnitDamagePoint). It causes desyncs on Macs, and is totally customizable. Change it to enuming a group and damaging each one and it'll not desync on Macs, and become a customizable spell.
So this is the simple enum process to avoid desyncs to all those mac users out thar!
JASS:
function FiltSafe takes nothing returns boolean
return true
endfunction
function UnitDamageArea takes unit u, real x, real y, real radius, real damage, attacktype at, damagetype dt, weapontype wt, boolexpr boo returns nothing
local group g = CreateGroup()
local unit dum
local boolexpr b
if boo == null then
set b = Condition(function FiltSafe)
else
set b = boo
endif
call GroupEnumUnitsInRange(g,x,y,radius,b)
loop
set dum = FirstOfGroup(g)
exitwhen dum == null
call UnitDamageTarget(u,dum,damage,true,false,at,dt,wt)
call GroupRemoveUnit(g,dum)
endloop
call DestroyGroup(g)
set g = null
set b = null
endfunction
function UnitDamageAreaLoc takes unit u, location l, real radius, real damage, attacktype at, damagetype dt, weapontype wt returns nothing
call UnitDamageArea(u,GetLocationX(l),GetLocationY(l),radius,damage,at,dt,wt,Condition(function FiltSafe))
endfunction
Enjoy!
Changelog (Like I really need one, it is just a snippet ):
Code:
v1 - Initial posting
v2 - UnitDamageAreaLoc() is for GUI users... [you can't specify a boolexpr]
v3 - Allow you to null the boolexpr value to damage all units in that area. (Not sure if it leaks, but it shouldn't [it should fix the boolexpr null problem])
v4 - Cleaned the code a bit. Oddly it reduced the size like 11 kbs or so...
v5 - Even though it is just an example, I updated the spell code for a divide by 0 error, and now you can change the arch effect by typing either: yellow, blue, red, green, purple, fx, or light.