[C#]For help! How to use "Game.TimeScale"
-
I'm not going to use "Game.TimeScale," the Game isn't slowing down.
I hope you don't mind my poor English
-
@Y_Ajin Is this good to you? https://www.gta5-mods.com/scripts/time-scaler
-
@krissboo Thanks
, but that's not what I want. I want to write my own script.
-
@Y_Ajin
You set it to a float between 0.2f - 1.0f.The lower the number the slower the game speed.
Im not 100% if you can go lower/higher than those values but 1.0f is normal game speed.
-
@IAmJFry I tried, but nothing happened
-
@Y_Ajin ah ok, i'm sorry I can't help you there
-
@Y_Ajin
You did “Game.TimeScale = 0.2f”.I’m going off the top of my head but that should work.
-
@Y_Ajin
If I’m wrong and nobody corrects me I can let you know for sure in a couple of hours when I get off of work.
-
@krissboo Don't worry. I'm glad you replied
-
@IAmJFry
Maybe it's my software version(I'm a rookie)?Or did not quote correctly, but “Game.TimeScale = xxf” really has no effect.
-
@Y_Ajin
I’m pretty sure that’s correct.Have you been getting any of your other code to work in game?
-
@IAmJFry
Sure, so I was confused. I looked at other authors' code and, of course, didn't help.
thank you for your patience.
-
I'm not 100% on what "Sure, so I was confused" is referring to. I was right on the use of the function, it's "Game.TimeScale = x.xf;"
-
uh,I really can't use it. I must have set something wrong and I don't know where it is. Thank you.
-
@Y_Ajin Code Snippet?
-
if (Game.IsControlPressed(2, GTA.Control.Cover)) { Game.TimeScale = 0.5f; RaycastResult crosshairCoords = World.GetCrosshairCoordinates(); if (crosshairCoords.DitHitAnything) { this.directionPos = crosshairCoords.HitCoords; } } if (this.directionPos == Vector3.Zero) Game.TimeScale = 1.0f;
-
@Y_Ajin The Code looks okay to me, but did you try commenting if (this.directionPos == Vector3.Zero)
Game.TimeScale = 1.0f; block?Probably, Script always finds directionposition = vector3.zero and thus setting game speed back to normal?
Also, setting UI.showsubtitle in each block might help you to detect the reaching point of the code. That's how I debug my scripts.
-
@ashishcw
huh,I have also thought about using UI.ShowSubtitle, thanks.
But the result is the same.
-
@Y_Ajin Does using UI.ShowSubtitle show a subtitle when placed within your if statements? My guess is the code in your if statement is never called. Are you running that code in a Tick event?
-
@Jitnaught Yeah, isn't that ok?
-
@Y_Ajin Yes.
-
@Jitnaught Man, I changed its position, but it's still useless.
Maybe I'm too stupid.
-
@Y_Ajin
Are any scripts working for you or is it just the snippet that you posted that's not working?
-
@IAmJFry Yes, just this snippet
-
@Y_Ajin
You may have to PM someone to look at the whole script to see if there's something you've missed. I don't see why it wouldn't work as long as it's called OnTick().