| 02-19-2007, 10:53 PM | #1 |
1. How do i count the number of units in a unit group? i cant find the native for it. 2. How do i use the CasterCast natives that i see in jasscraft? Are they worth using? |
| 02-19-2007, 10:59 PM | #2 |
2. user the caster system by vex. they are not natives though. |
| 02-19-2007, 11:46 PM | #3 |
There is no native for it; there is a CountUnitsInGroup bj function. |
| 02-20-2007, 03:49 AM | #4 |
You could do it like this: JASS:function CountUnitsInGroup takes group G returns integer local integer I = 0 local unit U loop set U = FirstOfGroup(G) exitwhen U == null set I = I+1 call GroupRemoveUnit(G, U) endloop return I endfunction |
| 02-20-2007, 09:02 AM | #5 | |
Quote:
for those CasterCast natives, try search for vex's caster system for more information http://wc3campaigns.net/forumdisplay.php?f=588 |
| 02-20-2007, 10:07 AM | #6 | |
Quote:
JASS:function CountUnitsInGroup takes group G returns integer local integer I = 0 local unit U local group G2 = G loop set U = FirstOfGroup(G2) exitwhen U == null set I = I+1 call GroupRemoveUnit(G2, U) endloop return I endfunction |
| 02-20-2007, 01:01 PM | #7 |
I don't see why would you want to create a new function for it when the BJ works just fine and does it a lot faster. You have an error in your function: JASS:local group G2 = G |
| 02-20-2007, 08:42 PM | #8 |
Damn. I concede; I've failed. |
| 02-20-2007, 09:42 PM | #9 |
JASS:function LawlICanCount takes group g returns integer set bj_groupCountUnits = 0 call ForGroup(g, function CountUnitsInGroupEnum) return bj_groupCountUnits endfunction |
