Para o item, no arquivo data/actions/actions.xml, adicione está tag:
<action itemid="ID-DA-BOX" event="script" value="RandomBox"/>
E depois vá em data/actions/scripts, crie um arquivo RandomBox.lua e coloque isto dentro dele:
local item_id = {12938, 12941, 12943, 12944} -- itens que podem vir
function onUse(cid, item, frompos, item2, topos)
local level = 10 -- level
if item.itemid == 12778 then -- id da box
if getPlayerLevel(cid) >= level then
local w = math.random (1,#item_id)
doPlayerAddItem(cid, item_id[w])
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Você abriu a random box, e ganhou ["..getItemNameById(item_id[w]).."]")
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid,"Somente level "..level.." ou mais pode abrir.")
end
return true
end
end
Já está explicadinho no próprio script como editar... =]


Creio que o drop do item só pode ser editado mesmo nos monster's um por um!!!


1º Passo - Copie 1 arquivo.xml da sua pasta data/npc e mude o nome para o nome que você, depois cole isso dentro dele:
-- Script Npc Task BY GuhPk
<?xml version="1.0" encoding="UTF-8"?>
<npc name="nomedonpc" script="arquivo.lua" walkinterval="350000" floorchange="0" speed="0">
<health now="150" max="150"/>
<look type="255" head="91" body="114" legs="86" feet="0"/>
Azul = nome do script.lua que você vai colocar na pasta data/npc/script.
Vermelho = nome do Npc.
Verde = roupa do seu npc, vou ver se tem tópico explicando como fazer, se tiver eu posto aqui, se não eu crio aqui posto.
http://www.xtibia.co...pcs-e-monstros/
==========================================================================================================================
2º Passo - Agora vai em data/npc/script copia qualquer arquivo.lua de la coloca o nome que você quizer (este nome vai colocar onde esta de azul no script acima) e cola isso dentro:
-- Script Npc Task By GuhPk --
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {20}
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
storage = 1 -- storage id
item = 1 -- coloca aqui o id do item que vai ter que ir buscar
quantiitem = 1 -- quantidade do item acima que precisa pegar
item2 = 1 -- id da box
quantiitem2 = 1 -- quantas box ganha
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onThingMove(creature, thing, oldpos, oldstackpos, item, itemEx)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Tchau.',cid)
focus = 0
talk_start = 0
talkState[talkUser] = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if getDistanceToCreature(cid) > 4 then
return false
end
if talkState[talkUser] ~= 3 then
msg = string.lower(msg)
end
if (msgcontains(msg, 'hi')) then
fala = "Hey, eu estou precisando urgentemente de x itens. Será que você poderia me ajudar?"
selfSay(fala,cid)
talkState[talkUser] = 1
elseif ( ( msgcontains(msg,"yes") or (msgcontains(msg,"sim") ) ) and talkState[talkUser] == 1 ) then
quest1 = getPlayerStorageValue(cid,storage)
if quest1 == 2 then
selfSay('Cara, você já me ajudou!',cid)
else
if quest1 ==1 then
selfSay('Bom! Então vc trouxe os meus itens? Deixe-me ver.',cid)
if doPlayerRemoveItem(cid, item, quantiitem) == true then
selfSay('Obrigado! Agora poderei fazer meu projeto. Aqui esta sua recompença!',cid)
doPlayerAddItem(cid,premio1,quant1)
talkState[talkUser] = 0
else
selfSay('Voce não trouxe os meus itens... Volte quando tive-los.',cid)
talkState[talkUser] = 0
end
else
selfSay('Me traga os itens para o meu projeto.',cid)
setPlayerStorageValue(cid,storage, 1)
end
end
elseif(msgcontains(msg, 'no')) then
talkState[talkUser] = 0
selfSay('Okay, obrigado mesmo assim.', cid)
elseif(msgcontains(msg, 'bye')) then
selfSay('Até mais!', cid)
talkState[talkUser] = 0
end
end
function onCreatureChangeOutfit(creature)
end










info
Grupo: Campones
Registrado: 29/11/08
Posts: 36
Reputação: +1
É o seguinte como todos sabem obviamente o natal está para chegar e eu queria implantar uma coisa bem legal no meu ot para o divertimento dos players, eu vi um sistema no ot radbr e queria colocar no meu ot é assim > o script seria assim
todos os monstros do jogo dropariam um santa claus doll (o boneco do papai noel) depois levasse ate um npc com roupa de papai noel onde o player poderia trocar o doll por uma caixa de presente e depois o player poderia abrir está caixa de presentes onde viria um premio aleatório.