| 06-19-2009, 12:17 PM | #1 |
Hello again.. I made -ar mode in my game that gives random heroes to all players.To do this, i used the method below.(I am using GUI Triggers.) I have created an unit array named RANDOM_HERO_ARRAY, and filled it with heroes in map init. event. Example: RANDOM_HERO_ARRAY[0]=Paladin RANDOM_HERO_ARRAY[1]=Archmage ... And when the host writes -ar as a chat message. 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 Player - Set (Picked player) Current gold to 0 Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 0 and HERO_COUNT)] for (Picked player) at ((Picked player) start location) facing Default building facing degrees Selection - Select (Last created unit) for (Picked player) Camera - Pan camera for (Picked player) to ((Picked player) start location) over 0.00 seconds Wait 1.00 seconds Else - Actions ( HERO_COUNT is Array's Ubound, there is no problems about this.. ) And I have two problems with this script: 1) It causes terrible lag.In Dota -ar doesnt cause brutal lag like this..Even if I set wait to 3 seconds, it causes terrible lag.. 2) This is the real issue..When I use this script, there is no limit of same heroes randomed.I want a hero to be selectable only one time.So all players get unique heroes. What can I do? Need help of some experienced devs :\ |
| 06-19-2009, 12:33 PM | #2 |
try preplacing every hero in the map for neutral player, and remove those heros on map start ... could help, dunno |
| 06-19-2009, 12:35 PM | #3 |
didn't really understand :S |
| 06-19-2009, 01:12 PM | #4 |
Do a trigger that runs at map init which Create and destroy each hero in your map for a neutral player. This will solve something called first time lag. |
| 06-21-2009, 05:24 PM | #5 |
Doesn't it tell you to not use waits within pick players block? |
| 06-22-2009, 08:56 PM | #6 |
On the note of your hero multiplicity, run a check inside of it to make sure there is not a hero of the chosen type on the map already, and if so, have it random another. |
