Ir para conteúdo

[Encerrado] [PEDIDO] Npc que pede 1 item e o player ganha 1 pokemon ;


Posts Recomendados

Acho que arrumei a tag use a script do -Skymagnum

 

Em Npc criei um arquivo chamado Arquiologo.xml Adicione o seguinte script.

 

 

<?xml version="1.0" encoding="UTF-8"?>

 

<npc name="Arquiologo" script="arquiologo.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1">

<health now="150" max="150"/>

<look type="134" head="78" body="88" legs="0" feet="88"/>

 

<parameters>

<parameter key= "message_greet" value= "hello, talk {help}."/>

</parameters>

</npc>

 

 

 

Testei aqui pelomenos o bug que dava na distro foi retirado mas testei falar com npc não funcionou, ve ai.

O erro não era no meu script, era no .xml do npc, eu só postei o .lua.

 

@TOPIC

É ajuda depois yes.

Link para o comentário
Compartilhar em outros sites

Acho que arrumei a tag use a script do -Skymagnum

 

Em Npc criei um arquivo chamado Arquiologo.xml Adicione o seguinte script.

 

 

<?xml version="1.0" encoding="UTF-8"?>

 

<npc name="Arquiologo" script="arquiologo.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1">

<health now="150" max="150"/>

<look type="134" head="78" body="88" legs="0" feet="88"/>

 

<parameters>

<parameter key= "message_greet" value= "hello, talk {help}."/>

</parameters>

</npc>

 

 

 

Testei aqui pelomenos o bug que dava na distro foi retirado mas testei falar com npc não funcionou, ve ai.

O erro não era no meu script, era no .xml do npc, eu só postei o .lua.

 

@TOPIC

É ajuda depois yes.

 

O Bug que dava na distro éra na xml eu ja arrumei.

 

Agora o seu script ta com bug na hora do Talk com npc somente funciona o hi , help , yes não está funcionando simplesmente o script não reage.

Link para o comentário
Compartilhar em outros sites

Tenta ae:

Professor Roger.Xml

 

<?xml version="1.0" encoding="UTF-8"?>

 

<npc name="Professor Roger" script="npc.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1">

<health now="150" max="150"/>

<look type="523" head="114" body="119" legs="114" feet="114" corpse="2212"/>

 

<parameters>

<parameter key="message_greet" value="Welcome |PLAYERNAME|, i need some {help} with mys researches... Can you {help} me?"/>

</parameters>

</npc>

 

 

npc.lua

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

 

function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) end

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

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

function creatureSayCallback(cid, type, msg)

 

if(not npcHandler:isFocused(cid)) then

return false

end

 

 

local function givePokemon(cid)

local pokemon = "Nome do pokemon aqui

local gender = getRandomGenderByName(pokemon)

local btype = "normal"

local happy = 220

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

item = doCreateItemEx(11826)

else

item = doAddContainerItem(getPlayerSlotItem(cid, 3).uid, 11826, 1)

end

 

doItemSetAttribute(item, "poke", pokemon)

doItemSetAttribute(item, "hp", 1)

doItemSetAttribute(item, "happy", happy)

doItemSetAttribute(item, "gender", gender)

doItemSetAttribute(item, "description", "Contains a "..pokemon..".")

doItemSetAttribute(item, "fakedesc", "Contains a "..pokemon..".")

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

doPlayerSendMailByName(getCreatureName(cid), item, 1)

end

doPlayerRemoveItem(cid, old, 1) --aki tira o old

selfSay("So there is it! Take this pokemon, I think he will be better with you!", cid)

setPlayerStorageValue(cid, 345965, 2) --storage da quest

end

 

old = ID DO ITEM AQUI

 

if msgcontains(string.lower(msg), 'help') or msgcontains(string.lower(msg), 'ajuda') then

selfSay("Hum... I need some itens to mys researches... Can you bring to me a Old Amber?", cid)

talkState[talkUser] = 1

elseif (msgcontains(string.lower(msg), 'yes') or msgcontains(string.lower(msg), 'sim')) and talkState[talkUser] == 1 then

if getPlayerStorageValue(cid, 345965) <= 0 then

selfSay("Ok then go and bring this itens to me and maybe we can revive a old and rare Pokemon!!", cid)

setPlayerStorageValue(cid, 345965, 1)

talkState[talkUser] = 0

return true

elseif getPlayerStorageValue(cid, 345965) == 1 then

if getPlayerItemCount(cid, old) >= 1 then --1 Old amber...

selfSay("Wow then you got the items! Let me see if I could relive that pokemon!", cid)

addEvent(givePokemon, 2000, cid)

talkState[talkUser] = 0

return true

else

selfSay("You don't have my itens yet... Come back when you get them!!", cid)

talkState[talkUser] = 0

return true

end

elseif getPlayerStorageValue(cid, 345965) == 2 then

selfSay("Hummm.. You already help me, don't you? Thanks again.. but now i can't talk with you...", cid)

talkState[talkUser] = 0

return true

end

end

 

return true

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

