Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Queria que alguem me ajuda-se em 2 coisas nesse script de npc de transporte, só tem um erro, quando você fala hi, travel , ele responde os nomes das city tudo junto exemplo... Você quer viajar para papai noel teletubies goku... 1 tem como alguem colocar para ter virgulas e ponto de interrogação no final em azul claro como mensagem comum exemplo... Você quer viajar para papai noel, temetumbies, goku?

2 E se puder só pra premmy viajar eu ficaria agradecido.

se alguem souber só uma das duas já ajuda também...

edit: cheguei no limite de +reps, amanah eu adiciono.

Script feito por Kimoszin

\data\npc\Marujo.xml

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

<npc name="Marujo" script="marujo.lua" walkinterval="2000" floorchange="0">

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

<look type="151" head="17" body="54" legs="114" feet="0" addons="3"/>

<parameters>

</parameters>

</npc>

\data\npc\scripts\marujo.lua

local focuses = {}

local function isFocused(cid)

for i, v in pairs(focuses) do

if(v == cid) then

return true

end

end

return false

end

local function addFocus(cid)

if(not isFocused(cid)) then

table.insert(focuses, cid)

end

end

local function removeFocus(cid)

for i, v in pairs(focuses) do

if(v == cid) then

table.remove(focuses, i)

break

end

end

end

local function lookAtFocus()

for i, v in pairs(focuses) do

if(isPlayer(v)) then

doNpcSetCreatureFocus(v)

return

end

end

doNpcSetCreatureFocus(0)

end

local function getPlayerMoney(cid)

return ((getPlayerItemCount(cid, 2160) * 10000) +

(getPlayerItemCount(cid, 2152) * 100) +

getPlayerItemCount(cid, 2148))

end

function onCreatureDisappear(cid)

if(isFocused(cid)) then

selfSay("Bye!")

removeFocus(cid)

if(isPlayer(cid)) then --Be sure he's online

closeShopWindow(cid)

end

end

end

function onCreatureAppear(cid)

end

local places = {

["papai noel"] = {pos={x=1, y=2, z=7}, price = 1},

["teletubies"] = {pos={x=1, y=2, z=7}, price = 1},

["goku"] = {pos={x=1018, y=1032, z=7}, price = 1},

}

function onCreatureSay(cid, type, msg)

if((msg == "hi" or msg == "hello") and not (isFocused(cid))) then

selfSay("Welcome, ".. getCreatureName(cid) ..".", cid)

addFocus(cid)

elseif((isFocused(cid)) and (msg == "travel" or msg == "sail")) then

local str = ""

for cityName, _ in pairs(places) do

str = str.."{"..cityName.."} "

end

selfSay("Para onde voce quer viajar? "..str, cid)

elseif((isFocused(cid)) and places[msg:lower()]) then

if not(doPlayerRemoveMoney(cid, places[msg:lower()].price)) then

return selfSay("Voce nao tem dinheiro", cid)

end

selfSay("Bye", cid)

doTeleportThing(cid, places[msg:lower()].pos)

removeFocus(cid)

elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then

selfSay("Goodbye!", cid, true)

removeFocus(cid)

end

end

function onPlayerCloseChannel(cid)

if(isFocused(cid)) then

selfSay("Bye!")

closeShopWindow(cid)

removeFocus(cid)

end

end

function onThink()

for i, focus in pairs(focuses) do

if(not isCreature(focus)) then

removeFocus(focus)

else

local distance = getDistanceTo(focus) or -1

if((distance > 4) or (distance == -1)) then

selfSay("Hmph!")

closeShopWindow(focus)

removeFocus(focus)

end

end

end

lookAtFocus()

end

Editado por tiagoduuarte (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Tenta assim

local places = {

["papai noel"] = {pos={x=1, y=2, z=7}, price = 1},

[",teletubies"] = {pos={x=1, y=2, z=7}, price = 1},

[",goku"] = {pos={x=1018, y=1032, z=7}, price = 1},

}

Mais vale a lagrima da derrota doque a Covardia de não ter lutado , Prefiro morrer de Pé do que sempre viver ajoelhado.

Kaio santos "soldier killed"

Link para o post
Compartilhar em outros sites

Tenho a soluçao para seus 2 poblemas

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

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 travelNode = keywordHandler:addKeyword({'suna'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Suna Gakure, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=564, y=1145, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'mist'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Dou you wanna go to Mist Gakure, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=1149, y=1218, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'konoha'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Dou you wanna go to Konoha Gakure, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=1015, y=906, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'amegakure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Amekagure no Sato, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 0, destination = {x=972, y=1430, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'valley of the end'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Dou you wanna go to Valley of the End, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=965, y=830, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'south florest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Dou you wanna go to Souty Florest, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 0, destination = {x=912, y=1179, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'west desert'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to West Desert, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 0, destination = {x=1496, y=1053, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'south island'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Sounth Island, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 0, destination = {x=1084, y=1400, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'ilhota'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Sounth Island, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 0, destination = {x=1104, y=1535, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Suna(free), Mist(free), Konoha(free), Amegakure(vip), Valley of the End, South Florest(vip), South Island(vip), West Desert(vip) and Ilhota(vip).'})

-- Makes sure the npc reacts when you say hi, bye etc.

npcHandler:addModule(FocusModule:new())

ai vc edita como vc quiser

qualquer coisa me add e eu te explico como funfa

Nto Generations

Breve online

Quer participar da equip staff?

Envie um email PARA [email protected]

Explicando PORQUE VC quer ser da staff,e suas abilidades,exemplo mapper....

208249_401162269967740_260154321_n.jpg

Link para o post
Compartilhar em outros sites

Tenta assim

Funcionou cara, vlw nem tinha pensado nisso, mt burro kkkk

Tenho a soluçao para seus 2 poblemas

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

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 travelNode = keywordHandler:addKeyword({'suna'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Suna Gakure, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=564, y=1145, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'mist'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Dou you wanna go to Mist Gakure, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=1149, y=1218, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'konoha'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Dou you wanna go to Konoha Gakure, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=1015, y=906, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'amegakure'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Amekagure no Sato, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 0, destination = {x=972, y=1430, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'valley of the end'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Dou you wanna go to Valley of the End, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, level = 1, cost = 0, destination = {x=965, y=830, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'south florest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Dou you wanna go to Souty Florest, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 0, destination = {x=912, y=1179, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'west desert'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to West Desert, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 0, destination = {x=1496, y=1053, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'south island'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Sounth Island, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 0, destination = {x=1084, y=1400, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

local travelNode = keywordHandler:addKeyword({'ilhota'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Sounth Island, are you sure?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 0, destination = {x=1104, y=1535, z=7} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})

keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Suna(free), Mist(free), Konoha(free), Amegakure(vip), Valley of the End, South Florest(vip), South Island(vip), West Desert(vip) and Ilhota(vip).'})

-- Makes sure the npc reacts when you say hi, bye etc.

npcHandler:addModule(FocusModule:new())

ai vc edita como vc quiser

qualquer coisa me add e eu te explico como funfa

eu queria usar aquele script meu cara, só colocar p.a. lá ;s

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