carbonduck
New Member
- Reaction score
- 4
http://world-editor-tutorials.thehelper.net/herotavern.php
My -random command is exactly the same as the one given in that tutorial. The tutorial claims that with this command, the same hero will not be randomed more than once. Well... that's not true. It's possible to random the same hero more than once and I'm not really sure how to fix it.
I've been working at this for a couple days and nothing is working. Through some debugging, it seems that the bug (randoming a hero who has already been randomed) becomes a possibility when a hero at the end of the array has been randomed.
Any help? :banghead:
My -random command is exactly the same as the one given in that tutorial. The tutorial claims that with this command, the same hero will not be randomed more than once. Well... that's not true. It's possible to random the same hero more than once and I'm not really sure how to fix it.
I've been working at this for a couple days and nothing is working. Through some debugging, it seems that the bug (randoming a hero who has already been randomed) becomes a possibility when a hero at the end of the array has been randomed.
Any help? :banghead:
Trigger:
- Actions
- Set HS_RandomHero = (Random integer number between 1 and HS_RandomCount)
- Unit - Create 1 HS_HeroArray[HS_RandomData[HS_RandomHero]] for (Triggering player) at (Center of MapSelection) facing Default building facing degrees
- Set SelectedHeroArray[(Player number of (Triggering player))] = (Last created unit)
- Player Group - Pick every player in Players and do (Actions)
- Loop - Actions
- Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Picked player)
- Loop - Actions
- Selection - Select (Last created unit) for (Triggering player)
- Set HS_RandomData[HS_RandomHero] = HS_RandomCount
- Set HS_RandomCount = (HS_RandomCount - 1)