- Joined
- Jul 12, 2021
- Messages
- 97
Hello everyone. I have a very difficult question.
What I'm about to describe is part of a complex system I'm creating. Some of my triggers or code might look pointless, but I really need it to function the way I'm describing. This is because it's the only way that it will fit the system I'm creating.
Map description:
-I have a unit with an ability.
-Whenever the ability is used the trigger "Its this one attack" forces the player to press the key "Z". It also starts the timer "t4".
-Trigger "OSKEYPressZ" has the event: "Key 'Z' is pressed". This same trigger has the action "Execute the trigger 'ZPressed'".
-Trigger "ZPressed" uses the function "TimeGetElapsed". This function tells you how much time has passed since the specified timer started.
-Trigger "ZPressed" has an action that prints the time elapsed since timer "t4" started. The time elapsed is multiplied by 1000 before it is printed. Here is the custom script:
call QuestMessageBJ( GetPlayersAll(), bj_QUESTMESSAGE_UPDATED, R2S(TimerGetElapsed(udg_t4)*1000))
Here is where the glitch occurs. The printed message should always be the same but it isn't. Here is what is printed:
-If the elapsed time of the game is between 00:05 and 00:10, the printed message is: 99.993
-If the elapsed time of the game is between 00:10 and 00:35, the printed message is: 99.983
-If the elapsed time of the game is between 00:35 and 02:05, the printed message is: 99.945
-If the elapsed time of the game is between 02:05 and 04:15, the printed message is: 99.792
-If the elapsed time of the game is between 04:15 and 8:30, the printed message is: 99.487
-If the elapsed time of the game is between 08:30 and ??:??, the printed message is: 99.877
Format used: Minutes:Seconds
As you noticed, the printed message varies according to the elapsed time of the game. This makes no sense, therefore, I labeled it as a glitch. The printed message is consistent only if it is between the specified time. For example: If the elapsed time of the game is between 00:10 and 00:35, the printed number will always be 99.983
If you are wondering why do I care what the message printed is, it is because the trigger "ZPressed" does the following:
"If the elapsed time of the timer is 99.983 then do an action."
Since the TimeGetElapsed function gives me inconsistent numbers, then the action in the above line will only occur between the time frames 00:10 and 00:35. I need the action to be executed all of the times.
The workaround I propose is to play for around 10 hours and observe which numbers are printed in which time frames. Then create triggers that adjust to the time frames. Example:
If the elapsed time is between 00:10 and 00:35 then do the action if the TimeGetElapsed function returns 99.983 seconds. If the elapsed time is between 00:35 and 02:05 then do the action if the TimeGetElapsed function returns 99.945. And so on for about 10 hours.
The workaround works but I still wanted to consult with you all to know what do you think. Since timers are asynchronous I think my workaround will work even if playing online.
Other information:
-I'm planning to use this system on a 24 player map.
-I've tested this triggers in 2 different maps and the printed numbers were consistent.
-After you give me your opinion I'm planning on testing in different maps to see if the numbers remain consistent. I'm also planning to test it online with other players.
If you are going to test the map here is what you need to know:
-The trigger ZPressed executes an action when the TimerGetElapsed function returns 99.983. This should only work for the time frame 00:10 and 00:35. However, it works from the time frame 00:00 to 00:35, even though the numbers returned in the first 10 seconds aren't 99.983.
-Trigger "Its this one attack" runs when an attack order is given. I said above that it is run only when I use a specified ability because in the original map the button for Attack is removed. Because of this, the trigger only runs when the specified ability is used. This ability, of course, has the order "Attack".
-I omitted something in the explanation above for simplicity's sake. There's actually 2 numbers that can be printed in the each time frame, not just one. For the time frame 00:10 and 00:35 this number is 124.979. This second number shares the same consistency rules as the first number, and it is printed only about 4% of the times the ability is used.
-The ability of this test map is named "Attack" and it is inside a spell the Paladin has which is named "Spellbook".
What I'm about to describe is part of a complex system I'm creating. Some of my triggers or code might look pointless, but I really need it to function the way I'm describing. This is because it's the only way that it will fit the system I'm creating.
Map description:
-I have a unit with an ability.
-Whenever the ability is used the trigger "Its this one attack" forces the player to press the key "Z". It also starts the timer "t4".
-Trigger "OSKEYPressZ" has the event: "Key 'Z' is pressed". This same trigger has the action "Execute the trigger 'ZPressed'".
-Trigger "ZPressed" uses the function "TimeGetElapsed". This function tells you how much time has passed since the specified timer started.
-Trigger "ZPressed" has an action that prints the time elapsed since timer "t4" started. The time elapsed is multiplied by 1000 before it is printed. Here is the custom script:
call QuestMessageBJ( GetPlayersAll(), bj_QUESTMESSAGE_UPDATED, R2S(TimerGetElapsed(udg_t4)*1000))
Here is where the glitch occurs. The printed message should always be the same but it isn't. Here is what is printed:
-If the elapsed time of the game is between 00:05 and 00:10, the printed message is: 99.993
-If the elapsed time of the game is between 00:10 and 00:35, the printed message is: 99.983
-If the elapsed time of the game is between 00:35 and 02:05, the printed message is: 99.945
-If the elapsed time of the game is between 02:05 and 04:15, the printed message is: 99.792
-If the elapsed time of the game is between 04:15 and 8:30, the printed message is: 99.487
-If the elapsed time of the game is between 08:30 and ??:??, the printed message is: 99.877
Format used: Minutes:Seconds
As you noticed, the printed message varies according to the elapsed time of the game. This makes no sense, therefore, I labeled it as a glitch. The printed message is consistent only if it is between the specified time. For example: If the elapsed time of the game is between 00:10 and 00:35, the printed number will always be 99.983
If you are wondering why do I care what the message printed is, it is because the trigger "ZPressed" does the following:
"If the elapsed time of the timer is 99.983 then do an action."
Since the TimeGetElapsed function gives me inconsistent numbers, then the action in the above line will only occur between the time frames 00:10 and 00:35. I need the action to be executed all of the times.
The workaround I propose is to play for around 10 hours and observe which numbers are printed in which time frames. Then create triggers that adjust to the time frames. Example:
If the elapsed time is between 00:10 and 00:35 then do the action if the TimeGetElapsed function returns 99.983 seconds. If the elapsed time is between 00:35 and 02:05 then do the action if the TimeGetElapsed function returns 99.945. And so on for about 10 hours.
The workaround works but I still wanted to consult with you all to know what do you think. Since timers are asynchronous I think my workaround will work even if playing online.
Other information:
-I'm planning to use this system on a 24 player map.
-I've tested this triggers in 2 different maps and the printed numbers were consistent.
-After you give me your opinion I'm planning on testing in different maps to see if the numbers remain consistent. I'm also planning to test it online with other players.
If you are going to test the map here is what you need to know:
-The trigger ZPressed executes an action when the TimerGetElapsed function returns 99.983. This should only work for the time frame 00:10 and 00:35. However, it works from the time frame 00:00 to 00:35, even though the numbers returned in the first 10 seconds aren't 99.983.
-Trigger "Its this one attack" runs when an attack order is given. I said above that it is run only when I use a specified ability because in the original map the button for Attack is removed. Because of this, the trigger only runs when the specified ability is used. This ability, of course, has the order "Attack".
-I omitted something in the explanation above for simplicity's sake. There's actually 2 numbers that can be printed in the each time frame, not just one. For the time frame 00:10 and 00:35 this number is 124.979. This second number shares the same consistency rules as the first number, and it is printed only about 4% of the times the ability is used.
-The ability of this test map is named "Attack" and it is inside a spell the Paladin has which is named "Spellbook".
Attachments
Last edited: