Hi, I'm making a tower defense map using OneTwo's td tutorial. In the tutorial, it spawns waves with a timer. It determines which wave to spawn with a variable. However, it will only spawn one wave at a time.
For instance, if I have two options for a zergling and roach to spawn on wave one, then only the zergling will spawn. I have no idea how I'd go about having both spawn at the same time. I assume it has something to do with triggers which I'm mostly braindead about. Any help will be appreciated! If you need more clarification, just let me know.
The idea is instead of only 1 spawn type and quantity per wave, you have multiple (possibly even an array of them).
I would create a data element (a struct in pure Galaxy) with two member variables. The unit type to spawn (string in pure Galaxy) and the integer number to spawn (int in pure Galaxy). For spawning over a period of time you can either use a separate member to keep track of how many left or you can decrement the number of spawns until it is 0 (wave complete).
You then create another data element which represents a wave in its entirety. This is composed an array of spawn data structures (which you created as described above) with a size equal to the maximum number of spawns for a wave. You can also add wave specific information here later such as text references to hints etc.
You then make an array of wave data structures the size of the number of waves you want in your map. This becomes the main data structure for your spawn system and it is all in one place to. At map initialization feed all your data into it as described above. I would recommend using a null unit type for spawns that do not exist (since the array will allocate space for them). I would also recommend using some form of counter variables instead of static indexes for the arrays since that means that moving, removing or inserting waves is super easy (as the indexes will change) as opposed to static indexes which will mean you need to update possibly every single index (ouch).
When spawning the actual units you iterate through all the spawns for the current wave. If they are not a null unit type then you work on spawning the number mentioned at all spawn points.
The advantage of doing it like this is that your spawn system is entirely data fed and only needs 2-3 triggers odd. If you want to change the order waves occur in, the numbers, the types etc it is as simple as modifying what you put into the initialization trigger.
If you are struggling to understand the above then submit your map and I will see if I can implement it in it for you. I would use comments to explain what each part of the code is doing.
Yeah, sorry, I really don't understand what you're saying. I'm an idiot when it comes to the triggers. I don't really know how to submit my map either... >.< I'll try to figure out what you said. I kinda understand the main idea, but I don't know what you mean by a struct in pure galaxy and the others that are similar to that. Or what an array is... >.< Thanks for the help though!
Edit: I actually attached the map...I hope that's what you meant by upload.
It should support all the required features and possibly more. It is completely data fed so adding new waves or modifying existing ones is easy. Do remember to modify the array constant sizes as they declare both how much storage is available for waves and also how many iterations loops are run.
I am not sure it is completely bug free, hopefully you can fix any minor issues you have with it.
Hi, I'm making a tower defense map using OneTwo's td tutorial. In the tutorial, it spawns waves with a timer. It determines which wave to spawn with a variable. However, it will only spawn one wave at a time.
For instance, if I have two options for a zergling and roach to spawn on wave one, then only the zergling will spawn. I have no idea how I'd go about having both spawn at the same time. I assume it has something to do with triggers which I'm mostly braindead about. Any help will be appreciated! If you need more clarification, just let me know.
The idea is instead of only 1 spawn type and quantity per wave, you have multiple (possibly even an array of them).
I would create a data element (a struct in pure Galaxy) with two member variables. The unit type to spawn (string in pure Galaxy) and the integer number to spawn (int in pure Galaxy). For spawning over a period of time you can either use a separate member to keep track of how many left or you can decrement the number of spawns until it is 0 (wave complete).
You then create another data element which represents a wave in its entirety. This is composed an array of spawn data structures (which you created as described above) with a size equal to the maximum number of spawns for a wave. You can also add wave specific information here later such as text references to hints etc.
You then make an array of wave data structures the size of the number of waves you want in your map. This becomes the main data structure for your spawn system and it is all in one place to. At map initialization feed all your data into it as described above. I would recommend using a null unit type for spawns that do not exist (since the array will allocate space for them). I would also recommend using some form of counter variables instead of static indexes for the arrays since that means that moving, removing or inserting waves is super easy (as the indexes will change) as opposed to static indexes which will mean you need to update possibly every single index (ouch).
When spawning the actual units you iterate through all the spawns for the current wave. If they are not a null unit type then you work on spawning the number mentioned at all spawn points.
The advantage of doing it like this is that your spawn system is entirely data fed and only needs 2-3 triggers odd. If you want to change the order waves occur in, the numbers, the types etc it is as simple as modifying what you put into the initialization trigger.
If you are struggling to understand the above then submit your map and I will see if I can implement it in it for you. I would use comments to explain what each part of the code is doing.
@ImperialGood: Go
Yeah, sorry, I really don't understand what you're saying. I'm an idiot when it comes to the triggers. I don't really know how to submit my map either... >.< I'll try to figure out what you said. I kinda understand the main idea, but I don't know what you mean by a struct in pure galaxy and the others that are similar to that. Or what an array is... >.< Thanks for the help though!
Edit: I actually attached the map...I hope that's what you meant by upload.
Here you go.
It should support all the required features and possibly more. It is completely data fed so adding new waves or modifying existing ones is easy. Do remember to modify the array constant sizes as they declare both how much storage is available for waves and also how many iterations loops are run.
I am not sure it is completely bug free, hopefully you can fix any minor issues you have with it.
@ImperialGood: Go
Awesome man! I'll try it out now. You have no idea how thankful I am for this! Thank you so much!