- Joined
- May 18, 2013
- Messages
- 9
Hi, I’m new to this but my main problem I am having is hero selection. I had made hero tavern to allow the player to pick their hero manually or random. The problem is, when a player picks a hero manually and then another player pick random, there still a chance to generate the same hero. Any help would be helpful
-
Hero Array
-
Events
- Map initialization
- Conditions
-
Actions
- -------- Set Array for Hero --------
- Set Total_Heroes = 3
- Set Random_Count = Total_Heroes
- Set Hero_Array[1] = Paladin
- Set Hero_Array[2] = Mountain King
- Set Hero_Array[3] = Archmage
-
For each (Integer A) from 1 to 3, do (Actions)
-
Loop - Actions
- Set Random_Data[(Integer A)] = (Integer A)
-
Loop - Actions
- Trigger - Turn off (This trigger)
-
Events
-
Manual Selection
-
Events
- Unit - A unit Sells a unit
-
Conditions
- ((Sold unit) is A Hero) Equal to True
-
Actions
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
- Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
-
Loop - Actions
- Game - Display to (All players) the text: (A player had chosen + (Name of (Sold unit)))
- Unit - Move (Sold unit) instantly to (Center of Hero Spawn <gen>)
- Set Random_Data[Random_Hero] = Random_Count
- Set Random_Count = (Random_Count - 1)
-
Player Group - Pick every player in (All players) and do (Actions)
-
Events
-
Random Selection
-
Events
- Unit - A unit Sells a unit
-
Conditions
- (Unit-type of (Sold unit)) Equal to Random Hero
-
Actions
- Set Random_Hero = (Random integer number between 1 and Random_Count)
- Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for (Owner of (Sold unit)) at (Center of Hero Spawn <gen>) facing Default building facing degrees
- Game - Display to (All players) the text: (A player had randomed + (Name of (Last created unit)))
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
- Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Picked player)
-
Loop - Actions
- Set Random_Data[Random_Hero] = Random_Count
- Set Random_Count = (Random_Count - 1)
-
Events