| 07-18-2009, 09:39 PM | #2 |
Pick a random number between 0 and X, where X is the number of hero types (minus one). Then, get Random_heroA[random number], and set Random_heroA[same number as before] to Random_heroA[X]. Then subtract one from X. |
| 07-18-2009, 10:01 PM | #3 |
Trigger: Actions
![]() Set HeroLight = (Random integer number between 1 and HeroTotalLight)
![]() Set Random_heroA[HeroLight] = Random_heroA[HeroTotalLight]
![]() Set HeroTotalLight = (HeroTotalLight - 1)
![]() Unit - Create 1 Random_heroA[HeroLight] for (Triggering player) at (Center of Base Spawn Light <gen>) facing Default building facing degreesYou're currently setting Random_heroA[HeroLight] to the last unit in the array, and then giving that unit to the triggering player. Clean up the array after you create the hero: Trigger: Actions
![]() Set HeroLight = (Random integer number between 1 and HeroTotalLight)
![]() Unit - Create 1 Random_heroA[HeroLight] for (Triggering player) at (Center of Base Spawn Light <gen>) facing Default building facing degrees
![]() Set Random_heroA[HeroLight] = Random_heroA[HeroTotalLight]
![]() Set HeroTotalLight = (HeroTotalLight - 1) |
| 07-19-2009, 10:27 AM | #4 |
You could also use unitpools. Pyrogasm has made a proper tutorial about it a while ago. http://www.wc3c.net/showthread.php?t=97706 |
| 07-21-2009, 02:26 AM | #5 |
Aha! Here I was about to link to my unitpools tutorial, and you've already done it. Another thing that might be the issue is that you have "Fixed random seed" on. Go to your editor preferences and uncheck that box, then try. |
