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

When shall I use array variables with sizes of 1

Status
Not open for further replies.
Level 8
Joined
Jul 18, 2010
Messages
332
Sorry but I'm still confused by this but could someone tell me when should I use array variables with sizes of 1?
I heard that I shouldn't use it if I will not initialized the variable. I found out about that when my revive countdown timer started to not work on all players but only with Player 1. But that's all I'm sure of. Not sure about those variables that work with players.
So just to be clear. Should I use array variables of 1 in these variables. These are dialog buttons, I have four of them in my map, two dialog buttons for each of the two dialogs.
  • Dialog - Create a dialog button for phantasmicdialog labelled Yes
  • Set phantasmicdialog_Copy[1] = (Last created dialog Button)
  • Dialog - Create a dialog button for phantasmicdialog labelled No
  • Set phantasmicdialog_Copy[2] = (Last created dialog Button)
  • Dialog - Create a dialog button for relaydungeondialog labelled Yes
  • Set relaydungeondialog_Copy[1] = (Last created dialog Button)
  • Dialog - Create a dialog button for relaydungeondialog labelled No
  • Set relaydungeondialog_Copy[2] = (Last created dialog Button)

I also have a pet system. I won't explain it too much but it uses a system wherein each of the player can have only one pet companion that is the same unit. These pet can trigger a skill which is MUI so that's why I use arrays. I have a total of 9 different MUI pets so there's gonna be a lot of arrays. I set all of those arrays to 1. Here's an example.

  • ashtaroth jr owner
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Ashtaroth Jr. Pet Card
      • (Unit-type of (Hero manipulating item)) Not equal to Storage Vault
      • (Unit-type of (Hero manipulating item)) Not equal to Rita
    • Actions
      • Set ashtarothnumber = (Player number of (Owner of (Hero manipulating item)))
      • Set ashtarothpetcard[ashtarothnumber] = (Item being manipulated)
      • Set ashtarothownerpoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Hero manipulating item))
      • Unit - Create 1 Ashtaroth Jr. for (Owner of (Hero manipulating item)) at ashtarothownerpoint[ashtarothnumber] facing (Facing of (Hero manipulating item)) degrees
      • Unit Group - Add (Last created unit) to ashtarothpetgroup
      • Animation - Play (Last created unit)'s attack animation
      • Set ashtarothunit[ashtarothnumber] = (Last created unit)
      • Set ashtarothowner[ashtarothnumber] = (Triggering unit)
      • Custom script: call RemoveLocation(udg_ashtarothownerpoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
      • Wait 0.03 seconds
      • Trigger - Turn on ashtaroth jr follow <gen>
  • zidler jr follow
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in zidlerpetgroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Follow zidlerjrowner[(Player number of (Owner of (Picked unit)))]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (zidlerjrowner[(Player number of (Owner of (Picked unit)))] is hidden) Equal to True
              • zidlerjrowner[(Player number of (Owner of (Picked unit)))] Equal to avengerform
              • (magnusdan is alive) Equal to True
            • Then - Actions
              • Unit - Order (Picked unit) to Follow magnusdan
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in zidlerpetgroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
There are more of this but I just wanna ask, is it right that I set their array sizes to 1? I have the ashtarothnumber to represent the player number of owner of manipulating item.

I'm just not sure about this but can someone verify this for me?
 
Status
Not open for further replies.
Top