[solved !] change playtime ?

Status
Not open for further replies.

Emz0

Villager
Member
Joined
Nov 6, 2019
Messages
13
Reaction score
1
First Language
french/français
Primarily Uses
RMMV
Hi !

Does anyone know how to change the playtime? It seems to be calculated by multiplying _framesOnSave, but is there a way to overwrite this variable, with a bit of js I guess?

I just tried to do "$gameSystem._framesOnSave = 216000" (or some other value, doesn't matter), but it had no effect.

Thank you for your help.
 
Last edited:

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
339
Reaction score
176
First Language
English
Primarily Uses
RMMV
Playtime is calculated as Graphics.frameCount/60, this._framesOnSave is only used for storing the value of Graphics.frameCount before saving and upon loading. Just assign a new value to Graphics.frameCount and I would assume you're good to go.
 

MushroomCake28

KAMO Studio
Veteran
Joined
Nov 18, 2015
Messages
1,886
Reaction score
3,358
First Language
English
Primarily Uses
RMMV
Wait... don't just modify Graphics.frameCount without knowing exactly what you are doing. Not just the game playtime is linked to that. Graphics.frameCount actually counts every time your game is being updated (meaning that the game goes through one process loop), and generally every time your game canvas is being rendered (not true if you use VSync with a monitor higher than 60 fps, which is why it doesn't truly count the playtime). I know that as a coder I often use the Graphics.frameCount (or at least an equivalent version that I created that fixes the Vsync over 60 fps issue) in my personal plugins for multiple features. Chances are that if you have some plugins, some of them depend on Graphics.frameCount.

What are you trying to accomplish exactly?
 

Emz0

Villager
Member
Joined
Nov 6, 2019
Messages
13
Reaction score
1
First Language
french/français
Primarily Uses
RMMV
Thanks to you two.

What I want to do is this:

After a few hours, the player starts a new game, modified by some .txt files. So everything works perfectly, with the alternative playthrough, but that means its play time goes back to 0h0mn0s. What I need is a way to change that into its actual playing time, keeping the time spent during the first phase.

So, I'm trying to change the playtime at the begining of the second party.
 

MushroomCake28

KAMO Studio
Veteran
Joined
Nov 18, 2015
Messages
1,886
Reaction score
3,358
First Language
English
Primarily Uses
RMMV
For that you need to have a way to communicate data between the 2 save files. Every object in a game file is stored inside a single save file (Graphics, $gameSystem, $gameParty, $gameActor, etc.). Posting in this subforum I assume you have some coding knowledge, so you could do either:
1) When doing a new game +, select a save file to inherit, load some of its data and save it to the new save file (that's the way I would do it).
2) Do it with a .txt external file, but I wouldn't recommend it. Sure it would work, but I think it's extra work for nothing, plus a clever player could figure out how it works and modify the .txt file or take advantage of a bug.
 

Emz0

Villager
Member
Joined
Nov 6, 2019
Messages
13
Reaction score
1
First Language
french/français
Primarily Uses
RMMV
Actually, I've a very, very poor knowledge in js. I begin with this language.

Assuming that I can get the play time with an event command and store it into a variable, isn't there a way to reinject it into the new game ?

The playtime is the only thing I miss, now, to properly make that I'm trying to do. In fact, there is, at this moment of the game, not many parameters to save, and the possibility for the player to hack this .txt system is good (and it's simplier for me). I strongly encourage him to do it. :)

It's not a problem if this isn't really precise, and since everything restarts with the new game, including plugins, maybe use Graphics.frameCount is possible ? Anyway I didn't succeed to do anything with it.
 
Last edited:

MushroomCake28

KAMO Studio
Veteran
Joined
Nov 18, 2015
Messages
1,886
Reaction score
3,358
First Language
English
Primarily Uses
RMMV
Like I said, since "in-game" objects are defined and saved inside a single instance/save file, you cannot access data from other save files with events. You need to code for that. You need to code to be able to do that, meaning a plugin. You can write your plugin, or find a plugin that does this for you online (can't help for that, I don't know other people's code).

An easy solution that you could learn and achieve pretty easily assuming you have some programming background is to read the Graphics.frameCount from another save file and make that value the starting value for Graphics.frameCount in your new save file when the player starts his/her new game+.
 

Emz0

Villager
Member
Joined
Nov 6, 2019
Messages
13
Reaction score
1
First Language
french/français
Primarily Uses
RMMV
Thanks ! I see... I suppose. : p

Get the Graphics.frameCount from a save file isn't a problem, but I fail to modify it with a script in the new party. I tried (as I said, I'm a noob in js, please don't laugh ^^") :

- [EDIT : this one is working] Graphics.frameCount = 864000
- $Graphics.frameCount = 864000
- $gameSystem.Graphics.frameCount = 864000

... but none of these expressions are working. Am I completely wrong ?


EDIT : 0h, it works with "Graphics.frameCount = 864000"... So I probably made a mistake in my precedent test.

And, with :
Graphics.frameCount = $gameVariables.value(512);

(I write the original value of Graphics.frameCount into global variable n°512)
... it seems to be perfect ! Thank you so much to both of you ! :)

