| 04-23-2006, 11:01 AM | #1 |
I'm looking for a way to find out if a unit is capable of attacking. However, this function doesn't work: JASS:IsUnitType(un, UNIT_TYPE_ATTACKS_GROUND) In the GUI, this says "Able to attack ground units". This function returns false for things like footmen and archers. Why is that? The strangest thing is that it returns true for units with orb abilities. Is there a reason this function is misbehaving? Does anyone know of a way to check if a unit can attack? |
| 04-23-2006, 11:12 AM | #2 |
You could try checking if it is a melee/ranged attacker, and if both are false, then it can't attack. Might not work though. |
| 04-23-2006, 11:23 AM | #3 |
Oh. Wow, I didn't even notice those. :/ [edit] Thanks, works perfectly. I'm checking one or the other, and neither return true for things like villagers, pack horses, etc. Awesome. +rep |
| 04-23-2006, 11:25 AM | #4 |
Veun, i think that the attacks_ground would apply only to units that can attack ground such as catapults for example |
| 04-23-2006, 11:33 AM | #5 | |
Quote:
Ooh, good call. But there's an identical classification to that one called ATTACKS_FLYING, and there's no such thing as an "attack flying" order. And why would attack ground return true on orb abilities? |
| 04-23-2006, 11:55 AM | #6 |
Most likely a buggy function. Many functions that look like they'd be useful are buggy. |
