Ir para conteúdo

Featured Replies

Postado

Boa noite pessoal, eu queria um npc igual ao do global, o do barco

 

exemplo: posso viajar pra 7 cidades free, e 3 pra vip

alguem poderia me ajudar nisso ?

 

uso o sistema vip 

The best VIP system ever

 

OBS: Meu Ot eh Alissow 8.60

 

Darei rep+ pra quem me ajudar

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

n35408.gif

Resolvido por Summ

Ir para solução
  • Respostas 34
  • Visualizações 1.5k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • No caso do NPC Chat, o probema é simples: Pegue por exemplo essa fala de seu NPC: selfSay("Sorry, you don\'t have enough money.") Agora pegue como exemplo essa outra mensagem: selfSay('Sorry, you

  • O primeiro erro eu arrumei... já o segundo, não tenho idéia, porque no meu ot 10.35 funciona normal e é script de 8.60... tenta agora e ve se da erro.  

  • Flavio S. Cabral
    Flavio S. Cabral

    isso é minha assinatura se não percebeu rsrsrs

Postado

Vou te ajudar, estou desenvolvendo o script. 
 
Aguarde um minutinho.
 
--------------------------
 
Bom, não deve ser igual o do global, porque fiz umas modificações em cima de um que já tinha... 
Ai os oufits e parte visual você edita depois no arquivo do NPC, e não no script.
Nesse script você deverá trocar os nomes das Cidades, e a posição de cada uma. Por favor não altere o nome das variáveis, apenas a palavra que o player deverá dizer para ir aquela cidade, por exemplo:
 

elseif msgcontains(msg, 'town 1') then

Você deverá mudar apenas o 'Town 1' entre aspas simples, e só.
 
Segue arquivo .lua que deverá estar dentro da pasta NPC\Scripts

---- NPC DE BARCO, FEITO POR XBLACKWOLF P\ TIBIAKING.

---- EDITAR APENAS AS POSIÇÕES E AS PALAVRAS MÁGICAS: if msgcontains(msg, 'town 1 free') then

---- NO CASO 'TOWN 1 FREE'





town1free = {x=759, y=678, z=7}

town2free = {x=430, y=420, z=6}

town3free = {x=400, y=482, z=6}

town4free = {x=518, y=439, z=6}

town5free = {x=568, y=465, z=7}

town6free = {x=434, y=618, z=7}

town7free = {x=573, y=694, z=7}



town1 = {x=237, y=928, z=7}

town2 = {x=600, y=1052, z=7}

town3 = {x=423, y=1010, z=7}





local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false



function onThingMove(creature, thing, oldpos, oldstackpos, cid, item, frompos, item2, topos)



end





function onCreatureAppear(creature)



end





function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye then.')

focus = 0

talk_start = 0

end

end





function onCreatureTurn(creature)



end





function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end





function onCreatureSay(cid, type, msg)

msg = string.lower(msg)

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then

selfSay('Hiho ' .. getCreatureName(cid) .. '! Anda logo, me diga a onde deseja ir')

focus = cid

talk_start = os.clock()



elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('espera, ' .. getCreatureName(cid) .. '!porra.')



elseif focus == cid then

talk_start = os.clock()



if msgcontains(msg, 'town 1 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town1free)

doSendMagicEffect(town1free,10)

selfSay("Vai")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 2 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town2free)

doSendMagicEffect(town2free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 3 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town3free)

doSendMagicEffect(town3free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 4 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town4free)

doSendMagicEffect(town4free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 5 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town5free)

doSendMagicEffect(town5free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 6 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town6free)

doSendMagicEffect(town6free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 7 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town7free)

doSendMagicEffect(town7free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end





------------------------------------------ VIP Travel -----------------------------------



elseif msgcontains(msg, 'town 1') then

if(getPlayerVipDays(cid) > 0) then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town1)

doSendMagicEffect(town1,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money or VIP Time.")

end

end



elseif msgcontains(msg, 'town 2') then

if(getPlayerVipDays(cid) > 0) then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town2)

doSendMagicEffect(town2,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money or VIP Time.")

end

end



elseif msgcontains(msg, 'town 3') then

if(getPlayerVipDays(cid) > 0) then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town3)

doSendMagicEffect(town3,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money or VIP Time.")

end

end



elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Bye ' .. creatureGetName(cid) .. ', go back.')

focus = 0

talk_start = 0



elseif msg ~= "" then

selfSay('how? I do not understand!')

talk_state = 0

end

end

end



function onCreatureChangeOutfit(creature)

end



function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next please!!...')

end

focus = 0

talk_start = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good Bye')

focus = 0

talk_start = 0

end

end

end

 

Agora, em NPC copie um arquivo qualquer de NPC, e substitua:

<npc name="Cpt Sparrow" script="data/npc/scripts/travel_boat.lua" walkinterval="2000" floorchange="0">
	<health now="150" max="150"/>
	<look type="75" head="114" body="0" legs="114" feet="0" addons="2"/>
</npc>

Nesse, você deverá mudar o nome do arquivo, dependendo de como você salvá-lo.

 

Depois no RME adicione o NPC no seu server e teste!

Encontrei um sistema Vip que vc mencionou, se a parte de viajar vip não funcionar me avisa.

 

Abrs,

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

xBlackWolf

THX @Storm Night

Best Avatar Ever

 

9p0FoTd.png

Postado
  • Autor

irei testar agora jaja

edito pra dizer se funcionou

 

Ediit: deu um erro aqui 

 

 

Erro no Console

 

[07/02/2015 02:28:22] [Error - Npc interface] 

[07/02/2015 02:28:22] data/npc/scripts/travel_boat.lua:onCreatureSay
[07/02/2015 02:28:22] Description: 
[07/02/2015 02:28:22] data/npc/scripts/travel_boat.lua:373: attempt to call global 'creatureGetName' (a nil value)
[07/02/2015 02:28:22] stack traceback:
[07/02/2015 02:28:22] data/npc/scripts/travel_boat.lua:373: in function <data/npc/scripts/travel_boat.lua:107>
 
[07/02/2015 02:28:24] [Error - Npc interface] 
[07/02/2015 02:28:24] data/npc/scripts/travel_boat.lua:onThink
[07/02/2015 02:28:24] Description: 
[07/02/2015 02:28:24] data/npc/scripts/travel_boat.lua:421: attempt to compare number with nil
[07/02/2015 02:28:24] stack traceback:
[07/02/2015 02:28:24] data/npc/scripts/travel_boat.lua:421: in function <data/npc/scripts/travel_boat.lua:401>

 

quando falo hi, ele fala no Default e não no chat do npc

 e olha o que ele fala.

 

02:35 Arieswar [293]: hi

02:35 Cpt Sparrow: Hiho Arieswar! Anda logo, me diga a onde deseja ir
02:35 Arieswar [293]: yalahar
02:35 Cpt Sparrow: how? I do not understand!
02:35 Arieswar [293]: yes
02:35 Cpt Sparrow: how? I do not understand!

 

 

Fiz o test com o jogador free, e vip, ele fala a mesma coisa

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

n35408.gif

Postado

O primeiro erro eu arrumei... já o segundo, não tenho idéia, porque no meu ot 10.35 funciona normal e é script de 8.60... tenta agora e ve se da erro.

 

---- NPC DE BARCO, FEITO POR XBLACKWOLF P\ TIBIAKING.

---- EDITAR APENAS AS POSIÇÕES E AS PALAVRAS MÁGICAS: if msgcontains(msg, 'town 1 free') then

---- NO CASO 'TOWN 1 FREE'





town1free = {x=759, y=678, z=7}

town2free = {x=430, y=420, z=6}

town3free = {x=400, y=482, z=6}

town4free = {x=518, y=439, z=6}

town5free = {x=568, y=465, z=7}

town6free = {x=434, y=618, z=7}

town7free = {x=573, y=694, z=7}



town1 = {x=237, y=928, z=7}

town2 = {x=600, y=1052, z=7}

town3 = {x=423, y=1010, z=7}





local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false



function onThingMove(creature, thing, oldpos, oldstackpos, cid, item, frompos, item2, topos)



end





function onCreatureAppear(creature)



end





function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye then.')

focus = 0

talk_start = 0

end

end





function onCreatureTurn(creature)



end





function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end





function onCreatureSay(cid, type, msg)

msg = string.lower(msg)

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then

selfSay('Hiho ' .. getCreatureName(cid) .. '! Anda logo, me diga a onde deseja ir')

focus = cid

talk_start = os.clock()



elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('espera, ' .. getCreatureName(cid) .. '!porra.')



elseif focus == cid then

talk_start = os.clock()



if msgcontains(msg, 'town 1 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town1free)

doSendMagicEffect(town1free,10)

selfSay("Vai")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 2 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town2free)

doSendMagicEffect(town2free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 3 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town3free)

doSendMagicEffect(town3free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 4 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town4free)

doSendMagicEffect(town4free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 5 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town5free)

doSendMagicEffect(town5free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 6 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town6free)

doSendMagicEffect(town6free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end



elseif msgcontains(msg, 'town 7 free') then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town7free)

doSendMagicEffect(town7free,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money.")

end





------------------------------------------ VIP Travel -----------------------------------



elseif msgcontains(msg, 'town 1') then

if(getPlayerVipDays(cid) > 0) then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town1)

doSendMagicEffect(town1,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money or VIP Time.")

end

end



elseif msgcontains(msg, 'town 2') then

if(getPlayerVipDays(cid) > 0) then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town2)

doSendMagicEffect(town2,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money or VIP Time.")

end

end



elseif msgcontains(msg, 'town 3') then

if(getPlayerVipDays(cid) > 0) then

if(doPlayerRemoveMoney(cid, 50) == TRUE) then

doTeleportThing(cid,town3)

doSendMagicEffect(town3,10)

selfSay("Let's GO")

focus = 0

talk_start = 0

else

selfSay("Sorry, you don\'t have enough money or VIP Time.")

end

end



elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Bye ' .. getCreatureName(cid) .. ', go back.')

focus = 0

talk_start = 0

elseif msg ~= "" then

selfSay('how? I do not understand!')

talk_state = 0

end

end

end



function onCreatureChangeOutfit(creature)

end



function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next please!!...')

end

focus = 0

talk_start = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good Bye')

focus = 0

talk_start = 0

end

end

end

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

xBlackWolf

THX @Storm Night

Best Avatar Ever

 

9p0FoTd.png

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo