| 06-29-2007, 02:17 AM | #1 |
Instead of manually assigning hundreds of units/doodads/regions to a variable, I was wondering on whether i could use random integer and a loop. Obviously, before I attempted this, I would have to know how random integer works. For example, if I say for integer a 1-132, and repeated this 132 times, would the integer randomly chosen go through each number or would it truly be random? When you have an iPod on shuffle, it randomly goes through each of the 132 songs before repeating any one fo the songs. Would the random integer thing work in the same way? If this did work, I think I could do something like this. Trig 1 Events- Init Conditions- Integer Var = to less than 0 Actions- Set Integer Var to 132 Every .01 seconds, run Trig 2 Trig 2 Events- Conditions- Integer Var = to less than 0 Actions- Set Integer Var to (Integer Var - 1) Choose Random Barracks and set Barracks (Number of Integer Var) = to Chosen Barracks Ok I wrote this up real fast, I'm not that skilled of a triggerer just wondering if this (or something like it) would work in replacement on manually setting variables. |
| 06-29-2007, 02:39 AM | #2 |
On the 2nd integer of a loop (from 1 to ___) you need to set the value to "math - get random integer". |
| 06-29-2007, 03:11 AM | #3 |
It would truly be random. If you want to shuffle, I have code for that in DARY, or look up Fisher Yates and JASS it yourself. |
| 06-29-2007, 05:53 AM | #4 | |
@pipe Ouch, I dont know jass. So...do you have any suggestions on how to go about this or do I have to do it for each trigger? @cliche Quote:
|
| 06-29-2007, 10:41 AM | #5 |
Am I correct in assuming that you want it to go from 1-134, but in a random order? If so, this thread may be of use to you. |
| 06-29-2007, 06:43 PM | #6 |
My goal here is to assign one variable, no matter what number it is, to each and every barracks, tower, and region. Now there is 132 of each of these. Each barracks, tower, and region are very close to each other, and work together to create a system that isnt important for what we're discussing right now. While it doesnt matter what variable number each barracks/tower/region group are assigned, it does matter that they are all assigned the same number. By this I mean: Barracks A is assigned the number 1. For the system in mind I need Tower A and Region A to also be assigned the Number 1. If Barracks A was assigned the array number 121 it wouldnt matter, as long as Tower A and Region A are also assigned number 121. |
| 06-30-2007, 12:51 AM | #7 |
So you have no need for randomness? Why aren't you just counting? |
| 06-30-2007, 04:09 AM | #8 |
Well, I guess I don't need the randomness is there is another way to assign variables in the way mentioned above through triggers. Is this possible through jass or shouuld I just start those 390 variables? |
