- Joined
- Feb 4, 2007
- Messages
- 389
In this tutorial I'm going explain many of the methods for hero selection.
~ Tutorial approved.
Last edited by a moderator:
In this tutorial I'm going explain many of the methods for hero selection.
At first glance this tutorial seems helpful, powerful and useful.
As its further development continues, I'm sure that this will become an even more informative document.
A suggestion for a system is a selection preview system like Hero's Hero Selection System . Im not saying copy it but learn from it..
Looks good so far, but you can easily make some optimizations to the code in some spots. The only major one I see is the trigger to pick the heroes using the first method. You go through each type of unit, and then create the location, the unit, and then remove the location. This makes the code much larger than it has to be. Simply create the location at the beginning of the trigger and destroy it at the end. All you'll have to do after each if/then action is just create the hero. This will also improve the readability of the code.
Also, something tells me that the first method could be improved more if you only used 1 ability to pick a hero. First off, you'd keep track of the current hero being looked at by a player. Then when the "pick hero" ability is cast, you would create a unit with type of the currently being looked-at hero. This would eliminate much more coding and will make it easier to add more heroes.
Now for your method of moving between heroes. You're doing that if/then thing again which makes the code look very ugly. I would suggest using an array of either rects or just the available units to be selected as I mentioned above. The player would start off looking at rect[0] or unit[0], when the next button was hit, the player would then be looking at rect/unit[current+1]. You would of course have to add more code to the initializing trigger, but the rest of the code wouldn't need to be updated after that. Additionally, a variable would be needed to keep track of the maximum number of heroes as well.
Now for your next method of hero selecting. Once more, you're doing the ugly if/then thing. Variable arrays would come in handy once again. You would create each dialog and set it to an index in the array, and then use another array for the heroes. You would also, again, have another variable that would keep track of the maximum amount of heroes. When the dialog is clicked, you'll start a loop that will loop through all the indexes of the dialog, and if that's the correct dialog, it will create a unit of type heroes[index].
You still have a long way to go on this system, good luck.