MORTE 78 Posted March 28, 2015 Share Posted March 28, 2015 local itens = { {50615, 1},{50616, 1},{50617, 1},{31062, 1},{27993, 4},{27992, 4},{27994, 4}, {53022, 1},{71018, 1},{71019, 1},{71020, 1},{30183, 1},{30319, 1},{72703, 1}, {72704, 1},{72706, 1},{72705, 1},{71035, 1},{71102, 5},{27874, 5} } pc.give_item2(itens[math.random(1,20)][1], itens[1][2]) example : {27874, 5} was to leave 5 units in this case but leaves only one and do not know what's wrong can someone help me? Link to comment Share on other sites More sharing options...
Denis 1474 Posted March 28, 2015 Share Posted March 28, 2015 local items = { {50615, 1},{50616, 1},{50617, 1},{31062, 1},{27993, 4},{27992, 4},{27994, 4}, {53022, 1},{71018, 1},{71019, 1},{71020, 1},{30183, 1},{30319, 1},{72703, 1}, {72704, 1},{72706, 1},{72705, 1},{71035, 1},{71102, 5},{27874, 5} } local entry = math.random(1,table.getn(items)) pc.give_item2(items[entry][1],items[entry][2]) I didn't understood very well what you wrote so I guess that's what you want. Link to comment Share on other sites More sharing options...
newja 53 Posted March 28, 2015 Share Posted March 28, 2015 He said that {item_id, count} doesn't work in his table. Solution is easy. local index = { [1] = {1111, 5}, [2] = {2222, 4}, [3] = {3333, 3}, } local idx = index[1] syschat("Item ID: ".. idx[1]) syschat("Count: "..idx[2]) Link to comment Share on other sites More sharing options...
Aurora 46 Posted March 28, 2015 Share Posted March 28, 2015 I use this maybe this will help you local s = math.random(1,2) if s == 1 then pc.give_item2(vnum,1) elseif s == 2 then pc.give_item2(vnum,1) Link to comment Share on other sites More sharing options...
JachuPL 308 Posted March 28, 2015 Share Posted March 28, 2015 it depends on flag value of item - some items can be stacked (in example potions, arrows) some are not (in ex. pearls, blessing scrolls) Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now