• 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.

Countdown timer variables can't use array?

Status
Not open for further replies.
I'm having a problem where if I make a "Countdown Timer - Start Timer" action with an array variable (Timer[Custom value of unit], for example), the timer won't actually have any initial time and ends instantly (I checked this by making another action to display the countdown's initial time which always becomes 0 regardless of how many seconds I put in the "Start Timer" action). Does anyone else also encounter the same problem?
 
You need to ensure that the timer exists. Like this:

  • Custom script: if udg_Timer[Custom value of unit] = null then
  • Custom script: set udg_Timer[Custom value of unit] = CreateTimer()
  • Custom script: endif
  • Countdown-Timer - Start Timer[Custom value of unit]
Array variables only have valid values/data for index [0] and [1]. Others do not exist/are 0.
 
You need to ensure that the timer exists. Like this:

  • Custom script: if udg_Timer[Custom value of unit] = null then
  • Custom script: set udg_Timer[Custom value of unit] = CreateTimer()
  • Custom script: endif
  • Countdown-Timer - Start Timer[Custom value of unit]
Array variables only have valid values/data for index [0] and [1]. Others do not exist/are 0.
Thanks.
But there's absolutely no GUI command for creating a timer?
 
Thanks.
But there's absolutely no GUI command for creating a timer?

If you want to get real technical, that is technically a GUI command. It's called GUI Custom script :3

To answer your question, no. There is CreateTimerBJ(), but I'm not sure if there is an available GUI function for that.
 
Sadly there is no better way to create timers. What you could do, is making your GUI life easier and use a help variable:

  • Set Int = (Custom Value of (Triggering Unit))
  • ..
  • Custom script: if udg_Timer[udg_Int] = null then
  • Custom script: set udg_Timer[udg_Int] = CreateTimer()
  • Custom script: endif
Here you can set the value with GUI to a integer variable, and the custom script will always stay the same, if you use this variable before.
So you just can copy & paste the scripts and have to use the "Int" variable before.
 
Status
Not open for further replies.
Top