Hi, I have a system for reloading and it works fine when I press R to reload, however can someone show me code on how to make it automatically call the function once ammo current is at 0?
Also I would like some guidance on how to create a prompt similar to most FPS games where if ammo is less than 5 for example, the game will create a UI simply saying “reload?”
I’ve attached my current code.
][1]
Thanks in advance.
the easiest method to auto reload would be to do a ammo check when firing the weapon. fire weapon event → decrement ammo → do fire wep script → check current ammo-> if less than 1 → call reload function. so the real question here is wheres the fire weapon event.
as for your second question, you can create a widget by doing the same kind of check as for the auto reload. you just need to ensure in this case that you have control in place so that you dont create many copies of the same widget. this is done in the below picture by promoting the widget to a variable and checking if the variable is valid.