Hey there,
is there a way to create additional variables for units in the data editor? For example to store a string or number which can be set/get later with the trigger editor. I don't think I have to create global variables for each unit of that type I create to achieve that?
Actors have these tokens, there I could create additional tokens, but I don't think that that's their purpose?
Thanks!
Hmmm. With "Set Unit Property" I can set a few variables of that unit, but by far not all. How can I add properties to a unit? E.g. if I want to make a capturable tower and want to store the current "owner" player of that tower, how should I do this without global variables?
Edit: Okay, "Unit - Set Custom Value" goes in the right direction. But you can only set values of type real, which is quite stupid. And you have to set them all manually with the trigger editor instead of giving the unit itself a default value in the data editor - but that's not too big a problem.
So, any way to set a unit's custom value to sth. like a string or another type?
A Timer for example. ;) How exactly does the buff stuff work anyway? Create a new buff, store my int in "maximum stackcount" (or where?) and get it with "Stack count of behaviour on unit"? And how to change that value in the trigger editor?
Okay, I would have hoped for a better way, but I think that's acceptable. So custom values are the way to go. I just hate that I have to memorize which index stores what value in the unit...
Okay, I would have hoped for a better way, but I think that's
acceptable. So custom values are the way to go. I just hate that I have
to memorize which index stores what value in the unit...
You don't. A popular method to use custom values in wc3 was to assign a unique id to the unit, and then use that value as an index to a global variable array. In other words there should only be one index number on a unit, and that number would be used to get values from any array.
I'm not sure I get it, sorry (maybe because it's late.. :P). You mean I have to set the unit's custom value 0 to a unique id, then create an array of the type I need and store the unit's variable of that type in the array at the "unique id" position?
I'm not sure I get it, sorry (maybe because it's late.. :P). You mean I
have to set the unit's custom value 0 to a unique id, then create an
array of the type I need and store the unit's variable of that type in
the array at the "unique id" position?
Hey there, is there a way to create additional variables for units in the data editor? For example to store a string or number which can be set/get later with the trigger editor. I don't think I have to create global variables for each unit of that type I create to achieve that? Actors have these tokens, there I could create additional tokens, but I don't think that that's their purpose? Thanks!
Hmmm. With "Set Unit Property" I can set a few variables of that unit, but by far not all. How can I add properties to a unit? E.g. if I want to make a capturable tower and want to store the current "owner" player of that tower, how should I do this without global variables?
Edit: Okay, "Unit - Set Custom Value" goes in the right direction. But you can only set values of type real, which is quite stupid. And you have to set them all manually with the trigger editor instead of giving the unit itself a default value in the data editor - but that's not too big a problem.
So, any way to set a unit's custom value to sth. like a string or another type?
you can store integers in a unit by having a buff behavior and using the stack count as the integer. thats all i got.
Well thanks, that would be another way to store integers in a unit, but is there really no more comfortable solution (for other data types)?
can you give an example of something other than an integer that you'd want to store on a unit?
A Timer for example. ;) How exactly does the buff stuff work anyway? Create a new buff, store my int in "maximum stackcount" (or where?) and get it with "Stack count of behaviour on unit"? And how to change that value in the trigger editor?
@anteevy: Go
Create an array of timers (or whatever else), then use a custom value to store an index into the array.
e: Also you can freely convert ints to reals and back again.
Okay, I would have hoped for a better way, but I think that's acceptable. So custom values are the way to go. I just hate that I have to memorize which index stores what value in the unit...
You don't. A popular method to use custom values in wc3 was to assign a unique id to the unit, and then use that value as an index to a global variable array. In other words there should only be one index number on a unit, and that number would be used to get values from any array.
I'm not sure I get it, sorry (maybe because it's late.. :P). You mean I have to set the unit's custom value 0 to a unique id, then create an array of the type I need and store the unit's variable of that type in the array at the "unique id" position?
Yes.
Okay. I think these libs are basically doing the same thing: http://starcraft-mapping.de/forum/trigger-entwicklungsforum-f55/unit-indexing-t749.html http://www.thehelper.net/forums/showthread.php?t=151444
Works for me, thanks. :)