Ir para conteúdo
  • Cadastre-se

(Resolvido)[AJUDA] Npc do Barco para Premium


Ir para solução Resolvido por Nogard,

Posts Recomendados

Gente quero sabe como coloco um script meu para levar player premium de barco.

Scrip do npc vou vou colocar aqui, quero que ele so leve jogador se for premium!

 

meuot\data\npc

 

Captain Eric Avalon.xml

<npc name="Captain Eric" script="data/npc/scripts/default.lua" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="97" head="96" body="58" legs="3" feet="114" corpse="2212"/>
<parameters>
        <parameter key="module_travel" value="1"/>
<parameter key="message_greet" value="Hiho |PLAYERNAME|. I send you to gloria, hydra lair, azeroth, sand trap, tiquanda, zatur or liberty bay." />
        <parameter key="travel_destinations" value="tiquanda,161,191,6,50;liberty bay,304,135,6,50;hydra lair,887,1004,7,250;gloria,776,792,6,50;azeroth,712,1001,6,50;sand trap,283,409,6,100;zatur,1203,1085,5,50"/>
</parameters>
</npc>

 

Obrigado, REP+

Editado por Rodrigo0lg (veja o histórico de edições)

 

                                                           

55f6tc.gif                     

Link para o post
Compartilhar em outros sites

A verificação será colocada no arquivo lua, não xml.

Ok, mais e que eu nao acho o arquivo .lua com o nome do npc, sera que e o default.lua?

Vou postar o default.lua para uma vereficacao, Obrigado !

 

default.lua

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
 
npcHandler:addModule(FocusModule:new())
 

 

                                                           

55f6tc.gif                     

Link para o post
Compartilhar em outros sites

O NPC irá cobrar o quê?

Captain Eric Avalon ele e um npc de barco, quero que ele leve so premium para outros lugares, ele ta legando free acc, como deixo so premium acc?

REP+

 

                                                           

55f6tc.gif                     

Link para o post
Compartilhar em outros sites

Estava fazendo o script, por isso da pergunta .. O script ficou 'um pouco' extenso, mas funcional.

 

 

 

 

 

Substitua o conteúdo do arquivo xml do npc, por esse:

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Eric" script="data/npc/scripts/captain.lua" walkinterval="2000" floorchange="0">
<health now="150" max="150"/>
<look type="97" head="96" body="58" legs="3" feet="114" addons="0"/>
<parameters>
  <parameter key="message_greet" value="Hi |PLAYERNAME|. I send you to gloria, hydra lair, azeroth, sand trap, tiquanda, zatur or liberty bay."/>
   </parameters>
</npc>

 

Agora, crie um novo arquivo .lua em Data/Npcs/Scripts, e o nomeie de captain.

coloque isso dentro:

 

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
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 position = {
tiquanda   = {x= 161, y=191, z=6},
libertybay = {x= 304, y=135, z=6},
hydralair  = {x= 887, y=1004, z=7},
gloria     = {x= 776, y=792, z=7},
azeroth    = {x= 712, y=1001, z=6},
sandtrap   = {x= 283, y=409, z=6},
zatur      = {x= 1203, y=1085, z=5}
}

local msgerror = 'Necessário premium account.'
 
if(msgcontains(msg, 'tiquanda')) then  
 if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
    doTeleportThing(cid, position.tiquanda)
     doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
      end
      
elseif (msgcontains(msg, 'liberty bay')) then  
 if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
    doTeleportThing(cid, position.libertybay)
     doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
      end  
      
elseif (msgcontains(msg, 'hydralair')) then
  if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.hydralair)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end

elseif (msgcontains(msg, 'gloria')) then
  if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.gloria)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
     
elseif (msgcontains(msg, 'azeroth')) then
  if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.azeroth)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
     
elseif (msgcontains(msg, 'sandtrap')) then
   if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.sandtrap)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
     
elseif (msgcontains(msg, 'zatur')) then
   if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.zatur)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
    

end
return true
end   
         

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


spacer.png

 

 

Link para o post
Compartilhar em outros sites

Estava fazendo o script, por isso da pergunta .. O script ficou 'um pouco' extenso, mas funcional.

 

 

 

 

 

Substitua o conteúdo do arquivo xml do npc, por esse:

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Eric" script="data/npc/scripts/captain.lua" walkinterval="2000" floorchange="0">
<health now="150" max="150"/>
<look type="97" head="96" body="58" legs="3" feet="114" addons="0"/>
<parameters>
  <parameter key="message_greet" value="Hi |PLAYERNAME|. I send you to gloria, hydra lair, azeroth, sand trap, tiquanda, zatur or liberty bay."/>
   </parameters>
</npc>

Agora, crie um novo arquivo .lua em Data/Npcs/Scripts, e o nomeie de captain.

coloque isso dentro:

 

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
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 position = {
tiquanda   = {x= 161, y=191, z=6},
libertybay = {x= 304, y=135, z=6},
hydralair  = {x= 887, y=1004, z=7},
gloria     = {x= 776, y=792, z=7},
azeroth    = {x= 712, y=1001, z=6},
sandtrap   = {x= 283, y=409, z=6},
zatur      = {x= 1203, y=1085, z=5}
}

local msgerror = 'Necessário premium account.'
 
if(msgcontains(msg, 'tiquanda')) then  
 if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
    doTeleportThing(cid, position.tiquanda)
     doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
      end
      
elseif (msgcontains(msg, 'liberty bay')) then  
 if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
    doTeleportThing(cid, position.libertybay)
     doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
      end  
      
elseif (msgcontains(msg, 'hydralair')) then
  if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.hydralair)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end

elseif (msgcontains(msg, 'gloria')) then
  if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.gloria)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
     
