[System] Smooth Timers

Discussion in 'Starcraft 2 (SC2) Editor Help' started by Jesus4Lyf, Apr 23, 2010.

  1. Troll-Brain

    Troll-Brain You can change this now in User CP.

    Ratings:
    +85 / 0 / -0
  2. Zwiebelchen

    Zwiebelchen You can change this now in User CP.

    Ratings:
    +60 / 0 / -0
  3. Zwiebelchen

    Zwiebelchen You can change this now in User CP.

    Ratings:
    +60 / 0 / -0
    Okay first of: This patch tool is awesome and works.

    Second: I tested waits now on Bnet (with only me as a player, though ... couldnt make other people to join >_>), and they worked the same as in single player.

    I tested it via the following trigger:
    Code:
    Nahkampfinitialisierung
        Ereignisse
            TriggerAddEventMapInit()
        Lokale Variablen
            t = (TimerCreate()) <timer>
            i = 0 <int>
        Bedingungen
        Aktionen
            TimerStart(t,9.0,false,c_timeGame)
            While()
                Conditions
                    Comparison(i,<=,256)
                Actions
                    Wait(0.0,c_timeGame)
                    IncrementInteger(i,+,1)
            TriggerDebugOutput(1,"This should show 1:",true)
            TriggerDebugOutput(1,(FixedToText((TimerGetRemaining(t)),c_fixedPrecisionAny)),true)
    
    It returned "1" in both singleplayer and singleplayer-bnet games.

    However, something is really odd about that: When I changed the code to this, it returned "0" for some reason: Any idea why?
    Code:
    Nahkampfinitialisierung
        Ereignisse
            TriggerAddEventMapInit()
        Lokale Variablen
            t = (TimerCreate()) <timer>
            i = 0 <int>
        Bedingungen
        Aktionen
            TimerStart(t,9.0,false,c_timeGame)
            While()
                Conditions
                    Comparison(i,<=,256)
                Actions
                    Wait(0.0312,c_timeGame)
                    IncrementInteger(i,+,1)
            TriggerDebugOutput(1,"This should show 1:",true)
            TriggerDebugOutput(1,(FixedToText((TimerGetRemaining(t)),c_fixedPrecisionAny)),true)
    
    PS: Sorry for this gui trigger stuff, but I didnt find out how to convert triggers to galaxy yet.
     
  4. Saldu

    Saldu New Member

    Ratings:
    +1 / 0 / -0
    My only guess would be that since you can't have 0.03125 as a real entered there since the real input is limited to 4 digits after comma, it can't display 7.9872 as a result for some reason, but I'm at a loss for that reason too.
     
  5. Zwiebelchen

    Zwiebelchen You can change this now in User CP.

    Ratings:
    +60 / 0 / -0
    The reason for that problem was already found; I posted everything I found out about waits in the other thread. But thanks for your comment.
     
  6. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    Updated to use 0 waits. :thup:
    Version 1.1.0.
     
  7. Marsunpaisti

    Marsunpaisti New Member

    Ratings:
    +0 / 0 / -0
    Im having problems getting this to work. I tried to experiment around with these timers, and I'm not really sure if I used them properly. First of all I tried to copy the example you had in the original post but when im saving the map, galaxy editor tells me there is a syntax error on the line where there is the "newsmoothtimer(test,5)" thing.
     
  8. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    Is test a valid trigger? Can you post your map? :)
     
  9. Steel

    Steel Software Engineer

    Ratings:
    +109 / 0 / -0
    Originally posted on TDG's forum.

    Have fun.
     
  10. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    Cool, but I really like 32... :)
     
  11. Zwiebelchen

    Zwiebelchen You can change this now in User CP.

    Ratings:
    +60 / 0 / -0
    This is just wrong an merely an assumption of him, rather than a result.

    My testing triggers have proven me that only multiples of 0.03125 are possible and there is no doubt about this.
    Read the whole discussion here:
    http://www.thehelper.net/forums/showthread.php?t=149835
     
  12. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    That's what I thought, too. But I didn't read the thread. I just found that everything rounds off to the nearest tick, in general. :)
     
  13. Zwiebelchen

    Zwiebelchen You can change this now in User CP.

    Ratings:
    +60 / 0 / -0
    Not the nearest tick, but always the next tick.
     
  14. Marsunpaisti

    Marsunpaisti New Member

    Ratings:
    +0 / 0 / -0
    Here is the map I was trying to import the smooth timer into.
     

    Attached Files:

  15. Builder Bob

    Builder Bob Live free or don't

    Ratings:
    +249 / 0 / -0
    Does this system actually work as intended? I'm trying to create a smooth sliding motion for a unit, but it appears just as choppy with this system as with a .0625 timer.

    Adding a line to display the game time every time the smooth timer starts a new tick shows it constantly expires twice with the same game time.

    Example:
    0
    0
    0.0625
    0.0625
    0.125
    0.125
    0.1875
    0.1875
    etc.

    Can anyone confirm this system works and that I'm just doing something wrong? If not, can you point me in the right direction on how to achieve smooth sliding?
     

Share This Page