Ir para conteúdo

Posts Recomendados

ola! tenho essa script de npc que da itens diariamente, porem gostaria que ela virase a de um npc que pede

pra matar certos pokes nos dias da semana aleatorios . ex

monday matar 100 blastoise, 100 feraligatr, 100 gyarados or 100 charizard, 100 typholion, 100 magmar.

e apos o player terminar vai la pega o premio que sera como ta aleatorio dependendo do dia da seman

e tbm adicionar pro player ganhar exp apos terminar essa quest tbm.

segue a script do npc

 

 

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)

local config = {

storage = 45392,

exstorage = 40822,

days = {

["Monday"] = {

{itemid = 8839, count = math.random(1, 3)}

},

["Tuesday"] = {

{itemid = 2681, count = 1},

{itemid = 2682, count = 1},

{itemid = 2683, count = 1}

},

["Wednesday"] = {

{itemid = 2674, count = math.random(1, 10)},

{itemid = 2675, count = math.random(1, 10)},

{itemid = 2676, count = math.random(1, 10)},

{itemid = 2673, count = math.random(1, 10)}

},

["Thursday"] = {

{itemid = 2679, count = math.random(2, 15)},

{itemid = 2680, count = math.random(1, 5)}

},

["Friday"] = {

{itemid = 2788, count = math.random(1, 3)}

},

["Saturday"] = {

{itemid = 6393, count = 1}

},

["Sunday"] = {

{itemid = 2389, count = math.random(2, 12)},

{itemid = 2690, count = math.random(1, 5)}

}

}

}

 

local player = Player(cid)

local x = config.days[os.date("%A")]

if player:getStorageValue(config.storage) == tonumber(os.date("%w")) and player:getStorageValue(config.exstorage) > os.time() then

return player:sendCancelMessage("The chest is empty, come back tomorrow for a new reward.")

end

local c = math.random(#x)

local info = ItemType(x[c].itemid)

if x[c].count > 1 then

text = x[c].count .. " " .. info:getPluralName()

else

text = info:getArticle() .. " " .. info:getName()

end

local itemx = Game.createItem(x[c].itemid, x[c].count)

if player:addItemEx(itemx) ~= RETURNVALUE_NOERROR then

player:getPosition():sendMagicEffect(CONST_ME_POFF)

text = "You have found a reward weighing " .. itemx:getWeight() .. " oz. It is too heavy or you have not enough space."

else

text = "You have received " .. text .. "."

player:setStorageValue(config.storage, tonumber(os.date("%w")))

player:setStorageValue(config.exstorage, os.time() + 24*60*60)

end

player:sendTextMessage(MESSAGE_INFO_DESCR, text)

return true

end

 

Link para o comentário
https://xtibia.com/forum/topic/235087-modificar-script-npc-task/
Compartilhar em outros sites

  • 3 weeks later...
Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...