Lbtg
Intermediate OT User
- Joined
- Nov 22, 2008
- Messages
- 2,323
- Reaction score
- 136
Hello im looking and need a script that every monster killed has chance to drop 1-11
I have 11 items that i want to put chances to get those items from killing any monster, depending on the monster health
Thats the most familiar script what i want:
Another try
Latest script + error:
Error:
What i want is that
You get chance to get
1 item 1-100chance
2 items 1-50 chance(random item from 2)
8 items 1 -25 chance (random item of 8)
I have 11 items that i want to put chances to get those items from killing any monster, depending on the monster health
Thats the most familiar script what i want:
Lua:
function onKill(creature, target)
local targetMonster = target:getMonster()
if not targetMonster then
return true
end
local MaxHP = target:getMaxHealth()
local suerte = math.random(1, 100)
local suerte2 = math.random(1, 150)
local suerte3 = math.random(1, 200)
if MaxHP >= 1500 then
if suerte3 >= 198 then
creature:addItem(6571, 1) -- super bolsa roja
return true
end
elseif MaxHP >= 200 then
if(creature:getLevel() <= 100) then
if suerte >= 99 then
creature:addItem(6570, 1) -- super bolsa azul
return true
end
else
if suerte2 >= 149 then
creature:addItem(6570, 1) -- super bolsa azul
return true
end
end
end
return true
end
Another try
Lua:
function onKill(creature, target)
local targetMonster = target:getMonster()
if not targetMonster then
return true
end
local RubyRare = math.random(1, 25)
local RubyEpic = math.random(1, 50)
local RubyLege = math.random(1, 100)
if RubyLege >= 100 then
creature:addItem(9971, 1) -- Gold ingot
return true
elseif RubyEpic >= 50 then
creature:addItem(7632, 1) -- shimmering pearl
return true
elseif RubyEpic >= 50 then
creature:addItem(7633, 1) -- shimmering pearl
return true
elseif RubyRare >= 25 then
creature:addItem(2151, 1) -- Talon
return true
elseif RubyRare >= 25 then
creature:addItem(2143, 1) -- white pearl
return true
elseif RubyRare >= 25 then
creature:addItem(2146, 1) -- small saphire
return true
elseif RubyRare >= 25 then
creature:addItem(2147, 1) -- small ruby
return true
elseif RubyRare >= 25 then
creature:addItem(2149, 1) -- small emerald
return true
elseif RubyRare >= 25 then
creature:addItem(2145, 1) -- small diamond
return true
elseif RubyRare >= 25 then
creature:addItem(2150, 1) -- small amethyst
return true
elseif RubyRare >= 25 then
creature:addItem(2144, 1) -- black pearl
return true
end
return true
end
Latest script + error:
Error:
Lua:
[Warning - Event::checkScript] Can not load script: scripts/others/rubys.lua
data/creaturescripts/scripts/others/rubys.lua:22: 'end' expected (to close 'if' at line 12) near 'elseif'
script:
Lua:function onKill(creature, target) local targetMonster = target:getMonster() if not targetMonster then return true end local RubyRare = math.random(1, 25) local RubyEpic = math.random(1, 50) local RubyLege = math.random(1, 100) if RubyLege >= 100 then creature:addItem(9971, 1) -- Gold ingot return true elseif RubyEpic >= 50 then creature:addItem(7632, 1) -- shimmering pearl return true else elseif RubyEpic >= 50 then creature:addItem(7633, 1) -- shimmering pearl return true elseif RubyRare >= 25 then creature:addItem(2151, 1) -- Talon return true else elseif RubyRare >= 25 then creature:addItem(2143, 1) -- white pearl return true else elseif RubyRare >= 25 then creature:addItem(2146, 1) -- small saphire return true else elseif RubyRare >= 25 then creature:addItem(2147, 1) -- small ruby return true else elseif RubyRare >= 25 then creature:addItem(2149, 1) -- small emerald return true else elseif RubyRare >= 25 then creature:addItem(2145, 1) -- small diamond return true else elseif RubyRare >= 25 then creature:addItem(2150, 1) -- small amethyst return true else elseif RubyRare >= 25 then creature:addItem(2144, 1) -- black pearl return true end return true end
Post automatically merged:
What i want is that
You get chance to get
1 item 1-100chance
2 items 1-50 chance(random item from 2)
8 items 1 -25 chance (random item of 8)
Last edited: