Integer Arrays

rogers

You can change this now in User CP.
Reaction score
1
Is there any real benefit to using integer arrays versus creating a variable for each variable?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Well, that depends how you define "benefit".
You can access an element within an array with an ID, many consider that a benefit since that is the basis of making code MPI.

But there is no reasonable advantage when it comes to performance and memory usage.
 

Aniconic

I am the very model of a modern major general!
Reaction score
3
Integer datatype arrays or arrays in general?

If in general, then no, there is no memory benifit, but using arrays has a lot of time saving benefits. For example, you can save a hero unit in a unit array and have the element of the array reference a player index.

Such as Player_Hero(1) ect.

They are also useful for setting up stuff like dialogs and multiboards using loops.

Personally I love them, because they allow me to set up and execute multiple actions that are common for a grouping of data that I might want to also reference individually in other parts of the map. For example:

Trigger:
  • Revive Hero
    • Events
      • Time - Hero_Death_Timer[1] expires
      • Time - Hero_Death_Timer[2] expires
      • Time - Hero_Death_Timer[3] expires
      • Time - Hero_Death_Timer[4] expires
      • Time - Hero_Death_Timer[5] expires
      • Time - Hero_Death_Timer[6] expires
      • Time - Hero_Death_Timer[7] expires
      • Time - Hero_Death_Timer[8] expires
      • Time - Hero_Death_Timer[9] expires
      • Time - Hero_Death_Timer[10] expires
      • Time - Hero_Death_Timer[11] expires
      • Time - Hero_Death_Timer[12] expires
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: if GetExpiredTimer() == udg_Hero_Death_Timer[bj_forLoopAIndex] then
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Player((Integer A))) is in Red_Team) Equal to True
          • Then - Actions
            • Set Hero_Dead[(Integer A)] = False
            • Camera - Pan camera for (Player((Integer A))) to (Center of HeroRedSpawn <gen>) over 0.00 seconds
            • Hero - Instantly revive Player_Hero[(Integer A)] at (Center of HeroRedSpawn <gen>), Show revival graphics
          • Else - Actions
            • Set Hero_Dead[(Integer A)] = False
            • Camera - Pan camera for (Player((Integer A))) to (Center of HeroBlueSpawn <gen>) over 0.00 seconds
            • Hero - Instantly revive Player_Hero[(Integer A)] at (Center of HeroBlueSpawn <gen>), Show revival graphics
          • Custom script: endif
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top