• 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] Which Timer expiried?

Status
Not open for further replies.
Level 5
Joined
Oct 9, 2008
Messages
112
Hi guys,

i need some help... I want to know how to see which Timer expired but which Condition contains this function? I hope anyone can help me! :>

  • Accept or Decline Group
    • Ereignisse
      • Zeit - Group_Accept_Timer[1] expires
      • Zeit - Group_Accept_Timer[2] expires
      • Zeit - Group_Accept_Timer[3] expires
      • Zeit - Group_Accept_Timer[4] expires
      • Zeit - Group_Accept_Timer[5] expires
      • Zeit - Group_Accept_Timer[6] expires
      • Zeit - Group_Accept_Timer[7] expires
      • Zeit - Group_Accept_Timer[8] expires
      • Zeit - Group_Accept_Timer[9] expires
      • Zeit - Group_Accept_Timer[10] expires
    • Bedingungen
    • Aktionen
      • For each (Integer A) from 1 to 10, do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
            • 'THEN'-Aktionen
            • 'ELSE'-Aktionen
      • Set Group_Player_IG[(((Player number of (Player(Group_IG_Inv))) x 10) + (Player number of (Player(Group_IG_Inv))))] = True
      • Set Group_Groups[(Player number of (Player(Group_IG_Inv)))] = Group_Groups[(Player number of (Triggering player))]
      • Spiel - Display to (All players) the text: ((Name of (Player(Group_IG_Inv))) + ( is in Group + (String(Group_Groups[(Player number of (Player(Group_IG_Inv)))]))))
      • Set Group_Player_Library[(((Player number of (Player(Group_IG_Inv))) x 10) + (Player number of (Player(Group_IG_Inv))))] = Group_Groups[(Player number of (Triggering player))]
-Atami (+rep for the guys who help me! :>)
 
Level 9
Joined
May 27, 2006
Messages
498
I'm fairly sure you can't compare timers in GUI, so you'd have to use some jass (somebody correct me if i'm mistaken)
  • Actions
    • Set TimerCheck = (Expiring timer) // event response
    • For each (Integer A) from 1 to 10, do (Actions)
      • Custom script: if udg_TimerCheck == udg_Group_Accept_Timer[bj_forLoopAIndex] then
      • all your then actions
      • Custom script: else
      • all your else actions
      • Custom script: endif
    • all your other actions
    • Custom script: set udg_TimerCheck = null
Edit;
After looking at the rest of your trigger, i saw you're trying to use (Triggering player). You can't use it in this case, since there's no player that triggers the event.
Tho you can make it work with a small workaround...
I guess that each timer is 'assigned' to a player, and array number is number of that player; therefore we can do the following
  • Actions
    • Set TimerCheck = (Expiring timer)
    • Set TimerInteger = 0
    • For each (Integer A) from 1 to 10, do (Actions)
      • Custom script: if udg_TimerCheck == udg_Group_Accept_Timer[bj_forLoopAIndex] then
      • Set TimerInteger = (Integer A)
      • Custom script: endif
    • Custom script: set udg_TimerCheck = null
    • Set Group_Groups[(Player number of (Player(Group_IG_Inv)))] = Group_Groups[(TimerInteger)] // and so on
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
Hashtables make this very easy, no need for looping through all timers.


Create a hastable
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
Give each timer an index
  • Untitled Trigger 033
    • Events
      • Elapsed time equal to 0
    • Conditions
    • Actions
      • For each (Integer loopA) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: set udg_i1 = GetHandleId(udg_Timer[udg_loopA])
          • Custom script: call SaveInteger( udg_Hash , udg_i1 , StringHash("index") , udg_loopA )
Load the index of expiring timer.
  • Untitled Trigger 034
    • Events
      • Time - Timer[1] expires
      • Time - Timer[2] expires
      • Time - Timer[3] expires
      • Time - Timer[4] expires
    • Conditions
    • Actions
      • Set i1 = (Load (Key index) of (Key (Expiring timer)) from Hash)
      • Game - Display to Player Group - Player 1 (Red) the text: (String(i1))
i1 is an integer variable.

 
  • Timer
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • -------- Some custom script, GetExpiredTimer is checking the expired timer, Integer A is the index, YourTimer is, your timer. --------
          • Custom script: if GetExpiredTimer() == udg_YourTimer[GetForLoopIndexA()] then
          • -------- Your GUI actions --------
          • Custom script: endif
Maker's version is more easier to use if you are advanced at triggering.
 
Status
Not open for further replies.
Top