Hi. I’m using blueprints to build a pretty basic sniper type game.
An “enemy” appears on the screen and I want to do two things:
- Determine how quickly it takes the “sniper” to shoot the enemy eg. 1.3 seconds
- If after three seconds the enemy isn’t shot then the sniper “loses”.
I’ve had a look at the Unreal docs below to try and figure out how to use the timer.
In the image below from the docs the “PlayerFire” is a custom event and when the Player walks into the fire the function “FireDamage” is called and this reduces the player health.
What I don’t quite get is how the timer is started and stopped and what the time value of “.75” is doing? And also what the return value is on Set Timer by Function Name. And whether the white execute pin in Set Timer By Function Name can be started by any executable action or does it have to be an “event”?
The other node I don’t quite get is “Get Timer Elapsed Time by Handle”. Is the idea that we use “Set Time by Function Name” and the return this value to a “Timer Handle” variable and then we can get the timer handle with “Get Timer Elapsed Time by Handle”?