Ammo is not picked up if character spends ammo at the pickup respawn point
Problem
Get up to the pickup respawn point with full ammo
Shoot (one shot is enough)
Pickup can't be taken
Solution
Create an array of pointers to
APawn
in the base pickup:
In
NotifyActorBeginOverlap
, if it was not possible to take the pickup, we add the pointer to the pawn to the array:
In tick function (you can also make a custom timer), iterate through the array and see if we can give someone a pickup from the saved pointers in the array, and if we can, then we give it to:
Override the
NotifyActorEndOverlap
function (which is called, as you might guess, when the actor exits the collision) and in it we remove the pawn pointer from the array:
Last updated
Was this helpful?