Ir para conteúdo

Fazer Um Item Dropar De Todos Os Monstros


Killua

Posts Recomendados

o mock fes esse creaturescript de loot que fas 1 item dropar de todos os monstros com chanse

login

registerCreatureEvent(cid, "loot")

 

xml

<event type="kill" name="loot" event="script" value="loot.lua"/>  

 

script

--- Script by mock
local function find(pa)--- Script by mock
  for i=1,255 do
    pa.stackpos = i
    local corpse = getThingfromPos(pa)
 if isCorpse(corpse.uid) == TRUE then
    if isContainer(corpse.uid) == TRUE then
             return corpse.uid
       end
   end
end
return FALSE
end
local function getConteiner(item)--- Script by mock
  if isContainer(item.uid) == FALSE then
     return ""
  end
  local items = getItemName(item.uid)..": ("
  local g = doAddContainerItem(item.uid,2815,1)
  for i=1, getContainerCap(item.uid) do
      local k = getContainerItem(item.uid, i)
      if k.itemid ~= 0 then
         if isContainer(k.uid) == TRUE then
            items = items..getConteiner(k)..', '
            print('o0')
         else
            if k.type > 1 then
               items = items..k.type..'x '..getItemNameById(k.itemid).."s, "
            else
              items = items..getItemNameById(k.itemid)..", "
            end
         end
      end
  end
  items = items:sub(1,#items-2)..'.'
  doRemoveItem(g,-1)
  return items..')'
end
function getLoot(pa,cid,nam)--- Script by mock
     corpse = find(pa)
        if corpse == FALSE then
            return FALSE
        end                   
        local olda = getContainerCap(corpse)
        if olda < 3 then
           return FALSE
        end
           if math.random(1,50) < 6 then
     doAddContainerItem(corpse,8306,1)
     doSendMagicEffect( getThingPos(corpse) ,31)
  end
        local g = doAddContainerItem(corpse,2815,1)
     local str = 'Loot de '..nam..': ' 
     for i=1, getContainerCap(corpse) do
     	          local a = getContainerItem(corpse, i)
     	          if a.itemid ~= 0 then
     	             if isContainer(a.uid) == TRUE then
     	                str = str..getConteiner(a)..' , '
     	             else
     	                if a.type > 1 then
     	                   str = str..a.type..'x '..getItemNameById(a.itemid)..'s, '
     	                else
     	                   str = str..getItemNameById(a.itemid)..', '
     	                end
     	             end
                     end

        end
        doRemoveItem(g,-1)
        str = str:sub(1,#str-2)..'.'
        doPlayerSendTextMessage(cid, 23, str)
end

function onKill(cid, target)--- Script by mock
addEvent(getLoot,100,getCreaturePosition(target),cid,getCreatureName(target))
return 1
end

 

 

            if math.random(1,50) < 6 then
     doAddContainerItem(corpse,8306,1)
     doSendMagicEffect( getThingPos(corpse) ,31)

esse e o id do item e a chanse que ele vai dropar o item no monstro :p

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...