Ir para conteúdo

Featured Replies

Postado
  Em 01/06/2016 em 14:39, Yamborghini disse:

Galera do TibiaKing, esse sistema não é de autoria minha. Só estou trazendo esse sistema de outro Fórum.

Acho que vai ajudar muito aos OT-ADMIN de poketibia, então Rep+ ai

 

Olá! O sistema funciona com Poketibia e Tibia! Vamos deixar de enrolação e adicionar o sistema!

Lembrando também que funciona com tfs 0.3.6 e tfs 0.4! Não testei com tfs 1.x mas acho que não funciona.

 

Vá em creaturescripts.xml e adicione isso:

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

No login.lua adiciona isso com os demais:

 

registerCreatureEvent(cid, "KillTask")

Agora crie um arquivo chamado task.lua e adicione isso:

 

local tasksss = {
   [1] = {name = "Blastoise",  sto = 10212, count = 3, time_sto = 5457, time = 1*24*60*60, sto_count = 14129, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},
   [2] = {name = "Charizard",  sto = 10213, count = 5, time_sto = 5458, time = 1*24*60*60, sto_count = 14130, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},
}

function onKill(cid, target)
        for _, t in ipairs(tasksss) do
            local total_count = t.count
            local m_sto = t.sto
            local count_sto = t.sto_count
            if getPlayerStorageValue(cid, m_sto) ~= -1 then
                if getCreatureName(target) == t.name then
                	if (total_count - getPlayerStorageValue(cid, count_sto)) == 1 then
                		setPlayerStorageValue(cid, count_sto, getPlayerStorageValue(cid, count_sto) + 1)
                    	doPlayerSendTextMessage(cid, 20, "You are killed ".. getPlayerStorageValue(cid, count_sto) .." " .. t.name .. " and finished the task!")
                    	return true
                    elseif (total_count - getPlayerStorageValue(cid, count_sto)) >= 1 then
                        setPlayerStorageValue(cid, count_sto, getPlayerStorageValue(cid, count_sto) + 1)
                        doPlayerSendTextMessage(cid, 20, "You are killed ".. getPlayerStorageValue(cid, count_sto) .." of ".. total_count .." " .. t.name .. " kills to finish the task.")
                        return true
                    end
                end
            end
        end
    return true
end

Agora vá em npc/scripts e crie um arquivo chamado task.lua e adicione isso:

 

local tasksss = {
   [1] = {name = "Blastoise",  sto = 10212, count = 3, time_sto = 5457, time = 1*24*60*60, sto_count = 14129, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},
   [2] = {name = "Charizard",  sto = 10213, count = 5, time_sto = 5458, time = 1*24*60*60, sto_count = 14130, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},
}

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
    value = -1
    for i = 1, #tasksss do
        if msgcontains(msg, tasksss[i].name) and not value ~= -1 then
            value = i
        end
    end
    if value == -1 then
        selfSay('I don\'t have a this task!', cid)
        talkState[talkUser] = 0
        return true
    end
    local configss = tasksss[value]
    local name = configss.name
    local m_sto = configss.sto
    local time_sto = configss.time_sto
    local count_sto = configss.sto_count
    local total_count = configss.count
    local rest = total_count - getPlayerStorageValue(cid, count_sto)
        if getPlayerStorageValue(cid, time_sto) < os.time() then -- verifica se o player ainda está no prazo
            if getPlayerStorageValue(cid, m_sto) <= 0 then -- verifica se o player não pegou está task
                selfSay('Ready! Now you need kill a '.. total_count .. ' '.. name .. '!', cid)
                setPlayerStorageValue(cid, m_sto, 1)
                setPlayerStorageValue(cid, total_count, 0)
                talkState[talkUser] = 0               
            else
                if rest <= 0 then -- Verifica se o player matou todos os monstros nescessários
                    doPlayerAddItem(cid, configss.rewardid, configss.rewardcount)
                    setPlayerStorageValue(cid, count_sto, 0) 
                    setPlayerStorageValue(cid, m_sto, -1) 
                    setPlayerStorageValue(cid, time_sto, os.time() + configss.time)
                    doPlayerAddExperience(cid, configss.rewardexp)
                    doSendAnimatedText(getCreaturePosition(cid), configss.rewardexp, 215)
                    selfSay(configss.text, cid) 
                    talkState[talkUser] = 0
                else
                    selfSay('You need to kill '..rest..' '..name..' to gain a reward.', cid)
                    talkState[talkUser] = 0
                end
            end
        else
            selfSay('You already did this task, player. Wait '..math.ceil((getPlayerStorageValue(cid, time_sto) - os.time())/(60*60))..' hours to do it again.', cid)
            talkState[talkUser] = 0
        end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Pronto, agora volte para a pasta npc e crie um novo arquivo .xml chamado de Task e adicione isso lá:

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Npc Nome" script="task.lua" walkinterval="350000" floorchange="0" speed="0">
	<health now="150" max="150"/>
	<look type="369" head="91" body="102" legs="83" feet="0"/>
	<parameters>
			<parameter key="message_greet" value="You want gain a task of {Blastoise}?"/>
	</parameters>
</npc>

Pronto, agora o sistema de task está funcionando, e para adicionar um novo monstro pra fazer a task? Basta editar a tabela, mas não esqueça que tem que atualizar a tabela nos 2 scripts .lua !!

 

local tasksss = {
   [1] = {name = "Blastoise",  sto = 10212, count = 3, time_sto = 5457, time = 1*24*60*60, sto_count = 14129, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},
   [2] = {name = "Charizard",  sto = 10213, count = 5, time_sto = 5458, time = 1*24*60*60, sto_count = 14130, money = 100, rewardid = 7621, rewardcount = 100, rewardexp = 10000,  text = "Congratulations! You finished this task. In 24h, you will be able to do it again."},
}

Para configurar siga as seguintes instruções:

Mostrar conteúdo oculto

 

Créditos pelo Sistema: 

Criador: @miguel223

Drazyn1291 -- Editou e reformulou muita coisa!

 

[16/01/2020 14:04:38] [Error - LuaScriptInterface::loadFile] data/npc/scripts/task.lua:1: unexpected symbol near 'ï'
[16/01/2020 14:04:38] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/task.lua
[16/01/2020 14:04:38] data/npc/scripts/task.lua:1: unexpected symbol near 'ï'

 

 

5a510dabc5375_20228663_336082076822153_8453189641140183581_n-Cpia-Cpia.jpg.ae93894455bf828fc6901b29d7395cd9.jpg

https://www.facebook.com/groups/659018184245665/

5a510e4f9a582_20228663_336082076822153_8453189641140183581_n-Cpia-Cpia.jpg.fa86c37be79982f1cc8ff619015ddd1b.jpg

https://www.facebook.com/profile.php?id=133706320308745

 

  • 7 months later...
  • Respostas 6
  • Visualizações 4.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Postado

Muito bom, uma dúvida

Se eu quisesse fazer com que mais de um monstro contabilizasse a task, como eu faria isso?

Tipo gostaria de uma task mas queria incluir vários monstros de um só tipo, ai o player poderia matar qualquer um deles e iria contar junto a task

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo