You would need a script using a variable for the pickups.
Then increment the variable by one for the ammo pickups, while also checking that variable in the ammo pickup script to prevent the pickup if var >= x
Checking the value before the increment would work best, so do the increment when you allow the pickup, and do not increment it if denying them.
You would also need to check for the user pressing the R key, and decrement the variable when they reload the weapon.
You would want to check for the key release (scancodekeypressed=0) after checking for them pressing the R key (scancodekeypressed=19) before decrementing.
That way it would not subtract more than one from the variable each time they reload.
You would also need to know their current ammo level to prevent subtracing anything from the variable if the reload key is pressed when the ammo is full.
Partial reloads (when clip is not empty) would foul the count up though.
Not sure if there is a variable for the ammo level available in the FPI, because I have been away for awhile and my FPI scripting conditions/actions knowledge is not up to date.
I think it was added in awhile back, but not sure if it was or not.
I guess I need to go look.
EDIT
It looks like they now have a
plrisusingreload condition now.
That is much better than using the R key method, just in case they are using a different key or joystick for reloading.
Sweet
I don't see any condition that can read the value of internal variable used for the player's ammo
I guess there is an internal variable for each weapon slot's ammo level, but I see no FPI condition to read them.
It would be nice if we only had access to the variable for the current slot being used (one used for ammo count display)
No real need to read the ones not being used or for having any actions for changing them, but it would be nice to know the ammo level of the current weapon.
Maybe that will be coming in reloaded, if we are lucky.
Maybe I was dreaming, but I could have sworn I caught mention of a condition like that somewhere.