How to create an AFK detection for doing a function?

hello there everyone
so after finishing the applying damage lecture you asked us to test new things and methods of damage beside the falling damage and projectile damage, so I had that one idea of “if you go afk, you will get damaged too” XD
i know it is a bit too advanced for me to apply this step in unreal blueprint specially am 5 lectures away from finishing the section but anyway i cant finish the section without applying this step, cuz i want to
so now the thing is i tried to method i had in mind and tested it it worked and diddnt at the same time both results are shown and cant understand why it doesnot work as i wanted so plz can you help me guys fixing it?
here is the method i used

I wouldn’t use delays for this type of functionality, especially on tick.

Instead create a float variable, lets call it “AfkCountdown” that gets lowered each tick. Once it reaches zero, then flag the player as being AFK.

Hi Dark Lord,
I do not see a Problem on using the Delay Node for this simple task. When you hover over the Delay Node, you can read, that it will only be called once and the following code will not execute until the time given is counted down.

So this is what I did for you:

I’ve done this in the GameMode, because this is (for me) a Game Rule and these should be in the GM. The Variable (bool) isThereInput? Should be set from outside, when InputEvents happen. When the Player does not touch any Input device it should be false so that the counter starts ticking. If there is any question, just reply.

Privacy & Terms