I am trying to generate some type of table of variable size (each row signifies a unit on the field- let's say 3 for this example). Periodically throughout the game, I want to update, reference, and (optionally) resize the table (in case of unit death, for instance). I'm not sure if a table is what it's called in the editor- I found variables, which I could form into arrays, but it seemed very clunky to manipulate and use the fields in them.
Any recommendations or tips on use? I was hoping to find something like "cooltable(2,4) == 3", which would set the 2nd row, 4th column field to a value of 3, for instance.
- Unit Group is a list with units. Sadly we can only add new units to its end, so you would need to code other operations like adding at position 2 yourself.
Units have custom value 0 to 63 to store real values within them. Custom values are only accessible via triggers.
Dead units are removed out of this list, when their death time (unit data, how long a unit is kept in memory after death) runs out.
- Arrays have a static size. So, you would need to define it with the max size you require. They can only store one data type, but you can just add multiple arrays.
you are looking for a vector of arrays but im not sure thqt exists in the editor a vector can change size dynamically but what i have found in the editor if you want to use a table like structure your best bet would be cooltable(99)(99). referencing that table in a double for loop ex.
To elaborate on this part of my project, I was hoping to create a turn-based battle system. Each row in the array would represent a unit in play, for instance. I was going to give each unit a "speed", among a few other variables specific to each unit which would be used to eventually determine which unit goes in what order. The triggers would be constantly be calling, updating, and checking this array of values to determine unit order.
This way, I can keep track of all of the variables that I want (by simply adding more columns representing them), and the game only has to do some background calculations on a matrix as opposed to updating/checking custom unit properties for all units in play at the time.
I think the global variable is what I'll have to generate. I've played with it a little bit, and it seems to be the most straightforward way to get what I need done. If you have any additional suggestions, given more context, that would be great.
Hey there,
I am trying to generate some type of table of variable size (each row signifies a unit on the field- let's say 3 for this example). Periodically throughout the game, I want to update, reference, and (optionally) resize the table (in case of unit death, for instance). I'm not sure if a table is what it's called in the editor- I found variables, which I could form into arrays, but it seemed very clunky to manipulate and use the fields in them.
Any recommendations or tips on use? I was hoping to find something like "cooltable(2,4) == 3", which would set the 2nd row, 4th column field to a value of 3, for instance.
- Unit Group is a list with units. Sadly we can only add new units to its end, so you would need to code other operations like adding at position 2 yourself.
Units have custom value 0 to 63 to store real values within them. Custom values are only accessible via triggers.
Dead units are removed out of this list, when their death time (unit data, how long a unit is kept in memory after death) runs out.
- Arrays have a static size. So, you would need to define it with the max size you require. They can only store one data type, but you can just add multiple arrays.
- Global Data Table can store values with a key. So, you would use a string key like "a2-2" to store 3. Every key needs to be unique, else you overwrite entries.Here are some limitations and knowledge about the data table.
- Then there is something with user data, but I've never used it. Maybe someone else can describe them.
So...: What do you want to save? How much do you need to save at max?
@En7ropi: Go
you are looking for a vector of arrays but im not sure thqt exists in the editor a vector can change size dynamically but what i have found in the editor if you want to use a table like structure your best bet would be cooltable(99)(99). referencing that table in a double for loop ex.
Thank you for the reply.
To elaborate on this part of my project, I was hoping to create a turn-based battle system. Each row in the array would represent a unit in play, for instance. I was going to give each unit a "speed", among a few other variables specific to each unit which would be used to eventually determine which unit goes in what order. The triggers would be constantly be calling, updating, and checking this array of values to determine unit order.
This way, I can keep track of all of the variables that I want (by simply adding more columns representing them), and the game only has to do some background calculations on a matrix as opposed to updating/checking custom unit properties for all units in play at the time.
I think the global variable is what I'll have to generate. I've played with it a little bit, and it seems to be the most straightforward way to get what I need done. If you have any additional suggestions, given more context, that would be great.
Use records, then you can fill the record with all the variables you need.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)