manow se tive usando o script do sky é so fala "ajuda" --'
- Fórum
- OTServ
- Suporte
- Tópicos Sem Resposta
- [Encerrado] [PEDIDO] Npc que pede 1 item e o player ganha 1 pokemon ;
[Encerrado] [PEDIDO] Npc que pede 1 item e o player ganha 1 pokemon ;
Por viniciusdrika, 04 de jun. de 2013 em Tópicos Sem Resposta
info
Grupo: Infante
Registrado: 25/01/12
Posts: 1.6k
Reputação: +330

info
Grupo: Barão
Registrado: 10/01/13
Posts: 238
Reputação: +26

Sim deu certo desculpe, o ajuda deu certo desculpe o encomodo .
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

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.
info
Grupo: Barão
Registrado: 10/01/13
Posts: 238
Reputação: +26

So que agora na hora de falar yes nao acontece nada ;
Editado Junho 4 por viniciusdrika
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.
info
Grupo: Campones
Registrado: 13/06/12
Posts: 83
Reputação: +13

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 Junho 4 por AsMinaPira
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.
info
Grupo: Barão
Registrado: 10/01/13
Posts: 238
Reputação: +26

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'
info
Grupo: Campones
Registrado: 13/06/12
Posts: 83
Reputação: +13

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())
info
Grupo: Barão
Registrado: 10/01/13
Posts: 238
Reputação: +26

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 '-'
info
Grupo: Grão-Duque
Registrado: 28/07/11
Posts: 3.5k
Reputação: +570
Gênero: Masculino
Char no Tibia: Transloko

Tópico movido para a seção de dúvidas e pedidos resolvidos.
info
Grupo: Grão-Duque
Registrado: 28/07/11
Posts: 3.5k
Reputação: +570
Gênero: Masculino
Char no Tibia: Transloko

Tópico movido para a seção de dúvidas e pedidos resolvidos.
info
Grupo: Herói
Registrado: 28/11/10
Posts: 3.4k
Reputação: +585
Gênero: Masculino

+ 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.







info
Grupo: Barão
Registrado: 10/01/13
Posts: 238
Reputação: +26
Bom essa parte foi resolvido, nenhum erro, so que agora eu falo HELP, e nao acontece mais nada ;