elseif (msgcontains(msg, 'azeroth')) then
  if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.azeroth)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
     
elseif (msgcontains(msg, 'sandtrap')) then
   if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.sandtrap)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
     
elseif (msgcontains(msg, 'zatur')) then
   if getPlayerVipTime(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.zatur)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
    

end
return true
end   
         

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Amigo eu falo com o npc e ele nao responde o player `FALA HI, NOME DO LUGAR QUE QUER IR, E ELE NAO RESPONDE NADA` 

Logo isso da um erro no distro, vou postar a seguir.

 

250nyfb.jpg

 

Como arrumo isso agora?

 

                                                           

55f6tc.gif                     

Link para o post
Compartilhar em outros sites

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
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 position = {
tiquanda   = {x= 161, y=191, z=6},
libertybay = {x= 304, y=135, z=6},
hydralair  = {x= 887, y=1004, z=7},
gloria     = {x= 776, y=792, z=7},
azeroth    = {x= 712, y=1001, z=6},
sandtrap   = {x= 283, y=409, z=6},
zatur      = {x= 1203, y=1085, z=5}
}

local msgerror = 'Necessário premium account.'
 
if(msgcontains(msg, 'tiquanda')) then  
 if getPlayerPremiumDays(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
    doTeleportThing(cid, position.tiquanda)
     doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
      end
      
elseif (msgcontains(msg, 'liberty bay')) then  
 if getPlayerPremiumDays(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
    doTeleportThing(cid, position.libertybay)
     doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
      end  
      
elseif (msgcontains(msg, 'hydralair')) then
  if getPlayerPremiumDays(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.hydralair)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end

elseif (msgcontains(msg, 'gloria')) then
  if getPlayerPremiumDays(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.gloria)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
     
elseif (msgcontains(msg, 'azeroth')) then
  if getPlayerPremiumDays(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.azeroth)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
     
elseif (msgcontains(msg, 'sandtrap')) then
   if getPlayerPremiumDays(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.sandtrap)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
     
elseif (msgcontains(msg, 'zatur')) then
   if getPlayerPremiumDays(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.zatur)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end
    

end
return true
end   
         

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


spacer.png

 

 

Link para o post
Compartilhar em outros sites

Funcionous agora muito obrigado!

Queria saber tipo, onde edito esse mesmo script para colocar em outros npcs de barco?

Pode explicar ? REP+

 

                                                           

55f6tc.gif                     

Link para o post
Compartilhar em outros sites
  • Solução

No início do script, há uma tabela com as coordenadas das cidades.

local position = {
tiquanda   = {x= 161, y=191, z=6},
libertybay = {x= 304, y=135, z=6},
hydralair  = {x= 887, y=1004, z=7},
gloria     = {x= 776, y=792, z=7},
azeroth    = {x= 712, y=1001, z=6},
sandtrap   = {x= 283, y=409, z=6},
zatur      = {x= 1203, y=1085, z=5}
}

Explicando..

Por exemplo, você gostaria de adicionar uma nova cidade no script, chamada Londres, com as coordenadas x=0, y=1, z=2 :

londres   = {x= 0, 1, z=2},

viu? bastaria criar uma nova linha, e adiciona-la no meio das outras da tabela (acima da última), colocando o nome da cidade, pra ficar mais fácil de ser reconhecida, e suas coordenadas.

 

 

 

 

 

 

Após tê-la adicionada na tabela, procure por:

local msgerror = 'Necessário premium account.'

E adicione isso, logo abaixo:

elseif (msgcontains(msg, 'londres')) then
  if getPlayerPremiumDays(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.londres)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end

Colocando o nome da cidade, aqui:

elseif (msgcontains(msg, 'londres')) then

e aqui:

doTeleportThing(cid, position.londres)

 

 

 

Ah, e disponha. É um prazer ajudar. ^^

Editado por Nogard (veja o histórico de edições)


spacer.png

 

 

Link para o post
Compartilhar em outros sites

No início do script, há uma tabela com as coordenadas das cidades.

local position = {
tiquanda   = {x= 161, y=191, z=6},
libertybay = {x= 304, y=135, z=6},
hydralair  = {x= 887, y=1004, z=7},
gloria     = {x= 776, y=792, z=7},
azeroth    = {x= 712, y=1001, z=6},
sandtrap   = {x= 283, y=409, z=6},
zatur      = {x= 1203, y=1085, z=5}
}

Explicando..

Por exemplo, você gostaria de adicionar uma nova cidade no script, chamada Londres, com as coordenadas x=0, y=1, z=2 :

londres   = {x= 0, 1, z=2},

viu? bastaria criar uma nova linha, e adiciona-la no meio das outras da tabela (acima da última), colocando o nome da cidade, pra ficar mais fácil de ser reconhecida, e suas coordenadas.

 

 

 

 

 

 

Após tê-la adicionada na tabela, procure por:

local msgerror = 'Necessário premium account.'

E adicione isso, logo abaixo:

elseif (msgcontains(msg, 'londres')) then
  if getPlayerPremiumDays(cid) < 1 then
  doPlayerSendTextMessage(cid, MESSAGE_FIRST, msgerror)
   else
   doTeleportThing(cid, position.londres)
    doSendMagicEffect(getPlayerPosition(cid), math.random(1, 23))
     return true
     end

Colocando o nome da cidade, aqui:

elseif (msgcontains(msg, 'londres')) then

e aqui:

doTeleportThing(cid, position.londres)

Ah, e disponha. É um prazer ajudar. ^^

Muito obrigado, voce realmente e um grande scripter !

 REP+   :accept:

 

                                                           

55f6tc.gif                     

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