Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Galera tenho script de promotion por task o mesmo quando for completada as task o player consegue uma nova vocaçao mais to com um problema gostaria de que apenas player lvl 400 que poderiam começar a task exmplo ao completar lvl 400 eles vao no npc e comessam a missao... 

e tbm o npc nao esta dando a vocaçao desejada...

 

 

 

local tasks =

{
[1] = {questStarted = 1539, questStorage = 65029, killsRequired = 200, raceName = "Demons", rewards = {{enable = true, type = "storage", values = {65535, 1}}}}
}
 
local rankStorage = 32150
local storage = 64521
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local voc = {}
 
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)
 
local s = getCreatureStorage(cid, storage)
 
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
if msgcontains(msg, "task") then
 
if(s < 1) then
doCreatureSetStorage(cid, storage, 1)
s = getCreatureStorage(cid, storage)
end
 
if(getCreatureStorage(cid, rankStorage) < 1) then
doCreatureSetStorage(cid, rankStorage, 0)
end
 
if tasks then
if(getCreatureStorage(cid, tasks.questStarted) < 1) then
if(getCreatureStorage(cid, tasks.creatureStorage) < 0) then
doCreatureSetStorage(cid, tasks.creatureStorage, 0)
end
 
if(getCreatureStorage(cid, tasks.questStorage) < 0) then
doCreatureSetStorage(cid, tasks.questStorage, 0)
end
 
doCreatureSetStorage(cid, tasks.questStarted, 1)
selfSay("You have started the task number " .. getPlayerStorageValue(cid, storage) .. ", in this task you need to kill " .. tasks.killsRequired .. " " .. tasks.raceName .. ".", cid)
else
selfSay("You are currently making the task about " .. tasks.raceName .. ", task number " .. getPlayerStorageValue(cid, storage) .. ".", cid)
end
else
print("[Warning - Error::Killing in the name of::Tasks config] Something is wrong.")
end
 
elseif msgcontains(msg, "report") then
if tasks and tasks.questStarted > 0 then
if(getCreatureStorage(cid, tasks.creatureStorage) < 0) then
doCreatureSetStorage(cid, tasks.creatureStorage, 0)
end
 
if(getCreatureStorage(cid, tasks.questStorage) < 0) then
doCreatureSetStorage(cid, tasks.questStorage, 0)
end
 
if(getCreatureStorage(cid, tasks.questStorage) >= tasks.killsRequired) then
for i = 1, table.maxn(tasks.rewards) do
if(tasks.rewards.enable) then
if isInArray({"vocation", "demon", 1}, tasks[1].rewards.type) then
doPlayerSetVocation(cid, 21)
elseif isInArray({"storage", "stor", 5}, tasks.rewards.type) then
doCreatureSetStorage(cid, tasks.rewards.values[1], tasks.rewards.values[2])
elseif isInArray({"points", "rank", 2}, tasks.rewards.type) then
doCreatureSetStorage(cid, rankStorage, getCreatureStorage(cid, rankStorage) + tasks.rewards.values)
else
print("[Warning - Error::Killing in the name of::Tasks config] Bad reward type: " .. tasks.rewards.type .. ", reward could not be loaded.")
end
end
end
local rank = getCreatureStorage(cid, rankStorage)
selfSay("Great!... you have finished the task number " .. s .. "" .. (rank > 4 and ", you are a " or "") .. "" .. (((rank > 4 and rank < 10) and ("Huntsman") or (rank > 9 and rank < 20) and ("Ranger") or (rank > 19 and rank < 30) and ("Big Game Hunter") or (rank > 29 and rank < 50) and ("Trophy Hunter") or (rank > 49) and ("Elite Hunter")) or "") .. ". Good job.", cid)
doCreatureSetStorage(cid, storage, s + 1)
else
selfSay("Current " .. getCreatureStorage(cid, tasks.questStorage) .. " " .. tasks.raceName .. " killed, you need to kill " .. tasks.killsRequired .. ".", cid)
end
else
selfSay("You do not have started any task.", cid)
end
end
return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

@nookia


Valendo REP+++

Editado por vinicios thiago (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
local tasks =
{
[1] = {questStarted = 1539, questStorage = 65029, killsRequired = 200, raceName = "Demons", rewards = {{enable = true, type = "storage", values = {65535, 1}}}}
}


local rankStorage = 32150
local storage = 64521


local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local voc = {}


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)


