Fala MelloGang Blz ? Hoje vim trazer um NPC de evento , onde o player precisa trazer um pokemon(configuravel) por outro pokemon entao vamos la
Em NPC crie um NPC.xml e cole isso
<?xml version="1.0" encoding="UTF-8"?>
<npc name="NPC NAME" script="EventoNPC.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="2144" head="90" body="97" legs="114" feet="94"/>
<parameters>
<parameter key="message_greet" value="Ola, |PLAYERNAME|. estou aqui para lhe dar uma missao, eu erei precisar pikachu para completar minha colecao, voce tem esses items? diga {missao}."/>
<!-- <parameter key="message_greet" value="Ola, |PLAYERNAME|. Safari ainda nao esta aberta"/> -->
</parameters>
</npc>
Dps Vá em npc/script e crie um arquivo.lua e cole isso
-
--Marshmello
local cfg = {
btype = "Cherish", --Type Da ball
pokemonida = "Pikachu", -- Pokemon que o NPc vai pedir a troca
pokemonVolta = "Pikachu Fly", -- Pokemon que o player vai ganhar
palavra = "missao", -- Palavra para completar
mensagem = "Preciso que me traga um pikachu.", -- msg quando n tiver o pokemon
concluir = "Parabéns você cosegui completar minha missão, receba seus premios.", -- msg quando completar a quest
completa = "você ja completou essa missão", -- msg quanto tentar fazer novamente
sto = 9876574 , -- STORAGE
-- OBS: Voce precisa ta com pokemon fora da ball para fazer a troca
}
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 playerHaveItems(cid, itemid)
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
if getPlayerItemCount(cid, items) <= 0 then
return false
end
end
return true
end
function doPlayerRemoveItems(cid, itemid, count)
local items = type(itemid) == "table" and itemid or {itemid}
for i = 1, #items do
doPlayerRemoveItem(cid, items, count ~= nil and count or 1)
end
return nil
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, cfg.palavra) then
if getPlayerStorageValue(cid,cfg.sto) == -1 then
if getCreatureName(getCreatureSummons(cid)[1]) == cfg.pokemonida then
setPlayerStorageValue(cid, cfg.sto, 1)
doRemoveItem(getPlayerSlotItem(cid, 8).uid, 1)
doRemoveCreature(getCreatureSummons(cid)[1])
addPokeToPlayer(cid, cfg.pokemonVolta, 0, nil, cfg.btype)
selfSay(cfg.concluir)
else
selfSay(cfg.mensagem)
end
else
selfSay(cfg.completa)
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
--Marshmello
e só configurar e pronto
Então e isso galera gostou deixe seu REP+