| 05-19-2006, 05:54 AM | #1 |
In my map, I want to make some random creep's group attack enemy hero. -----for exp : CreepGroup[1] = footman ,CreepGroup[2] = grunt .... I try to create Unit in "Creepgroup[random integer number 1-> 5]" When start the game !!! It's Alway take number [1] (mean : CreeoGroup[1]) = footman to attack enemy Hero How can I make randomize number ??? |
| 05-19-2006, 07:14 AM | #2 |
Make an Interger Variable Code:
Set IntergerVariable = Random Number between 1 and 5 Pick every unit in CreepGroup[IntergerVariable] and do X There you go. |
| 05-19-2006, 07:22 AM | #3 |
You need to disable "fixed random seed" when using the "test map" feature. File->Preferences->Test Map |
| 05-19-2006, 09:18 AM | #4 |
oh, I will try this Hope it will work Anyway, Thanks ! |
| 05-20-2006, 03:52 PM | #5 |
This is also because on computers, there is no such thing as random. A computer does what you tell it to do. Worldeditor/Wc3 has a system where it makes it seem as it gets a random integer, but it dosent, it gets it from somewhere else, if everything is the same, such as player names, number of players etc, the games "random" things will be identical. Unless blizz are smart enough to detect computer radiation of a pixle of the screen, which i doubt. To be honest, you would need a great mathmatic sequence to get a close to random thing. Regards, tide... |
| 05-20-2006, 10:42 PM | #6 | |
Quote:
HAHA. Statistics 215 FTW |
| 05-21-2006, 03:41 AM | #7 |
This is only the case in Test Map through World Edit right? |
| 05-21-2006, 04:33 AM | #8 | |
Quote:
First of all, the game uses a random number generator, which simply uses that math to generate a bunch of different numbers based on a seed. which is to be called the random seed. Math will make it so that the results are really different depending on the seed. Test map when the fixed random seed is on causes world edit to add a call to SetRandomSeed(1) to the map's script and that's the cause that things aren't random As long as you don't call SetRandomSeed , the seed used will be based on the cpu's clock and that is quite hard to predict / recognize This method is the one used by most of the programs in the world and it does not matter if they are not real random numbers, they are pretty umpredictable still (we are not making some sort of ultimate experiment whose results might affect our life style, we are just playing a game) In other words there are no relationship at all between XXXX thing and the results of the random number generator they depend only on the seed which normally only depends on the cpu clock value when the map started. Unless someone or something added a call to SetRandomSeed |
