>>3246292
You'd need to start checking based upon what the calling actor has so use
http://zdoom.org/wiki/CheckInventory
compare that to
http://zdoom.org/wiki/GetMaxInventory
then based upon what that returns, give the player however much of the item, and if you want to drop leftover items use
http://zdoom.org/wiki/DropItem
from the inventory item before it's removed, probably in a loop to spawn however much of the default actor amount the remainder is divisible by, since if you set a single item to have different than normal amount the script if used on it again won't be able to differentiate the shell with 9 shells from a normal 4 shells.
Probably the best way to keep track of how much goes into each item would be to either have a map level 2d string array that has classnames in first part and second is numbers, then use one of the string number parsers (like in commonFuncs.h) to convert to number, or to just write one yourself, or have two separate arrays that have the corresponding data in the same location in each array.
So either
str ammo[4][2] = {
{ "Clip", "10" },
{ "ClipBox", "50" },
{ "Shell", "4" },
{ "ShellBox", "20" }, };
or
str ammo_name[4] = { "Clip", "Clipbox", "Shell", "Shellbox" };
str ammo_amt[4] = {10, 50, 4, 20 };
Keep in mind you'd also have to account for the skill's DropAmmoFactor, and there's no built in function to do this.
If you're doing this for vanilla or your own mod or whatever then just checking skill with
http://zdoom.org/wiki/GameSkill
and then determining dropammofactor from there should be sufficient, if you're doing it for universal compatibility this gets more complicated.
Added the above to the end of the pastebin so you can find it again easily. I gotta head out now so I probably won't see anything until like 9-10am tomorrow.