o npc é do slicer, só editei pra o npc recolher apenas 1 item...

e o pokemon vai direto pro depot.

Editado por AsMinaPira
Link para o comentário
Compartilhar em outros sites

Tenta ae:

Professor Roger.Xml

 

<?xml version="1.0" encoding="UTF-8"?>

 

<npc name="Professor Roger" script="npc.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1">

<health now="150" max="150"/>

<look type="523" head="114" body="119" legs="114" feet="114" corpse="2212"/>

 

<parameters>

<parameter key="message_greet" value="Welcome |PLAYERNAME|, i need some {help} with mys researches... Can you {help} me?"/>

</parameters>

</npc>

 

 

npc.lua

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

 

function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) end

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

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

function creatureSayCallback(cid, type, msg)

 

if(not npcHandler:isFocused(cid)) then

return false

end

 

 

local function givePokemon(cid)

local pokemon = "Nome do pokemon aqui

local gender = getRandomGenderByName(pokemon)

local btype = "normal"

local happy = 220

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

item = doCreateItemEx(11826)

else

item = doAddContainerItem(getPlayerSlotItem(cid, 3).uid, 11826, 1)

end

 

doItemSetAttribute(item, "poke", pokemon)

doItemSetAttribute(item, "hp", 1)

doItemSetAttribute(item, "happy", happy)

doItemSetAttribute(item, "gender", gender)

doItemSetAttribute(item, "description", "Contains a "..pokemon..".")

doItemSetAttribute(item, "fakedesc", "Contains a "..pokemon..".")

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

doPlayerSendMailByName(getCreatureName(cid), item, 1)

end

doPlayerRemoveItem(cid, old, 1) --aki tira o old

selfSay("So there is it! Take this pokemon, I think he will be better with you!", cid)

setPlayerStorageValue(cid, 345965, 2) --storage da quest

end

 

old = ID DO ITEM AQUI

 

if msgcontains(string.lower(msg), 'help') or msgcontains(string.lower(msg), 'ajuda') then

selfSay("Hum... I need some itens to mys researches... Can you bring to me a Old Amber?", cid)

talkState[talkUser] = 1

elseif (msgcontains(string.lower(msg), 'yes') or msgcontains(string.lower(msg), 'sim')) and talkState[talkUser] == 1 then

if getPlayerStorageValue(cid, 345965) <= 0 then

selfSay("Ok then go and bring this itens to me and maybe we can revive a old and rare Pokemon!!", cid)

setPlayerStorageValue(cid, 345965, 1)

talkState[talkUser] = 0

return true

elseif getPlayerStorageValue(cid, 345965) == 1 then

if getPlayerItemCount(cid, old) >= 1 then --1 Old amber...

selfSay("Wow then you got the items! Let me see if I could relive that pokemon!", cid)

addEvent(givePokemon, 2000, cid)

talkState[talkUser] = 0

return true

else

selfSay("You don't have my itens yet... Come back when you get them!!", cid)

talkState[talkUser] = 0

return true

end

elseif getPlayerStorageValue(cid, 345965) == 2 then

selfSay("Hummm.. You already help me, don't you? Thanks again.. but now i can't talk with you...", cid)

talkState[talkUser] = 0

return true

end

end

 

return true

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

o npc é do slicer, só editei pra o npc recolher apenas 1 item...

e o pokemon vai direto pro depot.

 

Vou ver se é funcional amanhã eu posto estou no nootebok.

Link para o comentário
Compartilhar em outros sites

Tenta ae:

Professor Roger.Xml

 

<?xml version="1.0" encoding="UTF-8"?>

 

<npc name="Professor Roger" script="npc.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1">

<health now="150" max="150"/>

<look type="523" head="114" body="119" legs="114" feet="114" corpse="2212"/>

 

<parameters>

<parameter key="message_greet" value="Welcome |PLAYERNAME|, i need some {help} with mys researches... Can you {help} me?"/>

</parameters>

</npc>

 

 

npc.lua

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

 

function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) end

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

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

function creatureSayCallback(cid, type, msg)

 

if(not npcHandler:isFocused(cid)) then

return false

end

 

 

local function givePokemon(cid)

local pokemon = "Nome do pokemon aqui

local gender = getRandomGenderByName(pokemon)

local btype = "normal"

local happy = 220

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

item = doCreateItemEx(11826)

else

item = doAddContainerItem(getPlayerSlotItem(cid, 3).uid, 11826, 1)

end

 

doItemSetAttribute(item, "poke", pokemon)

doItemSetAttribute(item, "hp", 1)

doItemSetAttribute(item, "happy", happy)

doItemSetAttribute(item, "gender", gender)

doItemSetAttribute(item, "description", "Contains a "..pokemon..".")

doItemSetAttribute(item, "fakedesc", "Contains a "..pokemon..".")

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

doPlayerSendMailByName(getCreatureName(cid), item, 1)

end

doPlayerRemoveItem(cid, old, 1) --aki tira o old

selfSay("So there is it! Take this pokemon, I think he will be better with you!", cid)

