Control rate of fire C++

I’m new to UE4 and I think the blueprints have very limited functionality, so I downloaded visual studio.
I have a clean FPS template and want to control the fire rate of the gun. How do I do that?

Same as you would do in blueprint, you use timers:

This doc is little outdated, previously object and function pointer pair functioned as timer indetificator, now you need to use FTimerHandle in argument. So insted of this:

GetWorldTimerManager().SetTimer(this, &AMatineeActor::CheckPriorityRefresh, 1.0f, true);

You do this:

FTimerHandle Handle;
GetWorldTimerManager().SetTimer(Handle, this, &AMatineeActor::CheckPriorityRefresh, 1.0f, true);

And insted of this:

GetWorldTimerManager().ClearTimer(this, &AMatineeActor::CheckPriorityRefresh);

You do this

GetWorldTimerManager().ClearTimer(Handle);

note that FTimerHandle Handle; should be placed in header file, one for each seperate timer if you want to remember them, if you lose handle that you used with set timer, you will lose control of a timer. But if you want fire and forget timer, you can use it as local variable.

Here you for API reference, those are always up to date:

1 Like

Thank you, C++ Is too complicated for me at this time. I did it in BP. Since there is limited 2D Vector artwork support in UE4, can you take a .svg rasterize it and texture an object with it? Is this also possible in BP?