Quote:
Originally Posted by mortovivo13
Quest Request
When player kill (x) mob , say hum.. well done and then give a random item from a list .
With percentage please!
Thank You!
|
Code:
quest killdrop begin
state start begin
function perc_chance(i)
return math.random() <= (i/100)
end
when kill with not npc.is_pc() begin
-- if npc.get_race() == 'HERE' then
local items = {
{19,killdrop.perc_chance(100)},
{29,killdrop.perc_chance(50)},
{39,killdrop.perc_chance(1)}
}
for i=1, table.getn(items), 1 do
if items[i][2] == true then
pc.give_item2(items[i][1], 1)
end
end
chat("hum..well done!")
-- end
end
end
end
I made you an example.
19,29,39 are the vnums. You can put there all itemvnums you want.
Put the percentage of items here: killdrop.perc_chance(HERE YOUR PERC)
You can add Items in the List with '{},'
Dont touch the rest.
If you want that players get the items only at some monsters,
delete '--' at line 7 and 19 and put monster vnum npc.get_race() == 'HERE'.
perc_chance - Funktion by Sensenmann, thanks for that.
MfG, .Various