NPC Teleport pela storage (40911).
Subistitua pelo seu script:
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)
local pos = {x=1039, y=1072, z=7} -- Local da hunt
local posreturn = {x=1039, y=1072, z=7} -- Posiçao onde o player sera teleportado quando acabar o tempo
local money = 400000 --- Quanto de dinheiro sera removido
config = {
time = 1 ---Tempo que ele vai ficar na hunt sabendo que cada numeral equivale a um minuto-----
}
function doReturnPos()
doTeleportThing(cid, posreturn)
setGlobalStorageValue(cid, 24688, 0)
setGlobalStorageValue(cid, 24686, none)
setPlayerStorageValue(cid, 28680, 0)
end
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'chuunin') then
if getGlobalStorageValue(cid, 24688) == 1 then
doPlayerSendTextMessage(cid,22,"O player "..getGlobalStorageValue(24686).." esta fazendo o teste")
return true
end
if not doPlayerRemoveMoney(cid, money) then
doPlayerSendTextMessage(cid,22,""..getPlayerName(cid).." precisa de "..money.." para fazer o chuunin teste")
return true
end
if getPlayerStorageValue(cid, 40911) >= 1 then
doPlayerRemoveMoney(cid, money)
doPlayerSendTextMessage(cid,22,"Obrigado "..getPlayerName(cid).." foi teleportado.")
doTeleportThing(cid, pos)
setGlobalStorageValue(cid, 24688, 1)
setGlobalStorageValue(cid, 24686, getPlayerName(cid))
setPlayerStorageValue(cid, 28680, 1)
addEvent(doReturnPos, config.time*60*1000)
else
selfSay('Você não fez a missão necessária para fazer o teste.', cid)
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Abra a pasta data/npc/scripts e crie um arquivo chamado rankmission.lua
Adicione o script:
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
local items = {
[1] = {id = 1111, count = 50},
[2] = {id = 2222, count = 40},
[3] = {id = 3333, count = 30},
[4] = {id = 4444, count = 20}
}
if(msgcontains(msg, 'hi')) then
selfSay('Hello Little Ninja. Want to do the {mission}?', cid)
end
if(msgcontains(msg, 'mission')) then
selfSay('Tell {yes} to accept.', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerStorageValue(cid, 40911) >= 1 then
selfSay('You have done this mission.', cid)
return true
end
elseif getPlayerStorageValue(cid, 40911) <= 0 then
selfSay('Okay, bring me 50 blabla, 40 blabla, 30 blabla e 20 blablabla.', cid)
elseif getPlayerItemCount(cid, items[1].id) == items[1].count or getPlayerItemCount(cid, items[2].id) == items[2].count or getPlayerItemCount(cid, items[3].id) == items[3].count or getPlayerItemCount(cid, items[4].id) == items[4].count then
setPlayerStorageValue(cid, 40911, 1)
selfSay('Sure, you went to the next mission. Good Luck.', cid)
else
selfSay('You do not have the items.', cid)
end
return true
end
Edite o id e quantidade dos items que o player terá que entregar ao NPC em local items (id, count).
Edite também a parte:
selfSay('Okay, bring me 50 blabla, 40 blabla, 30 blabla e 20 blablabla.', cid)
Pela mensagem informativa dos items que o player precisará entregar ao NPC.
Agora na pasta data/npc crie um arquivo chamado Rank Missions.xml
Adicione o script:
<!--?xml version="1.0" encoding="UTF-8"?--> <npc name="Rank Mission" script="data/npc/scripts/rankmission.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"> <look type="253" head="50" body="78" legs="0" feet="33" addons="3"> </look></health></npc>
Para fazer outros NPC's, apenas mude a StorageID que o player receberá e os itens/quantidades.




info
Grupo: Cavaleiro
Registrado: 04/09/12
Posts: 185
Reputação: +2
Olá pessoal, gostaria de pedir um npc de missão assim:
Eu falo com ele "hi" "missao" "yes", aí ele me manda buscar algum item e etc...
Quando eu entregar o item pra ele, ele me da uma storage (40911 por exemplo).
Para continuar fazendo mais missões, gostaria de um outro npc que para falar com ele eu teria que ter a storage que eu recebi fazendo aquela primeira quest (storage 40911), e quando eu fizesse a missão ele me desse outra storage (40912 por exemplo). Para mim ir fazendo mais e mais npcs de missão. Se não for pedir muito eu tenho um npc aqui que leva o player para um lugar do mapa e o player só sai de la se acabar o tempo dele, logar ou morrer olhem ae
Se pudessem colocar pra ele verificar se o player tem a tal storage antes de teleportar o player eu agradeceria demais.
REP+ para quem conseguir
vlw.