There are 100 Units on the Map
Each of them is stored in a Unit Varible [1],.....to... Unit Varible [100]
Every Unit wants to have a Name over his Head
So i have 100 Text Variables again in [1] to [100]
+ I have 100 Textmarks again [1] to [100]
What i want is,
When Unit [33] dies, that Textmark [33] also get destroyed.
I have a UNIT DIE event, but i cannot figure out how to read or pull the Unit Variable number out of it so that i can destroy the related textmark :(
At the moment, every of those units get into the Unit variable[1-100] + i create a textmark at the same time which gets into the textmark variable[1-100].
So theoretical i know when unit 2 dies, textmark 2 needs to die too and so on. But how do the trigger know which of those units did die, or in other words,
how can the trigger give me the correct integer number of the just died unit?
What you mean with custom value? (The Unit variable -> [1-100] ?)
And what you mean with index?
you can set custom values of units, a value that is stored on the unit itself (filter trigger actions). so when assigning the variable unit[1] to a unit you also set the custom value 1 to 1. on the second unit you set custom value 1 to 2. and so on. in the death trigger you can access the custom value of the unit, and also have the right index for it now.
When you say text mark, do you mean text tag? Because there's an action called store text tag for unit. You can then recall it with a similar named function.
There proper way to do what you were originally looking for is to loop through the array checking if the trigger unit is the same in the array, which can then be passed onto the actions (ie use the integer the loop is at); there is no need ever to store the integer.
Hobbi, While a loop is the ... I guess easiest... way to do it; the custom value setting allows for much less processor work. Rather than looping through 100 units to find the proper one, if you set the custom value when the array is assigned to the unit, then you can recall on that custom value, rather than running a 1-100 loop.
The best practise to link any sort of data to units is to use a data table entry. The string identifier can be constructed using the units tag and converting it into a string. Datatables will allow you to link near infinite amounts of data to a unit, without the limit of 64 custom values and, even more important, potentionally without using any static array sizes.
I'm checking this method out, and I don't see where I can get the "units tag". What string function should I be using?
Edit: After doing some searching of the forums, I found the answer. The tag is an integer, so you need to use convert integer to string. Then use the function unit tag.
Hey Guys, its me again xD
Here is my problem i dont know how to solve:
There are 100 Units on the Map Each of them is stored in a Unit Varible [1],.....to... Unit Varible [100] Every Unit wants to have a Name over his Head
So i have 100 Text Variables again in [1] to [100] + I have 100 Textmarks again [1] to [100]
What i want is, When Unit [33] dies, that Textmark [33] also get destroyed.
I have a UNIT DIE event, but i cannot figure out how to read or pull the Unit Variable number out of it so that i can destroy the related textmark :(
Any Ideas? Thank you for your time!
@Iamaddicted: Go
on creation (of the units) set their custom value to the index.
@FunkyUserName: Go
Mmmmh i dont think that i did understand you.
At the moment, every of those units get into the Unit variable[1-100] + i create a textmark at the same time which gets into the textmark variable[1-100]. So theoretical i know when unit 2 dies, textmark 2 needs to die too and so on. But how do the trigger know which of those units did die, or in other words, how can the trigger give me the correct integer number of the just died unit?
What you mean with custom value? (The Unit variable -> [1-100] ?) And what you mean with index?
Thanks for your effort Funky ^^
@Iamaddicted: Go
you can set custom values of units, a value that is stored on the unit itself (filter trigger actions). so when assigning the variable unit[1] to a unit you also set the custom value 1 to 1. on the second unit you set custom value 1 to 2. and so on. in the death trigger you can access the custom value of the unit, and also have the right index for it now.
@FunkyUserName: Go
Aaaah ok i did set the custom value now so far so good. But i cant figure out how to access it now? :((
Thanks for your time :)
@FunkyUserName: Go
Aaaaaaaaaah ok found it!!! I was trying to find it while using an Integer instead of Real! :D
Thank you a lot :)
When you say text mark, do you mean text tag? Because there's an action called store text tag for unit. You can then recall it with a similar named function.
There proper way to do what you were originally looking for is to loop through the array checking if the trigger unit is the same in the array, which can then be passed onto the actions (ie use the integer the loop is at); there is no need ever to store the integer.
Hobbi, While a loop is the ... I guess easiest... way to do it; the custom value setting allows for much less processor work. Rather than looping through 100 units to find the proper one, if you set the custom value when the array is assigned to the unit, then you can recall on that custom value, rather than running a 1-100 loop.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
The best practise to link any sort of data to units is to use a data table entry. The string identifier can be constructed using the units tag and converting it into a string. Datatables will allow you to link near infinite amounts of data to a unit, without the limit of 64 custom values and, even more important, potentionally without using any static array sizes.
@Mille25: Go
I'm checking this method out, and I don't see where I can get the "units tag". What string function should I be using?
Edit: After doing some searching of the forums, I found the answer. The tag is an integer, so you need to use convert integer to string. Then use the function unit tag.
@MaskedImposter: Go
... :D