Hello,
I am trying to make a script for shared variables.
However, I am wondering what the best way to add UIDs to a list variable ("Supported") is, when I want to specify them at runtime.
The problem is essentially one of UID location: How do I find the UIDs that I want? And therefore, where should they be added from?
Currently, I am after Emitters and other opposing units, but both custom units and player units should work equally well.
I would prefer to find the UIDs from within the script, or a "Loader" script, but am open to having external CRPL supply them. (If it can find this script.)
I hope that made sense to people who haven't just designed this, and not merely to me.
Postscript: How does the GetEnemyUnitsInRange / GetUnitsInRange interact with the CONST_COUNTSFORVICTORY?
Postpostscript: Should I be using GetCoresWithVar? Should this be combined with an ID-ish variable that I customise?
Response to your post-postscript:
Yes.
Overall response:
I've learned to avoid unit lists unless I can really keep the list short. This is because lists, iterating through lists, and creating lists can easily expand into a nested-loop lagpocolypse.
If you have a core that moderates most of your custom units that runs every couple of milliseconds however, this shouldn't worry you until the number of units moderated exceeds about four.
Wish I could stay and talk but my exoskeleton is about to come off.
Until then!
-GameGibu
I think I'll be safe. The list is essentially to allow external appending.
The script has all of two loops in it, not nested, which are for a simple averaging function.
The only reason for the loops rather than a fixed arrangement is to allow either changes in the number of managed variables, or to attach to a factory.
Essentially:
Start
Loop to get information
Process aggregate data
Loop to set information
End
Thanks very much for your help. I thought this might be it, but wasn't sure if there was a better way.
Until next time.
As a note to anyone else trying something like this: Beware.
UID CONST_HEALTH <negative number> SetUnitAttribute
You might think that this will destroy the unit. It will not.
Subsequent testing reveals that CONST_DESTROYONDAMAGE will not cause this to work either.
The proper call is Damage. I put this here for others who make the mistake I did.