Advice for a Time-Based State System? (MV)

sloths are ok

garbage boy
Member
Joined
Sep 5, 2016
Messages
9
Reaction score
8
First Language
English
Primarily Uses
RMMV
Howdy folks,

I'm trying to make a very light Thirst and Hunger system in my game. The idea is basically:
Every minute or so, use a random variable (for ease of explanation, 1 or 2).
If 1: Nothing happens.
If 2: Give character the "Hungry" state.

I've got the system down simply enough with a Common Event, but is there a way to make this a global function as opposed to putting a Parallel event on every single Map?

Many thanks and have a great day!
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,510
Reaction score
992
First Language
EN
Primarily Uses
RMMV
You could make it a common event (Database > Common Events). :)

Note that since Parallel events reset on map change, I would recommend having at least two common events:
  1. "Time" - trigger Parallel - handles the timing (can use for multiple checks if need be)
    Code:
    ◆Comment:Advance counter variable
    ◆Control Variables:#0001 HungerTime += 1
    ◆Comment:Check if it's been a long enough time (+2 per second means 120 = 1 minute)
    ◆If:HungerTime ≥ 120
      ◆Comment:If so, do the hunger check!
      ◆Common Event:Update Hunger
      ◆Comment:Then reset the timer~
      ◆Control Variables:#0001 HungerTime = 0
      ◆
    :End
    ◆Comment:Run once per 30 frames (i.e. twice per second)
    ◆Wait:30 frames

  2. "Update Hunger" - trigger None - handles the actual hunger effects
    Code:
    ◆Control Variables:#0002 Random = Random 1..2
    ◆If:Random > 1
      ◆Text:None, Window, Bottom
      :    :You feel hungry.
      ◆Change State:Entire Party, + Hungry
      ◆
    :End
Feel free to change the numbers around, this is just as an example! Note that without a Wait command, Parallel events will typically run once per frame, which is often unnecessary...that's why it's there~ :kaopride:
 

sloths are ok

garbage boy
Member
Joined
Sep 5, 2016
Messages
9
Reaction score
8
First Language
English
Primarily Uses
RMMV
@caethyril Thanks!
I was hoping to avoid putting a common event on every map, but it's probably a must.
I like the way you've it set up; much nicer than mine was. Very nice help!! :)
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,510
Reaction score
992
First Language
EN
Primarily Uses
RMMV
@caethyril Thanks!
I was hoping to avoid putting a common event on every map, but it's probably a must.
I think maybe you've misunderstood what common events are: the approach I suggested requires no map events (other than the one to turn on the "Time" common event's switch). :kaoswt:

Anyway, you're welcome~ :kaojoy:
 

sloths are ok

garbage boy
Member
Joined
Sep 5, 2016
Messages
9
Reaction score
8
First Language
English
Primarily Uses
RMMV
Oh, sorry! I meant to say Parallel event in that post. My bad! Even with almost 2,000 hours on Maker I'm still bad at the lingo haha.

Thank you again for your help! <3

EDIT: Oh, my god, I've only just now noticed that Common Events have triggers. All this time I'd thought you need to use an event to specifically call the common event every time.....
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

Well, looks like I need to build myself a quest system. Or really just a system for "Helpful voices" to talk to the player. I'm sure nothing will go wrong listening to them.... They're "helpful". :LZSwink:

Should be pretty easy with PIXI just letting me write all over the screen. :LZSexcite:
I'm starting to think I just dont like anime since the last one I enjoyed was none of them.
Hi guys, Im new here. Im using RPGMMV. In this community i would like to learn more and become better rpg developer.
The main character for the first game was originally going to become a member of the party in the third game but I'm probably changing him to an important NPC instead. That brings the third game's total ensemble roster down to nine with one optional secret character.

Forum statistics

Threads
95,593
Messages
930,306
Members
125,896
Latest member
Yilou
Top