• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Variable initial values

Status
Not open for further replies.
Level 9
Joined
Nov 4, 2007
Messages
931
No unofortunately, I think the reason for this is that if arrays end up having multiple dimensions for you to set the initial value of each would cause major lag in the editor, because it would be displaying all possible initial values of each array in the variable, and considering it can go up to 4 dimensions. Short answer is no, it can be done for non-array variables by just setting the initial value in the variable itself, but for arrays it would require displaying all initial values for each array dimension.
 
Level 9
Joined
Nov 4, 2007
Messages
931
If your arrays have predictable initial values that follow an arithmetic formula, u can just loop it in a really big loop, otherwise yeah, only choice is a really big action definition in your Initializtion, or just all of them set in your initilization.
 
Level 5
Joined
Jul 10, 2010
Messages
124
no I am doing a baneling bowling map so each of the 20 "pin" locations (2 lanes) have point variables in a 2d array like

Pin[1,2][1,2...9,10]

And I am doing a lot of text variables for messages and dialogs and stuff, so if I decide to change them I just have to edit variables instead of all the triggers using the text (is this what a stringtable is?)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,223
I do not think they programed in an array initializer.

In java (and probably other C like languages) you can go...
int[] arrayvar = {0,1,2,3,4,5,6,7,8,9}
To initialize an array of a certain size with values. I do not think SC2 galaxy scrript supports that because of how arrays are not objects and must have a defined size of type although it should not make a difference (it would just need a smarter compiler to read the number of entries on the line).

Thus you will probably need to initialize all values after or during map init. The good news is that you can initialize them any time before they are needed. As such you should probably initialize them during various graphical effects (small numbers at a time) or just before they are needed (if there are few values needing to be initialized).
 
Status
Not open for further replies.
Top