local s = getCreatureStorage(cid, storage)


if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
if msgcontains(msg, "task") then


if(s < 1) then
doCreatureSetStorage(cid, storage, 1)
s = getCreatureStorage(cid, storage)
end


if(getCreatureStorage(cid, rankStorage) < 1) then
doCreatureSetStorage(cid, rankStorage, 0)
end


if tasks[s] then
if(getCreatureStorage(cid, tasks[s].questStarted) < 1) then
if(getCreatureStorage(cid, tasks[s].creatureStorage) < 0) then
doCreatureSetStorage(cid, tasks[s].creatureStorage, 0)
end


if(getCreatureStorage(cid, tasks[s].questStorage) < 0) then
doCreatureSetStorage(cid, tasks[s].questStorage, 0)
end
if getPlayerLevel(cid) < 400 then 
selfSay("You need be level 400.", cid)
return false
end
doCreatureSetStorage(cid, tasks[s].questStarted, 1)
selfSay("You have started the task number " .. getPlayerStorageValue(cid, storage) .. ", in this task you need to kill " .. tasks[s].killsRequired .. " " .. tasks[s].raceName .. ".", cid)
else
selfSay("You are currently making the task about " .. tasks[s].raceName .. ", task number " .. getPlayerStorageValue(cid, storage) .. ".", cid)
end
else
print("[Warning - Error::Killing in the name of::Tasks config] Something is wrong.")
end


elseif msgcontains(msg, "report") then
if tasks[s] and tasks[s].questStarted > 0 then
if(getCreatureStorage(cid, tasks[s].creatureStorage) < 0) then
doCreatureSetStorage(cid, tasks[s].creatureStorage, 0)
end


if(getCreatureStorage(cid, tasks[s].questStorage) < 0) then
doCreatureSetStorage(cid, tasks[s].questStorage, 0)
end


if(getCreatureStorage(cid, tasks[s].questStorage) >= tasks[s].killsRequired) then
for i = 1, table.maxn(tasks[s].rewards) do
if(tasks[s].rewards[i].enable) then
if isInArray({"vocation", "demon", 1}, tasks[1].rewards[i].type) then
doPlayerSetVocation(cid, 21)
elseif isInArray({"storage", "stor", 5}, tasks[s].rewards[i].type) then
doCreatureSetStorage(cid, tasks[s].rewards[i].values[1], tasks[s].rewards[i].values[2])
elseif isInArray({"points", "rank", 2}, tasks[s].rewards[i].type) then
doCreatureSetStorage(cid, rankStorage, getCreatureStorage(cid, rankStorage) + tasks[s].rewards[i].values)
else
print("[Warning - Error::Killing in the name of::Tasks config] Bad reward type: " .. tasks[s].rewards[i].type .. ", reward could not be loaded.")
end
end
end
local rank = getCreatureStorage(cid, rankStorage)
selfSay("Great!... you have finished the task number " .. s .. "" .. (rank > 4 and ", you are a " or "") .. "" .. (((rank > 4 and rank < 10) and ("Huntsman") or (rank > 9 and rank < 20) and ("Ranger") or (rank > 19 and rank < 30) and ("Big Game Hunter") or (rank > 29 and rank < 50) and ("Trophy Hunter") or (rank > 49) and ("Elite Hunter")) or "") .. ". Good job.", cid)
doCreatureSetStorage(cid, storage, s + 1)
else
selfSay("Current " .. getCreatureStorage(cid, tasks[s].questStorage) .. " " .. tasks[s].raceName .. " killed, you need to kill " .. tasks[s].killsRequired .. ".", cid)
end
else
selfSay("You do not have started any task.", cid)
end
end
return true
end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Ando devagar, porque já tive pressa. E levo esse sorriso, porque já chorei demais...

________________________________________________________________________________

Minhas Sprites:

Mega Metagross

Mega Abomasnow

Pack de Shinys

[Posso atualizá-lo com novos shinys a qualquer momento]

Tutoriais:

[Completo] Criando e adicionando um novo Pokémon

[Actions] Criando quest no RME

Editores Lua/Xml/Sync Entre outros:

Editores Win/Mac/Linux

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo