Real time elapsed

Leazy

You can change this now in User CP.
Reaction score
50
Hello!

I got a knock back system that bases the knockback speed on the duration set in a variable. The trigger runs every 0.03 sec and increases the variable by 0.03. When the variable reaches the predetermined value the knockback ends. This way I am able to set the knockback time to anything I want. The problem is that I don't think the trigger runs every 0.03 sec, therefor the knockback lasts for longer than I want it to. Does anyone know how often a 0.03 sec periodic trigger actually runs?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
it should be running for what it says, but what is the game speed you are playing it on?
 

Leazy

You can change this now in User CP.
Reaction score
50
Fast game speed I think. The knockback lasts for longer than it should, and I have heard that very small time values doesn't work exact.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i would go with 0.1 or 0.05 rather than 0.03 if thats really the problem
 

Leazy

You can change this now in User CP.
Reaction score
50
That wouldn't make an equally smooth knock back. I could just fix this by making the knock back time half, but I really would like to know how often 0.03 actually runs (for knowledge reasons). Thanks anyway!
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i think they have a max periodic interval of 0.05 (20/sec) to avoid super spam at 0.01 (100/sec) trigger fires/sec and all that jaz
 

Dirac

22710180
Reaction score
147
i think they have a max periodic interval of 0.05 (20/sec) to avoid super spam at 0.01 (100/sec) trigger fires/sec and all that jaz
False, 0.03 interval runs at 0.03
Post your code you're doing something wrong, timers execute very fast and very accurately
 

Leazy

You can change this now in User CP.
Reaction score
50
Trigger:
  • Knockback
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Knockback_Group and do (Actions)
        • Loop - Actions
          • Set Caster = (Picked unit)
          • Set Real[1] = (Knockback_Distance[(Custom value of Caster)] / (Knockback_Time[(Custom value of Caster)] / 0.03))
          • Set Point[1] = (Position of Caster)
          • Set Point[2] = (Point[1] offset by Real[1] towards Knockback_Angle[(Custom value of Caster)] degrees)
          • Unit - Move Caster instantly to Point[2]
          • Special Effect - Create a special effect attached to the origin of Caster using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set Knockback_End[(Custom value of Caster)] = (Knockback_End[(Custom value of Caster)] + 0.03)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Knockback_End[(Custom value of Caster)] Greater than or equal to Knockback_Time[(Custom value of Caster)]
            • Then - Actions
              • Unit - Remove Ghost (Visible) from Caster
              • Unit Group - Remove Caster from Knockback_Group
              • Set Knockback_End[(Custom value of Caster)] = 0.00
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Ghost (Visible) for Caster) Equal to 0
                • Then - Actions
                  • Unit - Add Ghost (Visible) to Caster
                • Else - Actions
          • -------- Kill Trees --------
          • Destructible - Pick every destructible within 150.00 of Point[2] and do (Actions)
            • Loop - Actions
              • Destructible - Kill (Picked destructible)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Knockback_Group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 

Dirac

22710180
Reaction score
147
Your code looks fine to me : /
You leak 2 locations (Point[1] and Point[2])
Something that always helps me to know what's wrong is to make the game tell me the values of variables, so i advise you to add the Game - Display text to player... with the Knockback_End variable and the Knockback_Time.

A simpler way to do it wouldn't just to decrease the knockback time instead of increasing a new (useless) variable?

set Knockback_Time = Knockback_Time - 0.03
if Knockback_Time less than or equal to 0 then
end

i hope you get the point
 

Leazy

You can change this now in User CP.
Reaction score
50
"A simpler way to do it wouldn't just to decrease the knockback time instead of increasing a new (useless) variable?"

Would change this line (since it depends on Knockback_Time to be the same value constantly):
Set Real[1] = (Knockback_Distance[(Custom value of Caster)] / (Knockback_Time[(Custom value of Caster)] / 0.03))

Thanks for the help tho! :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top