Ir para conteúdo
  • 0

Task contando no Default


williamserravalle

Pergunta

Bom dia galera como o nome do topico ja diz e isso eu tenho um system task aki , e eu queria que ele contasse no default quando o player fosse matando os bicho. agradecido desde ja.

 

Creaturescript.lua

 

 

-- Script por Killua, antigo amoeba13 --

function onKill(cid, target, lastHit)

if not isMonster(target) or not isPlayer(cid) then
return true
end

for _, tasks in pairs(amoebaTask) do
if isInArray(tasks.creatures, getCreatureName(target)) then
if taskKills(cid, tasks.storagecount) < tasks.count then
doPlayerSetStorageValue(cid, tasks.storagecount, taskKills(cid, tasks.storagecount)+1)
break
end
else
end
end
return true
end

 

 

 

Esse aki fica na pasta lib

 

 

-- Script feito por Killua, antigo amoeba13 --

amoebaTask = {
{nome = "Adept Of The Cult", creatures = {"Adept Of The Cult"}, storage = 2312112, storagecount = 890120, count = 300, exp = 0,money = 0,premios = {{11296, 1}}},
{nome = "Bog Raider", creatures = {"Bog Raider"}, storage = 2312113, storagecount = 890121, count = 300, exp = 0,money = 0,premios = {{11295, 1}}},
{nome = "Chakoya Windcaller", creatures = {"Chakoya Windcaller"}, storage = 2312114, storagecount = 890122, count = 300, exp = 0,money = 0,premios = {{11298, 1}}},
{nome = "Wyrm", creatures = {"Wyrm"}, storage = 2312115, storagecount = 890123, count = 300, exp = 0,money = 0,premios = {{11297, 1}}},

{nome = "Spider Pet", creatures = {"Spider"}, storage = 2312116, storagecount = 890124, count = 440, exp = 0,money = 0,premios = {{9007, 1}}},
{nome = "Bug Pet", creatures = {"Bug"}, storage = 2312117, storagecount = 890125, count = 990, exp = 0,money = 0,premios = {{10530, 1}}},
{nome = "Cobra Pet", creatures = {"Cobra"}, storage = 2312118, storagecount = 890126, count = 1100, exp = 0,money = 0,premios = {{12612, 1}}},
{nome = "Mummy Pet", creatures = {"Mummy"}, storage = 2312119, storagecount = 890127, count = 2200, exp = 0,money = 0,premios = {{11201, 1}}},
{nome = "Toad Pet", creatures = {"Toad"}, storage = 2312120, storagecount = 890128, count = 3300, exp = 0,money = 0,premios = {{11205, 1}}},
{nome = "Baby Dragon Pet", creatures = {"Baby Dragon"}, storage = 2312121, storagecount = 890129, count = 4400, exp = 0,money = 0,premios = {{5791, 1}}},
{nome = "Orc rider Pet", creatures = {"Orc rider"}, storage = 2312122, storagecount = 890130, count = 5500, exp = 0,money = 0,premios = {{11393, 1}}},
{nome = "Medusa Pet", creatures = {"Medusa"}, storage = 2312123, storagecount = 890131, count = 6600, exp = 0,money = 0,premios = {{10542, 1}}},
{nome = "Sea serpent Pet", creatures = {"Sea serpent"}, storage = 2312124, storagecount = 890132, count = 7700, exp = 0,money = 0,premios = {{10529, 1}}},
{nome = "Ferumbras Pet", creatures = {"Ferumbras"}, storage = 2312125, storagecount = 890132, count = 8800, exp = 0,money = 0,premios = {{11391, 1}}},
{nome = "Ghastly dragon Pet", creatures = {"Ghastly dragon"},storage = 2312126, storagecount = 890133, count = 9900, exp = 0,money = 0,premios = {{11360, 1}}},
{nome = "Triple Medusa Pet", creatures = {"Triple Medusa"}, storage = 2312127, storagecount = 890134, count = 10000, exp = 0,money = 0,premios = {{10543, 1}}},
{nome = "Souleater Pet", creatures = {"Souleater"}, storage = 2312128, storagecount = 890135, count = 11000, exp = 0,money = 0,premios = {{12596, 1}}}
}


function taskKills(cid, storage)
kills = getPlayerStorageValue(cid, storage)
if kills < 0 then
kills = 0
end
return kills
end

 

 

Npc

 

 

-- Script por Killua, antigo Amoeba13 --

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid

for varm, tasks in pairs(amoebaTask) do
local msg = string.lower(msg)
if isInArray(tasks.nome, msg) then
if getPlayerStorageValue(cid, tasks.storage) == -1 then
if getPlayerStorageValue(cid, tasks.storagecount) == tasks.count then
local esperiencia = tasks.exp > 0 and "" ..tasks.exp.. " exp e " or ""
local dineiro = tasks.money > 0 and "" .. tasks.money .. " gold coins e " or ""
selfSay("Voce conseguiu completar a task de ".. tasks.nome .. ", parabens! Eu vou te dar " .. esperiencia .. "" .. dineiro .."alguns itens como recompensa.", cid)
doPlayerAddExperience(cid, tasks.exp)
doPlayerAddMoney(cid, tasks.money)
doPlayerSetStorageValue(cid, tasks.storage, 1)
for juba, prize in pairs(tasks.premios) do
doPlayerAddItem(cid, prize[1], prize[2])
end
else
selfSay("Desculpe, mas voce ainda nao matou todos os " .. tasks.nome .. "s. Voce so matou " .. taskKills(cid, tasks.storagecount) .. " de " .. tasks.count .. " " .. tasks.nome .. "s.", cid)
break
end
else
selfSay("Voce so pode recber uma vez o premio de cada task.", cid)
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

adiciona isso embaixo do doPlayerSetStorageValue

doPlayerSendTextMessage(cid, 20, "Killed ".. getCreatureName(target) .."s [".. getPlayerStorageValue(cid, tasks.storagecount) .."/"..tasks.count .."].")
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...