/-/S'pht-Translator-Active/-/


Re: Lua script question
Posted By: treellamaDate: 7/21/06 3:38 a.m.

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.













[ Post a Reply | Message Index | Read Prev Msg | Read Next Msg ]
Pre-2004 Posts

Replies:

Lua script questionForrest of B.org 7/18/06 5:42 p.m.
     Re: Lua script questionBob-B-Q 7/19/06 4:22 a.m.
     Re: Lua script questiontreellama 7/19/06 5:03 a.m.
           Re: Lua script questionForrest of B.org 7/19/06 6:42 a.m.
                 Re: Lua script questiontreellama 7/19/06 8:56 a.m.
                       Re: Lua script questionForrest of B.org 7/19/06 9:49 a.m.
                             Re: Lua script questiontreellama 7/19/06 11:03 a.m.
                                   Re: Lua script questionblake37 7/19/06 2:30 p.m.
                                         Re: Lua script questiontreellama 7/19/06 3:02 p.m.
                                               Re: Lua script questionblake37 7/20/06 3:05 a.m.
                                   Re: Lua script questionForrest of B.org 7/20/06 7:42 p.m.
                                         Re: Lua script questionblake37 7/21/06 2:03 a.m.
                                               Re: Lua script questionForrest of B.org 7/22/06 2:40 p.m.
                                                     Re: Lua script questionblake37 7/22/06 3:10 p.m.
                                         Re: Lua script questiontreellama 7/21/06 3:38 a.m.
                                               Re: Lua script questionForrest of B.org 7/22/06 3:54 p.m.

[ Post a Reply | Message Index | Read Prev Msg | Read Next Msg ]
Pre-2004 Posts

 

 

Your Name:
Your E-Mail Address:
Subject:
Message:

If you'd like to include a link to another page with your message,
please provide both the URL address and the title of the page:

Optional Link URL:
Optional Link Title:

If necessary, enter your password below:

Password:

 

 

Problems? Suggestions? Comments? Email maintainer@bungie.org

Marathon's Story Forum is maintained with WebBBS 5.12.