I've been looking through SC2's vast array of natives for a way I can accomplish something like retrieving and assigning a string value from a unit.
I'm sure there's a way to do this (albeit inefficiently), but I'm wondering if anyone has any better ideas than making giant arrays and iterating through them to find the matching unit and it's associated string in a parallel array. (Or I could use a struct, but same looping effect).
Yes, it looks extremely promising but I'd need a way to associate a unit directly to it's key value in the bank. This would be easy if the units had a nice function to get something like a GUID but I can't find anything like that.
Ok it's not perfect but I've managed to think of a solution. I'll document it here in case anyone ever has a problem like this again.
I'll be creating my own GUID counter, starting at 1, and using UnitSetCustomValue to set index 0 to it's GUID. I'll then use the bank system to load a key that's derived from the GUID, which should return a string.
And that should get around my ugly problem of needless looping. :)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I've been looking through SC2's vast array of natives for a way I can accomplish something like retrieving and assigning a string value from a unit. I'm sure there's a way to do this (albeit inefficiently), but I'm wondering if anyone has any better ideas than making giant arrays and iterating through them to find the matching unit and it's associated string in a parallel array. (Or I could use a struct, but same looping effect).
Have you looked at the Bank functions?
Yes, it looks extremely promising but I'd need a way to associate a unit directly to it's key value in the bank. This would be easy if the units had a nice function to get something like a GUID but I can't find anything like that.
Ok it's not perfect but I've managed to think of a solution. I'll document it here in case anyone ever has a problem like this again.
I'll be creating my own GUID counter, starting at 1, and using UnitSetCustomValue to set index 0 to it's GUID. I'll then use the bank system to load a key that's derived from the GUID, which should return a string.
And that should get around my ugly problem of needless looping. :)