setPlayerStorageValue(cid, 345965, 2) --storage da quest

end

 

old = ID DO ITEM AQUI

 

if msgcontains(string.lower(msg), 'help') or msgcontains(string.lower(msg), 'ajuda') then

selfSay("Hum... I need some itens to mys researches... Can you bring to me a Old Amber?", cid)

talkState[talkUser] = 1

elseif (msgcontains(string.lower(msg), 'yes') or msgcontains(string.lower(msg), 'sim')) and talkState[talkUser] == 1 then

if getPlayerStorageValue(cid, 345965) <= 0 then

selfSay("Ok then go and bring this itens to me and maybe we can revive a old and rare Pokemon!!", cid)

setPlayerStorageValue(cid, 345965, 1)

talkState[talkUser] = 0

return true

elseif getPlayerStorageValue(cid, 345965) == 1 then

if getPlayerItemCount(cid, old) >= 1 then --1 Old amber...

selfSay("Wow then you got the items! Let me see if I could relive that pokemon!", cid)

addEvent(givePokemon, 2000, cid)

talkState[talkUser] = 0

return true

else

selfSay("You don't have my itens yet... Come back when you get them!!", cid)

talkState[talkUser] = 0

return true

end

elseif getPlayerStorageValue(cid, 345965) == 2 then

selfSay("Hummm.. You already help me, don't you? Thanks again.. but now i can't talk with you...", cid)

talkState[talkUser] = 0

return true

end

end

 

return true

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

o npc é do slicer, só editei pra o npc recolher apenas 1 item...

e o pokemon vai direto pro depot.

 

Apareceu seguinte erro

 

[05/06/2013 14:04:20] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Roger.lua:1: '=' expected near 'keywordHandler'
[05/06/2013 14:04:20] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Roger.lua
[05/06/2013 14:04:20] data/npc/scripts/Roger.lua:1: '=' expected near 'keywordHandler'

Link para o comentário
Compartilhar em outros sites

Tenta agora...

 

npc.lua

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

 

function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) end

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

 

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

function creatureSayCallback(cid, type, msg)

 

if(not npcHandler:isFocused(cid)) then

return false

end

 

 

local function givePokemon(cid)

local pokemon = "Nome do pokemon aqui"

local gender = getRandomGenderByName(pokemon)

local btype = "normal"

local happy = 220

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

item = doCreateItemEx(11826)

else

item = doAddContainerItem(getPlayerSlotItem(cid, 3).uid, 11826, 1)

end

 

doItemSetAttribute(item, "poke", pokemon)

doItemSetAttribute(item, "hp", 1)

doItemSetAttribute(item, "happy", happy)

doItemSetAttribute(item, "gender", gender)

doItemSetAttribute(item, "description", "Contains a "..pokemon..".")

doItemSetAttribute(item, "fakedesc", "Contains a "..pokemon..".")

 

if getPlayerFreeCap(cid) >= 6 or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then

doPlayerSendMailByName(getCreatureName(cid), item, 1)

end

doPlayerRemoveItem(cid, old, 1) --aki tira o old

selfSay("So there is it! Take this pokemon, I think he will be better with you!", cid)

setPlayerStorageValue(cid, 345965, 2) --storage da quest

end

 

old = ID DO ITEM AQUI

 

if msgcontains(string.lower(msg), 'help') or msgcontains(string.lower(msg), 'ajuda') then

selfSay("Hum... I need some itens to mys researches... Can you bring to me a Old Amber?", cid)

talkState[talkUser] = 1

elseif (msgcontains(string.lower(msg), 'yes') or msgcontains(string.lower(msg), 'sim')) and talkState[talkUser] == 1 then

if getPlayerStorageValue(cid, 345965) <= 0 then

selfSay("Ok then go and bring this itens to me and maybe we can revive a old and rare Pokemon!!", cid)

setPlayerStorageValue(cid, 345965, 1)

talkState[talkUser] = 0

return true

elseif getPlayerStorageValue(cid, 345965) == 1 then

if getPlayerItemCount(cid, old) >= 1 then --1 Old amber...

selfSay("Wow then you got the items! Let me see if I could relive that pokemon!", cid)

addEvent(givePokemon, 2000, cid)

talkState[talkUser] = 0

return true

else

selfSay("You don't have my itens yet... Come back when you get them!!", cid)

talkState[talkUser] = 0

return true

end

elseif getPlayerStorageValue(cid, 345965) == 2 then

selfSay("Hummm.. You already help me, don't you? Thanks again.. but now i can't talk with you...", cid)

talkState[talkUser] = 0

return true

end

end

 

return true

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Link para o comentário
Compartilhar em outros sites

Deu certo agora, so tem 1 erro, nada que atrapalhe mais é feio, eu falo Hi Help Yes, nao é na hora demora 1 poquinho dai aparece um otro npc nao importa onde ele esteja no mapa falando "aqui está seu pokemon, muito obrigado" . Acho que entendeu o q ouve '-'

Link para o comentário
Compartilhar em outros sites

  • 1 month later...
  • 4 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...