Playtime or Timer Variable as Gold?

Kikanai

Villager
Member
Joined
Sep 11, 2018
Messages
8
Reaction score
0
First Language
German
Primarily Uses
RMVXA
So my idea is to let the hero own a shop. Every once in a while he can check in and get an amount of gold depending on how long it has been since he last checked. What would I need to do in order to make this work out? Also I want to start the "timer" for this when he first visits it, not when the game is started for the first time. I guess for that I need a switch, and that would be no problem for me. Still, this might be important to know for giving me some help.
I was looking through variables and found the "Playtime" operand. Is this measured as seconds?

----

I am still pretty new to variables and try to process what exactly you can and can't do with them.
I've been doing tutorials and practicing variable stuff over the last few days, but sadly I can't really find anything similar to this. Either that, or I don't have enough imagination to copy it onto this case.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,523
Reaction score
4,534
First Language
English
Primarily Uses
RMMV
The "time unit" used to calculate time in RPG Maker (XP, VX, VX Ace, MV) is the number of frames. I put time in "" because it's not really a measure of time, but a measure of how many frames the game engine has output. Since the game engine is designed to run constantly at 60 fps (even if you can run it higher, or slower), you could say that 60 frames = 1 second.

As for your mechanic, wouldn't it be better to start the timer when the player first builds the shop? At that moment, set a variable to the amount of total frames (the playtime), and when the player comes to collect the money calculate the difference between the current time and the time when the player built the shop.

So if the player builds the shop at 10 mins of gameplay, you'll store 600 in a variable.
If the player comes back to collect money at 15 mins of gameplay, you'll store 900 in another variable.
The profit will be calculated this way:

Code:
initial_time    = 600;
current_time = 900;
profit_rate     = 1.5; // Gold per frame

profit = (current_time - initial_time) * profit_rate;
Of course, when that happens, the initial_time becomes the current_time (so initial_time is now set to 900), and the next time the player comes to collect money form the shop, the playtime will be the new current_time variable.
 

Kikanai

Villager
Member
Joined
Sep 11, 2018
Messages
8
Reaction score
0
First Language
German
Primarily Uses
RMVXA
Thank you for the explanation.

I tried to get it to work, but sadly it's too complicated for me. I can't get it to work.
Either it doesn't count the time at all, doesn't reset the timer, or
... well I don't know, the event says I played like "123" seconds / frames / minutes, does not reset the timer and the second time I talk to the event it's like "7", 3rd time talking to it I'm at "124" seconds / frames / minutes and the fourth time its "8".

I don't know what mistake I made and I think my brain is not able to process what is happening xD

So I guess I will throw that idea over board, since it's too hard for me.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,707
Reaction score
7,365
First Language
German
Primarily Uses
RMMV
show us screenshots of what you did and we can help you and explain your mistakes.

I suggest not simply ignoring this because it sounds as if your problems are with variables, and even if you don't do this specific thing, I can guarantee you that you will need variables sooner or later in your game.
 

Kikanai

Villager
Member
Joined
Sep 11, 2018
Messages
8
Reaction score
0
First Language
German
Primarily Uses
RMVXA
I don't think a screenshot would help since its in german, but here's what I did:


Eventpage 1:
>Message (Smt like "I'm the Shopkeeper, timer starts now blah blah")<
>Variable "Shop opened" = Playtime<
>Selfswitch A on<

Eventpage 2 condition Selfswitch A:
>Variable "Shop Timer = Playtime<
>Variable "Shop Timer" - Variable "Shop opened"<
>Variable "Shop Timer" / 60<
(Bc 60 frames = 1 Second)
>Message (Smt like "you waited x Seconds")<
>Message (Smt like "you gain x amount of Gold")<
>Variable "Shop opened" = Variable "Shop Timer"<


Though it seems like the dividing with 60 part aren't seconds anymore, but minutes...
Aside from that, when I talk to the Event a second time, when it's on page 2, it says "You waited 0 seconds / you gain 0 Gold"
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,707
Reaction score
7,365
First Language
German
Primarily Uses
RMMV
I don't think a screenshot would help since its in german, but here's what
The language doesn't matter, because there are only a limited number of commands and we know how they look like.

edit: snipped, I mixed up two cases in my unedited answer, forget what I wrote in this part before

So please, give screenshots of BOTH event pages.

besides - if you even tried to check the user data you would have seen that I'm also german, so please give the screenshots if you want help.
 

Kikanai

Villager
Member
Joined
Sep 11, 2018
Messages
8
Reaction score
0
First Language
German
Primarily Uses
RMVXA
you would have seen that I'm also german
Oh oops. Didn't notice that. Sorry.

Here are the screenshots. And I am aware, I haven't added the actual Gold yet.


 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,271
Reaction score
11,658
First Language
English
Primarily Uses
RMVXA
[pirate]IgnoreMe[/pirate]
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Another plugin complete and ready for Wednesday!
Just for the record I have greatly enjoyed the past couple months of using RPG Maker MV - enough that I went ahead and bought MZ although it's going to be a bit before I seriously start a project with that.
I have a pretty reasonable alpha of one game that's got roughly 4 hours of content and some bits and pieces of others after only about 300 hours total time and about 2 1/2 months of owning RPG Maker.....
I completely forgot which forum had the personal blogs for members. :LZSlol: It was probably a forum for the Ace program. I was going to see about posting a blog post, but I'm too tired, and if its associated with Ace, then its a moot point. :LZSlol:

Forum statistics

Threads
102,971
Messages
996,381
Members
134,433
Latest member
just_herefortheplugins
Top