| 01-09-2004, 02:25 AM | #1 |
Well you see...Im trying to learn a new thing. And its really cunfusing. I want to be able to pick every unit in the region of the targeted point. Easy. Then i Want to set them to an array, also easy. Now heres the hard part, but also hard to explain. I want the number of unit in the array to be even, and i also want to match the units up. 1with 2, 3 with 4, etc. Now here comes the weird part. How do i detect how many units are in the array so ino when to stop matching the units with other units? This is really cunfusing. And i was wondering, If i put a flase action, like Mix unit array 12 with unit array 13, if they didnt exsist? Would that work? Becuase i do belive the max would be 20 in a 500 by 500 region. So thats my quesiotn and heres my trigger. Also, i am creating units at the posion of every 2 units. SO i will also like to know how i am supposed to get rid of them, i dont want this to look crappy. Spell2 Events Unit - A unit Begins casting an ability Conditions Actions Set UnitGroup = (Units in (Region centered at Point with size (500.00, 500.00)) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))) For each (Integer A) from 1 to (Number of units in UnitGroup), do (Actions) Loop - Actions Set Units[(Integer A)] = (Random unit from UnitGroup) Unit Group - Remove Units[(Integer A)] from UnitGroup |
| 01-09-2004, 02:48 AM | #2 |
Well how to detect how many units, just use an integer varibale, name it unitcount or whatever and set it to unitcount+1 every time you pick a unit... that should work, if I'm understanding what you need... |
| 01-09-2004, 02:56 AM | #3 |
ok i had thought of that before...another thing, how wouldi cut off the ODD unit? Say there are 13 units, how would i cut that 13th unit out of the array? OOOH IDEA SPURT!! Could i do this? If Units in region blah blah blah, is greater than Interger A, then set Random unit from unit group array Interger A, then remove that unit from the unit group? Seems like it would.. |
| 01-09-2004, 10:59 PM | #4 |
I whole day and i still havent gotten this. |
| 01-10-2004, 12:05 AM | #5 |
Okay what you want when you have an odd number in the array is the next lowest even number, try this on for size: Where n is the integer variable holding the number of units added to the array. Set n = (n - (n mod 2)) Use the "modulo integer" function for the second part. It's just simple mathematics not a hard trigger question, in simple terms modulo returns the remainder of a division, an odd number divided by 2 has a remainder of 1, an even number a remainder of 0. |
| 01-10-2004, 03:23 AM | #6 |
Thanks dude. And wahts up with the custom title? LoL. *Looks at own sig* |
| 01-10-2004, 03:56 AM | #7 |
I dunno, the boards seems to set my title by itself. I was champion not long ago. Guess I'll set it manually to something more appropriate. |
| 01-10-2004, 04:12 AM | #8 |
If the above doesn't work... Add units in region to unit group. For each unit in unit group add 1 to integer variable (x) If (x) = 1 then -1 from (x) else (if (x) = 3 then -1 from (x) else (if (x) = 5 then -1 from (x)... and so on. Then divide x by two Then create (x) number of units (of whatever type your creating here) And that should handle it. |
| 01-10-2004, 04:18 AM | #9 |
That makes me mad grater. LOL. Now everyone is going to have my title. Thanks for changing it. |
