local function isNormalPosition(pos)
local tile = getTileThingByPos(pos)
if(tile.uid > 0 and (not hasProperty(tile.uid, CONST_PROP_BLOCKINGANDNOTMOVEABLE) and not hasProperty(tile.uid, CONST_PROP_BLOCKPATHFIND)) and (not getTileInfo(pos).protection)) then
return true
end
return false
end
function onDeath(cid, corpse, deathList)
local name = string.lower(getCreatureName(cid))
if(name == "rat") then -- change for boss name
local all_positions = {}
local centerPos = getCreaturePosition(cid)(cid)
for i = -7, 7 do
for j = -7, 7 do
table.insert(all_positions, {x=centerPos.x + i, y=centerPos.y + j, z=7})
end
end
local tokens = 0
while(tokens < 3) do
local pos = all_positions[math.random(1,#all_positions)]
if(isNormalPosition(pos)) then
doCreateItem(2150, 1, pos) --- change items id here
doSendMagicEffect(pos, CONST_ME_TUTORIALARROW)
tokens = tokens + 1
end
end
local coins = 0
while(coins < 30) do
local pos = all_positions[math.random(1,#all_positions)]
if(isNormalPosition(pos)) then
doCreateItem(2157, math.random(20,35), pos) --- change items id here and chance
doSendMagicEffect(pos, CONST_ME_EXPLOSIONAREA)
coins = coins + 1
end
end
for i = 1, 10 do
local pos = all_positions[math.random(1,#all_positions)]
if(isNormalPosition(pos)) then
if(math.random(1,3) == 2) then
doCreateItem(9020, 1, pos) --- change items id here
end
doSendMagicEffect(pos, CONST_ME_TUTORIALARROW)
doSendMagicEffect(pos, CONST_ME_EXPLOSIONAREA)
end
end
local pos = all_positions[math.random(1,#all_positions)]
if(isNormalPosition(pos)) then
if(math.random(1,2) == 2) then
doCreateItem(ITEM_DONATION_COIN, 1, pos) --- change items id here
end
doSendMagicEffect(pos, CONST_ME_EXPLOSIONAREA)
doSendMagicEffect(pos, CONST_ME_TUTORIALARROW)
end
doBroadcastMessage("add msg do you want!", MESSAGE_STATUS_WARNING)
end
return true
end