- Joined
- Jun 20, 2004
- Messages
- 229
Hi,
I am having a bit of trouble with timers not correctly aligning with my periodic event. Due to the complexity for what the timers are used in my original map I have dubbed down a basic demo example below as well as an image to sort of explain what the problem is.
What the map does is, whenever an ability is cast, Thunderclap from the hero in this case for quick demonstration, is that at any time the ability is cast, a boolean will be set to true. When this happens, a periodic event running every .01 will detect this and in order to keep the periodic and countdown timer from desyncronizing from each other and keeping the same iterations the first condition will run when startTimer is true, and start a 2 second countdown timer as well as set the boolean to false so it wont run until the ability is cast again as well as set the showTimer boolean to true so the periodic knows when to run the trigger showing the time remaining for the current timer in progress. When the timer reaches 0, it will set the boolean to false, causing no more text to be shown announcing the timers remaining time. This works all fine as well as the ability to spam Thunderclap as fast as possible and it will still work correctly and will replace an already running countdown as intended.
The problem however, is after casting an ability many times, basically I urge you to spam the Thunderclap for a good minute or two until you notice a different set of numbers to the left. You will notice that instead of the text ending in 0.020, 0.010, 0.00... you will get 0.021, 0.011, 0.01, 0.00 which completely throws off everything if you were to have any conditions in the Timer trigger set to go off during a specific time frame. I can not figure out what the problem is. If anyone has any idea what might be happening please post, I will appriciate it greatly as this is a very detrimental to my project.
Here is the code:
Here is the screen shot
The map example is attached below,
Thanks
I am having a bit of trouble with timers not correctly aligning with my periodic event. Due to the complexity for what the timers are used in my original map I have dubbed down a basic demo example below as well as an image to sort of explain what the problem is.
What the map does is, whenever an ability is cast, Thunderclap from the hero in this case for quick demonstration, is that at any time the ability is cast, a boolean will be set to true. When this happens, a periodic event running every .01 will detect this and in order to keep the periodic and countdown timer from desyncronizing from each other and keeping the same iterations the first condition will run when startTimer is true, and start a 2 second countdown timer as well as set the boolean to false so it wont run until the ability is cast again as well as set the showTimer boolean to true so the periodic knows when to run the trigger showing the time remaining for the current timer in progress. When the timer reaches 0, it will set the boolean to false, causing no more text to be shown announcing the timers remaining time. This works all fine as well as the ability to spam Thunderclap as fast as possible and it will still work correctly and will replace an already running countdown as intended.
The problem however, is after casting an ability many times, basically I urge you to spam the Thunderclap for a good minute or two until you notice a different set of numbers to the left. You will notice that instead of the text ending in 0.020, 0.010, 0.00... you will get 0.021, 0.011, 0.01, 0.00 which completely throws off everything if you were to have any conditions in the Timer trigger set to go off during a specific time frame. I can not figure out what the problem is. If anyone has any idea what might be happening please post, I will appriciate it greatly as this is a very detrimental to my project.
Here is the code:
Code:
Start Timer
Events
Unit - A unit Starts the effect of an ability
Conditions
Actions
Set startTimer[(Player number of (Picked player))] = True
Code:
Check Timer
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
startTimer[(Player number of (Picked player))] Equal to True
Then - Actions
Countdown Timer - Start timerCountdown[(Player number of (Picked player))] as a One-shot timer that will expire in 2.00 seconds
Set startTimer[(Player number of (Picked player))] = False
Set showTimer[(Player number of (Picked player))] = True
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
showTimer[(Player number of (Picked player))] Equal to True
Then - Actions
Trigger - Run Timer <gen> (checking conditions)
Else - Actions
Code:
Timer
Events
Conditions
Actions
Quest - Display to (All players) the Simple Hint message: (String((Remaining time for timerCountdown[(Player number of (Picked player))])))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Remaining time for timerCountdown[(Player number of (Picked player))]) Equal to 0.00
Then - Actions
Set showTimer[(Player number of (Picked player))] = False
Else - Actions
Here is the screen shot
The map example is attached below,
Thanks
Attachments
Last edited: