Hello again, I'm almost finishing the beta version of my simple hero arena and some problems appeared when I created the All Random mode and the Random command:
1st - The trigger has the chance to create two or more times the same hero.
2nd - The trigger has a small chance not to create a hero.
3rd - Lag issues with -ar (all random) command.
Here is the code:
1st - The trigger has the chance to create two or more times the same hero.
2nd - The trigger has a small chance not to create a hero.
3rd - Lag issues with -ar (all random) command.
Here is the code:
-
Random
-
Events
- Player - Player 1 (Red) types a chat message containing -random as An exact match
- Player - Player 2 (Blue) types a chat message containing -random as An exact match
- Player - Player 3 (Teal) types a chat message containing -random as An exact match
- Player - Player 4 (Purple) types a chat message containing -random as An exact match
- Player - Player 5 (Yellow) types a chat message containing -random as An exact match
- Player - Player 6 (Orange) types a chat message containing -random as An exact match
- Player - Player 7 (Green) types a chat message containing -random as An exact match
- Player - Player 8 (Pink) types a chat message containing -random as An exact match
- Player - Player 9 (Gray) types a chat message containing -random as An exact match
- Player - Player 10 (Light Blue) types a chat message containing -random as An exact match
- Player - Player 11 (Dark Green) types a chat message containing -random as An exact match
- Player - Player 12 (Brown) types a chat message containing -random as An exact match
-
Conditions
- (Number of units in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))) Equal to 0
-
Actions
- Set Random_Hero = (Random integer number between 1 and Random_count)
- Set TempInt = (Player number of (Triggering player))
- Set Rd_Spawn = Reg_Spawn[TempInt]
- Unit - Create 1 Hero_Array[Random_data[Random_Hero]] for (Triggering player) at (Center of Academia <gen>) facing Default building facing degrees
- Game - Display to (All players) for 8.00 seconds the text: ((Name of (Triggering player)) + ( has randomed |CFFFFCC00 + (Name of (Last created unit))))
- Player - Set name of (Triggering player) to ((Name of (Triggering player)) + (( + (Color_Array[TempInt] + ()) + ((Name of (Last created unit)) + )|r)))
- Unit - Move (Last created unit) instantly to (Center of Rd_Spawn)
- Camera - Pan camera for (Triggering player) to (Position of (Last created unit)) over 1.00 seconds
- Selection - Select (Last created unit) for (Triggering player)
- Hero - Create Health Potion and give it to (Last created unit)
- Hero - Create Mana Potion and give it to (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
-
All Random
-
Events
- Player - Player 1 (Red) types a chat message containing -ar as An exact match
- Conditions
-
Actions
- Trigger - Turn off Timer 1 <gen>
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked player) slot status) Equal to Is playing
-
Then - Actions
- Set Random_Hero = (Random integer number between 1 and Random_count)
- Set TempInt = (Player number of (Picked player))
- Set Rd_Spawn = Reg_Spawn[TempInt]
- Unit - Create 1 Hero_Array[Random_data[Random_Hero]] for (Picked player) at (Center of Academia <gen>) facing Default building facing degrees
- Game - Display to (All players) for 8.00 seconds the text: ((Name of (Picked player)) + ( has randomed |CFFFFCC00 + (Name of (Last created unit))))
- Player - Set name of (Picked player) to ((Name of (Picked player)) + (( + (Color_Array[TempInt] + ()) + ((Name of (Last created unit)) + )|r)))
- Unit - Move (Last created unit) instantly to (Center of Rd_Spawn)
- Camera - Pan camera for (Picked player) to (Position of (Last created unit)) over 1.00 seconds
- Selection - Select (Last created unit) for (Picked player)
- Hero - Create Health Potion and give it to (Last created unit)
- Hero - Create Mana Potion and give it to (Last created unit)
- Set Random_data[Random_Hero] = Random_count
- Set Random_count = (Random_count - 1)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Trigger - Turn off (This trigger)
-
Events