Ok, I think there's some concept I'm missing here.
This is the script I have thus far:
function got_item(_item_missile_launcher, ...)
if(count_item(0, _item_missile_launcher) > 1) then
remove_item (0, _item_missile_launcher)
add_item(0, _item_missile_launcher_magazine)
add_item(0, _item_assault_grenade_magazine)
end
end
This is the first Lua I've ever written so I'm sure it's full of problems; let me know about them.
It appears to function OK in game, except that the magazines don't actually *appear* in the inventory. I walk over a second Havoc Rifle (which is the weapon that uses the Missile Launcher item), and another isn't added to my inventory (i.e. the displayed Havoc Rifle count is still 1), but my inventory doesn't show any new ammo added. However, I can spend the first Rifle's clip, and it will do it's reloading sequence and come back with another clip and when that is spent, stop firing. So it behaves as though I had got another clip, but doesn't actually show it in my inventory.
I had something simiilar going for the Ouranus Fusion Cannon, which replaces the Fusion Pistol, and it actually displayed new inventory items. I already had some Fusion Batteries though, that might make a difference. However, combining both that bit of code and the above bit of code seems to produce odd effects, and at several points I was getting some error about C Buffer Overflows printing out in the upper-left corner.
But, I get the feeling all of this is because I'm somehow approaching this whole thing wrong somehow. I'm so in the dark I don't even know how to troubleshoot this. Could you maybe help clear things up a bit?