• Check out the results of the Techtree Contest #19!
  • 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 void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

MUI GUI timer Problem, please help.

Status
Not open for further replies.
Level 9
Joined
Sep 28, 2004
Messages
365
Hi all i was playing around with timers and wanted to do a MUI version of it but i got some problem. Why is my below code not MUI for timers? The 2nd time of casting thunderclap won't will stop the timer and won't show the time left anymore.

I've also attach the map below so you guys can test it.

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • Hero - Learn skill for Mountain King 0000 <gen>: Thunder Clap
      • Unit - Set level of Thunder Clap for Mountain King 0000 <gen> to 3
      • -------- hashtable --------
      • Hashtable - Create a hashtable
      • Set timetable = (Last created hashtable)
  • cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • Countdown Timer - Start timer as a One-shot timer that will expire in 10.00 seconds
      • Set tempPos = (Position of Spell Breaker 0002 <gen>)
      • Unit - Create 1 Footman for Player 1 (Red) at tempPos facing Default building facing degrees
      • Unit Group - Add (Last created unit) to dummygroup
      • Hashtable - Save Handle Oftimer as (Key time) of (Key (Last created unit)) in timetable
      • Trigger - Turn on time <gen>
      • Game - Display to (All players) the text: |cff00FF00START!|r
      • Custom script: call RemoveLocation(udg_tempPos)
  • time
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in dummygroup and do (Actions)
        • Loop - Actions
          • For each (Integer A) from 0 to 10, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Elapsed time for (Load (Key time) of (Key (Picked unit)) in timetable)) Equal to (Real((Integer A)))
                • Then - Actions
                  • Game - Display to (All players) the text: (Time Left: |cffffcc00 + ((String((10 - (Integer A)))) + |r))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (10 - (Integer A)) Equal to 0
                    • Then - Actions
                      • Game - Display to (All players) the text: |cffFF0000END!|r
                      • Unit Group - Remove (Picked unit) from dummygroup
                      • Unit - Kill (Picked unit)
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in timetable
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in dummygroup) Equal to 0
                        • Then - Actions
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
                    • Else - Actions
                • Else - Actions
Is there a way to reset the timer whenever it is called?
If any of you know the problem please let me know. Thanks in advance!
 

Attachments

Because i wanted to create a spell that has a cast time, the longer it holds the more damage it does when release. This is why i am using a timer because it will be more accurate than every one second since timer will start counting down once the hero start the effect of the ability.

if i use periodic, what if the hero casted right at 1.01 seconds? then everything will go inaccurate.
 
Because i wanted to create a spell that has a cast time, the longer it holds the more damage it does when release. This is why i am using a timer because it will be more accurate than every one second since timer will start counting down once the hero start the effect of the ability.

if i use periodic, what if the hero casted right at 1.01 seconds? then everything will go inaccurate.

Not really: if you use a real and let the trigger run every 0.03 seconds, you'll have a pretty accurate result.
I don't think anyone would mind to see his spell only deals damage for 0.90 seconds of loading while he actually loaded it 0.92 seconds.
 
Sounds good to me, i will give it a go, but is there a way for me to solve the timer problem?

I have never used timers within hashtables, so I wouldn't know how it would works, it could be that it doesn't work while multiple timers are running based off the same timer.
I need to check that some day... could be useful once you know how to work with it.
 
Status
Not open for further replies.
Back
Top