Jump to content

Recommended Posts

I have 10 units. Their variable names are: s1, s2, s3, s4, s5, s6, s7, s8, s9, s10.
I want to make all of them be in just one name. How do I set this variable?

Share this post


Link to post
Share on other sites

Place them in an array:

za0_units = [s1,s2,s3,s4,s5,s6,s7,s8,s9,s10];

or group them in the editor and name the group.

Edited by Harzach
fixed array elements
  • Like 1

Share this post


Link to post
Share on other sites
14 hours ago, Harzach said:

Place them in an array:


za0_units = ["s1","s2","s3","s4","s5","s6","s7","s8","s9","s10"];

or group them in the editor and name the group.

Please correct me if I am wrong but I believe that quotation marks can be omitted. I mean that you can actually create an array to hold the actual objects and not their names as strings. Of course, what is "best" depends on the intended behavior.

  • Thanks 1

Share this post


Link to post
Share on other sites
5 minutes ago, ZaellixA said:

Please correct me if I am wrong but I believe that quotation marks can be omitted.

 

Yes, I'd guess that Harzach just had a brain fart moment 🙂 But obviously, without the quotes each index refers to the unit itself.

  • Haha 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×