I'll check more deeply tomorow if there isn't any issue, and (hope ^^) close this topic.
 
Last edited:

MushroomCake28

KAMO Studio
Veteran
Joined
Nov 18, 2015
Messages
1,886
Reaction score
3,358
First Language
English
Primarily Uses
RMMV
Hmm... you don't seem to grasp what I'm trying to say. Perhaps my explanation wasn't clear enough, I'm sorry about that.

What you are doing currently is modifying the playtime of your CURRENT save file. Graphics.frameCount refers to the frames in your current active game (a save file you already loaded). If you want a new game plus feature, you need to access Graphics.frameCount from ANOTHER save file, which can't be done like this. If you don't need that and simply want to modify the playtime for your CURRENT save file, then it should work just fine, but beware of effects on other plugins (since like I said, Graphics.frameCount isn't used only for playtime).
 

Emz0

Villager
Member
Joined
Nov 6, 2019
Messages
13
Reaction score
1
First Language
french/français
Primarily Uses
RMMV
In fact, what I'm doing now, is this :

1) I get the Graphics.frameCount from the current save (alternatively, perhaps I can multiply the ingame-readed playtime by 60), and write it into a .txt file ;

2) Close the game ;

3) The player start a new game ;

4) instantly, read the .txt file, and replace the current Graphics.frameCount by the older one. So at the next save, it will be add to the time passed on the game+.

I think it's all I need. :)

But yeah, I'm a little bit afraid, after reading you, about eventuals side-effects, so I will test and test again. But assuming everything restart like a new game from scratch, except some events, I guess and hope it will be fine.
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
339
Reaction score
176
First Language
English
Primarily Uses
RMMV
As to the potential compatibility issues of setting the value of Graphic.frameCount as far as I can see, in the base game it's only being used to calculate playtime and check for freezing - and of course being incremented when the screen is rendered. I can't think of any examples or instances where I or others have used it in a way that it couldn't be assigned a new value, though I may not be looking in the right places. :p

Could you provide some examples of plugins/situations where this might be an issue, @MushroomCake28?
 

MushroomCake28

KAMO Studio
Veteran
Joined
Nov 18, 2015
Messages
1,886
Reaction score
3,358
First Language
English
Primarily Uses
RMMV
@Emz0 If you're doing that it should work just fine without issue. Setting the Graphics.frameCount at the beginning of the game will not cause any issue. Issues only arise when some things in the game are time depend and have a timer which relies on Graphics.frameCount. By changing Graphics.frameCount at the beginning of the game I see no risk at all.

@Silva Don't know much about other people's code, but I use it in my code sometimes (not often, but not as rarely as you might think). For example, I have a trading plugin where the player can trade with NPCs. NPCs have different items depending their life I guess (it was a commission plugin), and you can trade partially with them. Every trade has a timer attached to it, and after a period of time, the items are replenished in the NPCs' inventory (there are shop inventories in the game). I use Graphics.frameCount to account for those timers since I want the timer to run at all time during the save file. Messing with Graphics.frameCount could potentially mess those timers. That's just one example, I have other uses in some of my plugins.
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
339
Reaction score
176
First Language
English
Primarily Uses
RMMV
I could see how that might be an issue if you were using Graphics.frameCount in conditional statements, though the same issue would be present if you were using playtime as well. I guess it really boils down to just knowing what plugins you're using and applying a bit of common sense.
 

MushroomCake28

KAMO Studio
Veteran
Joined
Nov 18, 2015
Messages
1,886
Reaction score
3,358
First Language
English
Primarily Uses
RMMV
@Silva Exactly, hence why I said potential issues. But if you know what you're plugins are doing it should be fine. Besides, OP said that he/she will only change time to adjust for new game + total playtime at the beginning of a new game, so even if there are conditions linked to Graphics.frameCount it shouldn't have any issue.
 

Emz0

Villager
Member
Joined
Nov 6, 2019
Messages
13
Reaction score
1
First Language
french/français
Primarily Uses
RMMV
It's very instructing !

Again, thanks a lot ! :)
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
5,867
Reaction score
4,212
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I should have listened to RPGMAKER Meme thread. I should have backed up my data. The Orphan of Time, my WIP, is completely gone, all those hours of work are completely gone :(
God what was my life before smartphones (I had a grandma's phone before wednesday)
Stream will be live shortly with The Witcher 3! Feel free to drop by!
I have a specialized class on intellectual property this semester (on Patent and Trademarks, Copyrights is next semester). Only had a quick overview of that in previous business law classes. I'll be able to help more people here when it comes to knowing what to do and your rights for intellectual property!
When you wanna write another pedantic post of your views on game dev... but your cousin and aunt have invited you to bowling

Forum statistics

Threads
93,380
Messages
911,827
Members
122,876
Latest member
leproso911
Top