| 09-19-2014, 10:55 PM | #2 |
I am guessing that you are using dialogue buttons 1-4 for race selection, 5-16 for stat selection for each race, and the rest for hero selection. In that case, your problem is that in your loop, you are checking again for buttons 1-4 instead of buttons 17-64. |
| 09-20-2014, 09:11 AM | #3 |
Alright. I'll give that a try when I am back at home and can work on it. Also, if that is the case here, then I will have to redo the button integers. I currently have them set so that humanoid is 1, then 5 - 19, undead is 2, then 20 - 34, and so on for the other 2. From what I am gathering from your solution, I need to streamline the buttons so that the hero buttons at the end are all in consecutive order. I'll get right on that when I can. Thanks! |
| 09-20-2014, 10:56 AM | #4 | |
Quote:
In fact, I would use separate arrays for race, stat and hero buttons, although functionally there is nothing wrong with consolidating them all into one array like you did. Furthermore, you could generalise your code even more. You already did it with heroes, using a loop and a unit type array instead of a separate if statement for each hero. You could use a similar solution for races and stats. Again, what you have now can work but there's more to good code than just working correctly. I don't think you need a separate stat menu for each race. Since the stats are the same for all races, you could also use a single menu for all of them. |
| 09-23-2014, 05:42 AM | #6 |
Yeah, I'll need to see the triggers in which you set up your button and hero arrays, I can't find the error looking just at this code. You could also add some debug messages to your loop to see where it is going wrong (does it even run? if it does, does it ever get to the then-actions of the if statement?). I see you already have one game message after the hero is supposed to spawn, does that game message show up? By the way, why are you changing the title of a menu after a player presses a button on it? Also, there is an action for displaying a text to a single player, you don't need to do it to a player group. Right now, you are creating a new player group every time you display a text message. Of course, that's such a small memory leak that it doesn't really matter, but if you're going to be using triggers a lot it might become important later, so I'm mentioning it now. Usually, the problem aren't player groups, but unit groups and locations. For example, you are also creating a location when you create the hero (the "center of region" creates a new location every time it is used). |
| 09-24-2014, 12:19 AM | #8 |
Ah, I finally noticed the error in the original trigger, in all your if statements except the first one, you put "skip remaining actions" under the "else - actions". When storing hero types to the array, you should store them under an index that matches the index of their menu button, so for example Palladin should be stored under 17, not 1. Right now, once you fix the bug that's stopping the hero from spawning at all, you will still get the wrong hero. |
| 09-24-2014, 01:18 PM | #9 |
SUCCESS! Thank you so much for all the help, Anitarf! After an initial test with the skip remaining actions taken out, and units were spawning correctly, I went ahead and changed all of the hero array integers to their appropriate values, and the correct units are now spawning. Thanks again for all the help (remembers to put in credit in map) |
