• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Hero Selection Systems

Level 9
Joined
Jul 27, 2006
Messages
652
Nice

Looks really good... You could add arrow key scrolling for the "Next / Previous Hero Viewing" system for those who may want it...

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...
 
Level 11
Joined
Jul 12, 2005
Messages
764
Good one!
But, i saw separate toturials for these (exept the first and the last one) systems. Anyway it's a good idea to collect them! And, you wrote it really well, so good job!

Btw, i have already made the last (click-on-the-hero-to-see-details and click-again-to-select :) ) type. However, it's in jass :p, and i don't think it will fit this tut.
 
Level 11
Joined
Oct 13, 2005
Messages
233
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.
 
Level 8
Joined
Feb 4, 2007
Messages
389
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..

Thanks for the suggestion, I'll try to add that in.

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.

I'm aware of all these methods, and I have attempted each and every one of them. They do not work. If you would like, I could go through, list all the problems for each one, but I'd rather not.
The Next / Previous Selection was very difficult because all the methods you suggested, I thought of, and didn't work. This was the fifth remake of this system, and the first one to work.

I'm not going to worry about small things like where I placed the location setting, or whether I used 'too many' If / Then / Else functions. In my opinion, they're possibly the most useful Gui functions available, along with Integer A. In all honesty, why would I sacrifice workability for readability?
 
Top