Hi all, I've made a map that's sort of like Risk. There are Auto-Turrets in the center of 12 territories, and a timer that counts down. When the timer hits 0, it awards the owner of each territory with the territories default unit award. Some territories spawn 2 units, others spawn 1.
I have it all set up and working correctly by whenever a turret dies, it grabs it's custom value (which is set to it's original starting position on the map) and then creates a new turret for killing player at those coordinates, and then sets the new turret's custom values to match. Then, when the timer runs out, it checks the owner of each territory (through 12 different if/then) and gives the hard-coded unit award to the owner of the turret at the center of the region that the turret is in.
The issue I have with it is, while yes it works but, i feel it could be a lot more efficient.
Ideally I guess, it would be nice to have a Region Group somehow, so I can spawn a turret at Center of Picked Region instead of having to specify which region and which coordinates specifically.
Then it would be nice to have variables set, one for each territory, that contain an array of unit types and the quantity of each unit type that will be awarded for their corresponding territory.
Does that seem like a better solution? If so, I can't seem to figure out how to get that group effect with regions, so any help or ideas on the matter would be really helpful!
I've found that loading all "things" into arrays works well in the editor. The only thing is that since there are no good array functions you have to (1) Make sure your arrays are initialized to be AT LEAST large enough to hold your data and (2) Make sure you record the count of each array in an Integer variable so you can step from 1 to that value wherever you need to loop through an array.
First step is creating an Action that loads all the values into an array. This gets called when you fire up the map. Then you just interact with the array.
I also use arrays of Records a lot. It sounds like you want to have an array that holds your regions. This could be an array of Records and this Record would probably have things like txtRegionName, rRegion, intPlayerOwner, etc (I'm using a convention where prefixes refer to data type - hopefully this makes sense to you).
Whenever you're directly referencing an absolute value ('4'), a unit type ('Probe'), Region by name, etc it's probably best to load this into a simple variable at global level so you can change it later. When you have a series of items or data structures, use arrays and arrays of records.
Note on the Data Table: it sound absolutely horrible compared to "real hashes" in "real programming languages" and I would just avoid using it :)
Hi all, I've made a map that's sort of like Risk. There are Auto-Turrets in the center of 12 territories, and a timer that counts down. When the timer hits 0, it awards the owner of each territory with the territories default unit award. Some territories spawn 2 units, others spawn 1.
I have it all set up and working correctly by whenever a turret dies, it grabs it's custom value (which is set to it's original starting position on the map) and then creates a new turret for killing player at those coordinates, and then sets the new turret's custom values to match. Then, when the timer runs out, it checks the owner of each territory (through 12 different if/then) and gives the hard-coded unit award to the owner of the turret at the center of the region that the turret is in.
The issue I have with it is, while yes it works but, i feel it could be a lot more efficient.
Ideally I guess, it would be nice to have a Region Group somehow, so I can spawn a turret at Center of Picked Region instead of having to specify which region and which coordinates specifically.
Then it would be nice to have variables set, one for each territory, that contain an array of unit types and the quantity of each unit type that will be awarded for their corresponding territory.
Does that seem like a better solution? If so, I can't seem to figure out how to get that group effect with regions, so any help or ideas on the matter would be really helpful!
@playpong: Go
I've found that loading all "things" into arrays works well in the editor. The only thing is that since there are no good array functions you have to (1) Make sure your arrays are initialized to be AT LEAST large enough to hold your data and (2) Make sure you record the count of each array in an Integer variable so you can step from 1 to that value wherever you need to loop through an array.
First step is creating an Action that loads all the values into an array. This gets called when you fire up the map. Then you just interact with the array.
I also use arrays of Records a lot. It sounds like you want to have an array that holds your regions. This could be an array of Records and this Record would probably have things like txtRegionName, rRegion, intPlayerOwner, etc (I'm using a convention where prefixes refer to data type - hopefully this makes sense to you).
Whenever you're directly referencing an absolute value ('4'), a unit type ('Probe'), Region by name, etc it's probably best to load this into a simple variable at global level so you can change it later. When you have a series of items or data structures, use arrays and arrays of records.
Note on the Data Table: it sound absolutely horrible compared to "real hashes" in "real programming languages" and I would just avoid using it :)