• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] What is the difference between array variable and non-array variable

Status
Not open for further replies.
Level 12
Joined
Aug 18, 2006
Messages
1,193
An array variable is an variable with an "internal number" inside itself. This makes its easier to access in some cases.
  • Events
    • Unit - A unit Is attacked
  • Conditions
  • Actions
    • Set Unit[1] = (Attacking unit)
    • Set Unit[2] = (Attacked unit)
    • Set Unit[3] = (Random unit in (Playable map area))
    • Unit - Kill Unit[(Random integer number between 1 and 3)]
instead of

  • Events
    • Unit - A unit Is attacked
  • Conditions
  • Actions
    • Set Integer = (Random integer number between 1 and 3)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Integer Equal to 1
      • Then - Actions
        • Unit - Kill (Attacking unit)
      • Else - Actions
        • If (All Conditions are True then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Integer Equal to 2
          • Then - Actions
            • Unit - Kill (Attacked unit)
          • Else - Actions
            • Unit - Kill (Random unit in (Playable map area))
yes, i know the triggers leak, but its just to show :p
 
Status
Not open for further replies.
Top