• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

Is there a way?

Status
Not open for further replies.
Level 11
Joined
Jan 23, 2015
Messages
788
Is there a way to detect the index from an event like the following example:
  • Events
    • Time - CooldownTimer[1] expires
    • Time - CooldownTimer[2] expires
    • Time - CooldownTimer[3] expires
    • Time - CooldownTimer[4] expires
How can I know which of the timers above expired? Do I have to use a different trigger for each timer?
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
That way seems a bit long, here is a shortcut if a few custom script lines won't be a problem.


  • Events
    • Time - CooldownTimer[1] expires
    • Time - CooldownTimer[2] expires
    • Time - CooldownTimer[3] expires
    • Time - CooldownTimer[4] expires
  • Actions
    • Custom script: if GetExpiredTimer() == udg_CooldownTimer[1] then
      • ------your actions here------
    • Custom script: elseif GetExpiredTimer() == udg_CooldownTimer[2] then
      • ------acts------
    • Custom script: elseif GetExpiredTimer() == udg_CooldownTimer[3] then
      • ------acts------
    • Custom script: elseif GetExpiredTimer() == udg_CooldownTimer[4] then
      • ------acts------
    • Custom script: endif
 
Level 11
Joined
Jan 23, 2015
Messages
788
That way seems a bit long, here is a shortcut if a few custom script lines won't be a problem.


  • Events
    • Time - CooldownTimer[1] expires
    • Time - CooldownTimer[2] expires
    • Time - CooldownTimer[3] expires
    • Time - CooldownTimer[4] expires
  • Actions
    • Custom script: if GetExpiredTimer() == udg_CooldownTimer[1] then
      • ------your actions here------
    • Custom script: elseif GetExpiredTimer() == udg_CooldownTimer[2] then
      • ------acts------
    • Custom script: elseif GetExpiredTimer() == udg_CooldownTimer[3] then
      • ------acts------
    • Custom script: elseif GetExpiredTimer() == udg_CooldownTimer[4] then
      • ------acts------
    • Custom script: endif

But that will result in repeating the same actions every time, and I have a lot of actions..
Nichulus' solution seems great..

Thank you both!
 
Status
Not open for further replies.
Top