How to have an event trigger if you haven't moved for a certain time?

Traveling Bard

The Bard
Veteran
Joined
Jul 4, 2012
Messages
564
Reaction score
482
First Language
English
Primarily Uses
So, here's what I've got so far...

If the player doesn't leave this path (a literal road) for the entire game, then at the end they will reach this spot where it's the end of the road where I'll reward them with buffs and an achievement. I'll also have a small bit of dialogue, telling them that now is the time to step off the path, into the unknown, and face their destiny head on (the final boss is in the grass a few steps ahead).

I accomplished the above by sandwiching the road in region 1 tiles and having events that will trigger & set a switch once he touches a region 1 tile (via Yanfly's event region trigger plugin).

Now, the reason for the post, I wanted to go a step further for giggles and have it so that if you don't move at all after the above for a set amount of time, then text will pop up telling you to get off the road in various colorful ways, ultimately giving you a new ability called Void something which can only be used off the path... since it's void of any paths. It's dumb, yes... but I do not know how to approach accomplishing something like this without locking the player into a forced cutscene where they can't move. How would you go about doing this?
Thanks in advance!
 

VTDraws

Filthy Point-&-Click casual
Veteran
Joined
Apr 17, 2017
Messages
56
Reaction score
9
First Language
English
Primarily Uses
RMMV
I'm actually interested in seeing this too, could make for some fun, meta interactions.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
523
Reaction score
410
First Language
English
Primarily Uses
RMMV
when you give the cheevo, record the player's coordinates, then activate a parallel process which checks every frame to see if they've changed locations, turns on a failure flag if they have, increments a variable if they haven't, and then checks to see if the variable is high enough that they've been waiting a couple minutes.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,654
Reaction score
13,265
First Language
English
Primarily Uses
RMMV
I'd do the above, but add in a 1 second wait between checks. You don't really need to know 60 times a second if they've moved. Then when you increment your variable, you know they've been idle for that many seconds.

To see if they've moved, just get the number of steps and compare it with the previous number of steps. So 3 variables needed.
 

Kuro DCupu

Trust me, I'm a veteran RMer
Veteran
Joined
Jul 6, 2014
Messages
446
Reaction score
1,402
First Language
Indonesia
Primarily Uses
RMMV
....
Page 1
1593933637336.png

Page 2
1593933691041.png

Points to be noted:
- $gamePlayer.isMoving() is a script call that check if the player is moving (changed coordinate).
- The variable work as both the parallel condition and the waiting time to trigger the next autorun page.
- Only use parallel process as the background process. Your actual event is run on autorun.
- This event is designed to be reusable. It will active again if you set the variable above 0.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,654
Reaction score
13,265
First Language
English
Primarily Uses
RMMV
nice. Not necessary to have a second autorun page though - you could just put those commands on the first page, instead of turning on self switch A.

However, you would want to set the variable back to 300 again rather than 0, otherwise once the message shows, it'll show continuously as the player won't have a chance to move.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
478
Reaction score
210
First Language
English
Primarily Uses
RMMV
You added a 1 frame wait, not a 1 second wait. In RMMV, there are 60 frames per second, so you should change the wait to 60 frames.
 

Kuro DCupu

Trust me, I'm a veteran RMer
Veteran
Joined
Jul 6, 2014
Messages
446
Reaction score
1,402
First Language
Indonesia
Primarily Uses
RMMV
nice. Not necessary to have a second autorun page though - you could just put those commands on the first page, instead of turning on self switch A.

However, you would want to set the variable back to 300 again rather than 0, otherwise once the message shows, it'll show continuously as the player won't have a chance to move.
It's both my style and habit to differentiate between what supposed to be background process and an actual event. Sure, window message already restrict the player, but not the other event command. I eventing with the mindset of "what if I want to edit it later?" thingie.
Also it's the reverse. You set the variable to 0 to turned it off for good as the page condition is >= 1.

You added a 1 frame wait, not a 1 second wait. In RMMV, there are 60 frames per second, so you should change the wait to 60 frames.
Yea, try that and it will be out of sync...
$gamePlayer.isMoving() is checking the change of player position in real time. Meaning it return false immediately the moment your character stopped. I could cheat the check if I timed my move correctly since the player can move faster than a second per tile. That's why the check has to run per frame at best.
The actual wait is in the variable update, which is updated every frame. Setting the variable to 300 mean wait for 5 seconds.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
478
Reaction score
210
First Language
English
Primarily Uses
RMMV
I see. I think having "wait 1 frame" will mean it effectively runs at 30 frames per second, though; is that what you want?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,390
Reaction score
7,220
First Language
German
Primarily Uses
RMMV
getting the exact number of waitframes for any given parallel process is more an art than a science.
if the number of waits is too low you still get lag due to high processor demand - for something like above I would set wait to 3 or 5 frames.
if the number of waits is too high, the parallel process will react to slow to changes, and a lot of players would confuse that with lag.
Which way is better always depends on what the event is supposed to do and how many other events are also adding to lag.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,654
Reaction score
13,265
First Language
English
Primarily Uses
RMMV
Also it's the reverse. You set the variable to 0 to turned it off for good as the page condition is >= 1.
Ah, yes, I missed that bit :)
 

Traveling Bard

The Bard
Veteran
Joined
Jul 4, 2012
Messages
564
Reaction score
482
First Language
English
Primarily Uses
Hey! Just want to thank everyone for the answers! I really appreciate it :)

I was just inspired by this moment in Earthbound where you stand in front of a waterfall for several minutes which is apparently the password into the bad guy's hideout haha.

I'll be posting this silly experimental game in the next week or so.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

ESAMarathon on Twitch, now streaming "Eat Girl". Yep, that's the title of a game... Apparently it's a Pacman knockoff.... Which is of course the only logical conclusion one would get from a name like "Eat Girl". :kaopride: I can't believe anybody would think anything else! :kaoback:
Super stoked i just finished my first town in my project, by finished i mean i can always add more decorative aesthetics and the NPCs don't talk yet but the mapping is complete and all the important chess pieces are present!
My brain: Hey, I have an idea how to make the transition to the main story quest in The Wastes more natural!
Me: Good!
My brain: You need to remake the hotel you start out in, it's not realistic enough.
Me: Ok... This was unexpected, but I can do it.
My brain: Now make each hotel floor 5 times as large to match the main part. Oh, you also need to make a bunch of new npcs to fill in the space on these maps.
Me: Crap.
Should be able to release Haxe MV/MZ next weekend.
It look that somehow MZ tracks are messed up (for example battle4 is obviously a theme, castle2 is a ship, ship1 is a scene and so on..). Maybe they just named them after with some ambiguity.

Forum statistics

Threads
100,617
Messages
977,828
Members
132,227
Latest member
YourBaka
Top