• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Get your art tools and paintbrushes ready and enter Hive's 34th Texturing Contest: Void! Click here to enter!

Possible To Use Int Array Inside a Loop, Custom Script?

Status
Not open for further replies.
Level 7
Joined
Nov 6, 2019
Messages
198
basically, this is how i got it i am wondering if it possible to use a Int Array inside Custom Script on a Loop

So i want to set it to show custom UI text of the number that LeftInt Randomly Sets to

So Rolls 1 to 15, and gets a 9 so want it to show the Text of GBLeftTextC[08] as custom UI Text goes from [00 to 14] Hence the - 1 to register the correct one to show, Has to be Array due to 7 different players, and want it different per player for it to show.

  • For each (Integer A) from 1 to 7, do (Actions)
    • Loop - Actions
      • -------- Left Start --------
      • Set VariableSet GBPlayerSet = (Player(((Integer A) - 1)))
      • Set VariableSet GBLeftInt[(Player number of GBPlayerSet)] = (Random integer number between 1 and 15)
      • Custom script: if (GetLocalPlayer() == udg_GBPlayerSet) then
      • Custom script: call BlzFrameSetVisible(GBLeftTextC[udg_GBLeftInt[bj_forLoopAIndex - 1]], true)
      • Custom script: endif
NVM i think i got it i was missing the udg_ seems to be working.
 
Last edited:

Uncle

Warcraft Moderator
Level 74
Joined
Aug 10, 2018
Messages
7,941
Yes, you just need to write "udg_" before the name of your global variable:
  • For each integer Loop from 0 to 6, do (Actions)
    • Loop - Actions
      • -------- Left Start --------
      • Set VariableSet GBPlayerSet = (Player(Loop + 1))
      • Set VariableSet GBPN = (Player number of GBPlayerSet)
      • Set VariableSet GBLeftInt[GBPN] = (Random integer number between 0 and 14)
      • Custom script: if (GetLocalPlayer() == udg_GBPlayerSet) then
      • Custom script: call BlzFrameSetVisible(GBLeftTextC[udg_GBLeftInt[udg_GBPN]], true)
      • Custom script: endif
I also cleaned it up a bit.

You could also just do this:
  • For each integer Loop from 0 to 6, do (Actions)
    • Loop - Actions
      • -------- Left Start --------
      • Set VariableSet GBPlayerSet = (Player(Loop + 1))
      • Set VariableSet GBInt = (Random integer number between 0 and 14)
      • Custom script: if (GetLocalPlayer() == udg_GBPlayerSet) then
      • Custom script: call BlzFrameSetVisible(GBLeftTextCG[GBInt], true)
      • Custom script: endif
 
Last edited:
Status
Not open for further replies.
Top