I actually have an inactivity idle set up in my game. This is how I set it up:
There are 2 parallel common events involved.
1) I have a global "game-tick" parallel common event. This game tick checks and updates information once per second. In the game tick, there is a check for player activity.
Using this script provided to me by
@Robro33 and put in a conditional branch
Object.entries(Input.keyMapper).some(key=>Input.isPressed(key[1]))
Every 1 second the game checks if the player is pressing any buttons. If the player
is pressing a button, it sets a timer variable to 0 (basically restarting the clock for when the inactivity idle is triggered)
If the player is pressing a key (the else branch)
It will increment a timer variable by 1. When it reaches 45 (basically, 45 seconds) it will enable the inactivity animation and turn on a switch.
2)That switch enables the second parallel common event.
This common event is just there checking for when the player presses any key, so it uses the same script as before. It checks this 30 times per second (basically a wait frame of 2).
If the script returns true, it will stop the inactivity animation, set the timer variable back to 0, and turn the switch off.
If you are wondering why the "player is active again" common event is separate from the global tick common event, this is because the global tick is relatively slow - as I mentioned, only 1 time per second. Ideally, checking for a key press should be as fast as possible, so once per second is far too slow. Thus the "player is active again" has a separate common event that checks faster. 30 times per second is still relatively slow, but considering this situation is very low stakes, some minor responsiveness issues are forgivable and this reduces any unnecessary overhead for such a simple system (especially overhead when idling!)
Second, it's worth noting the global tick is always ticking, even in cutscenes. This could cause problems with cutscenes, so you'd likely want to set up some sort of method to tell the global tick when a cutscene is active.
In my case, I have a "cutscene" common event that is ran both at the start and end of a cutscene. This cutscene common event does a wide number of things, but of one of those things is disabling the inactivity portion of the global tick.