Log in to reply
 

Suppressing Hash.SET_CLOCK_TIME glitch?



  • It would appear that Hash.SET_CLOCK_TIME is glitching a bit. I faded out my screen first, then wanted to set the hour (to night), and then smoothly fade up again. Hash.SET_CLOCK_TIME seems to break out of the fade, though, and glitches a bit to boot. Something like:

                Game.FadeScreenOut(500)
                Wait(500)
                SetTime (21, 0, 0)
                Game.Player.Character.Position = Apartment.TeleportInside
                Wait(500)
                Game.FadeScreenIn(500)
    

    The glitching is annoying. I don't suppose anyone knows of way to suppress the screen output when setting Hash.SET_CLOCK_TIME?!



  • @meimeiriver What happens if you put the second Wait(500) after the Game.FadeScreenIn(500)? Or maybe simply remove the second Wait(500)? Not sure though.



  • @Cyron43 said in Suppressing Hash.SET_CLOCK_TIME glitch?:

    @meimeiriver What happens if you put the second Wait(500) after the Game.FadeScreenIn(500)? Or maybe simply remove the second Wait(500)? Not sure though.

    I actually increased the second wait a bit (to 1,000); and that appears to keep the screen in its faded-out state long enough not to notice the Hash.SET_CLOCK_TIME operation any more. :) So I will mark this 'solved.'

    As for the following,

            Game.FadeScreenOut(500)
            Wait(500)
    

    I get the impression FadeScreenOut is an asynchronous operation (which starts fading while you continue to do other stuffz). So, the first wait(500) is needed to simply wait for it to have faded out, and then an extra wait(1,000) afterwards to keep the screen dark until the time-set operation has completed. You know these things already, of course. :) But I was kinda thinking out-loud here.



  • @meimeiriver Yeah I should have looked before. It's been a long time since I did it. Here is an excerpt from my Teleportals code.

                Game.FadeScreenOut(500);
                Wait(500);
                var speed = TeleportNow();
                Wait(1000);
                Game.FadeScreenIn(500);
                if(Game.Player.Character.IsSittingInVehicle())
                   Game.Player.Character.CurrentVehicle.Speed = speed * 1.6092f;
                Wait(_waitTime); // Is needed to prevent a teleportation loop.
                AttachTickEventTo(ObservePlayerMovingAwayFromEndpoint);
    


  • @Cyron43 ^^ Thanks for the code snippet! :)



  • @meimeiriver My pleasure. If you like you can rummage through all of my code. Just mail me and I make you a (read only) team member of my Bitbucket repos. :slight_smile:



  • @meimeiriver Just quick tip, if I were you(I don't know if I said that correctly), I would be a bit hesitant using the wait function, the simple reason is, wait function simply puts the whole script on wait mode basically it freezes the script and your program doesn't respond (Something like what System.thread.sleep function does), instead if you just want your function to be on pause/hold for said duration, how about using GTA.Game.gametime instead?



  • @ashishcw said in Suppressing Hash.SET_CLOCK_TIME glitch?:

    @meimeiriver Just quick tip, if I were you(I don't know if I said that correctly), I would be a bit hesitant using the wait function, the simple reason is, wait function simply puts the whole script on wait mode basically it freezes the script and your program doesn't respond (Something like what System.thread.sleep function does), instead if you just want your function to be on pause/hold for said duration, how about using GTA.Game.gametime instead?

    Thanks for the tip! I'll look into that.

    I do want my script to be totally on hold, though: it needs to do nothing until the fade-out/in has occured.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.