| In Response To: Re: Lua script question (Forrest of B.org)
: 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
:
got_item will be called for any item you walk over; and which item you walked over will be passed in as the first argument, so you want something like this:
function got_item (item, player)
if item == _item_missile_launcher then
if count_item (player, _item_missile_launcher) > 1 then
remove_item(player, _item_missile_launcher)
add_item(player, _item_missile_launcher_magazine)
add_item(player, _item_assault_grenade_magazine)
end
elseif item == _item_plasma_pistol then
etc.
So, you should only have one got_item function, that handles all the different items. I think that should fix your C buffer problem thingie.
Make sure the player who gets the item gets the ammo; if you just give all the ammo to player 0 in a co-op game it would be weird :)
As far as ammo not appearing if you don't already have some--it may be an engine bug. Do a little more investigation, if it looks like Aleph One screwing up, file on SF, hopefully it won't be too hard to fix.
|