• 🏆 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!

How to change the array's number

Level 39
Joined
Feb 27, 2007
Messages
5,034
There are two possible things you could mean:
  1. The 'size' of an array is set to 1 and cannot be increased.
    • This doesn't matter. All indices of an array up to 16383 are able to be written to and read from despite the array size value.
    • Array sizing only affects how many indices of the the array are given the default value on map init (#'s 0 through (SIZE-1) are initialized).
    • Erroneously using a large size for non-primitive variable types may be considered a memory leak if those indices are never used or are overwritten before being properly cleaned.
  2. Some types of variables cannot have default values assigned to them when they are made into arrays.
    • Or you are confused that you can't assign different default values to different indices, which you can never do because that's not what "default value" means.
    • Mostly these are handle types.
You should also be aware that after converting a variable into an array, it will be necessary to go back through every trigger that uses that old non-array version and manually change every single instance of the variable to properly use some array index. GUI will not do this for you, and it will appear to be correct until you attempt to launch the map at which point it will crash when such at trigger is executed in-game or cause some sort of compiler error on-save.
 
Level 20
Joined
Feb 27, 2019
Messages
594
Its best to change variable size within the variable editor. Doing it in the trigger editor will disable all uses of the variables within triggers and also doesnt work intuitively since one has to reselect the variable type after changing size, and even after doing that, selecting another variable directly after will mess that one up too.
 
Last edited:
Top