dynamically change i_timescale cvar [Zscript]

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
GiveOneMoreChance
Posts: 19
Joined: Thu Aug 10, 2017 8:09 pm

dynamically change i_timescale cvar [Zscript]

Post by GiveOneMoreChance »

Hello, in new gzdoom added i_timescale cvar. I try change this cvar dynamically but cvar always reset to 1.
In player tick
Super.tick()
If (CountInv("TestItem")) Cvar.GetCvar("i_timescale").SetFloat(0.5)
else Cvar.GetCvar("i_timescale").SetFloat(1.0)
If change code to
Super.tick()
Cvar.GetCvar("i_timescale").SetFloat(0.5)
All works fine
User avatar
Rachael
Posts: 13789
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: dynamically change i_timescale cvar [Zscript]

Post by Rachael »

No. Changing the time scale is not permitted - it's a debug variable, nothing more. There's a reason why it was not included in the patch notes. (Its existence is not a secret, but I discourage any active documentation of it because it's meant to diagnose issues with things like model rotations and interpolations and such - things only developers right now will find useful)

Many things have to happen before the mod can change the time scale.

Also, only custom defined [wiki]CVARINFO[/wiki] CVars can be changed, not internal ones.

Return to “Scripting”