I’m trying to implement a realistic ammo management system similar to something like battlebit. However I don’t know how to go about it.
I know of the game, but I don’t know any of the details of its ammo mechanics. The details are what we need in order to help.
e.g. On reload current mag ammo is kept and only topped off vs discarding the mag and using a fresh mag.
Notes…
Ammo Count
should not be an array. Just a standard Int single.
You do not need to Loop to add ammo to a mag.
Refill count
= (Mag Size
- Current Mag Count
)
If (Ammo Count
>= Refill Count
):
Current Mag Count
= Mag Size
,
Ammo Count
= (Ammo count
- Refill count
)… clamp min 0
ELSE // Ammo count doesn’t have enough to fully fill the mag.
Current Mag Count
= (Current Mag Count
+ Ammo Count
),
Ammo Count
= 0