BlackTibia

No estás conectado. Conéctate o registrate

 » Open Tibia » Pedido de Scripts » 

Pedido NPC

Pedido NPC

#1 Pedido NPC el Miér Dic 12, 2012 2:55 pm

Invitado


Hola! Necesito si me pueden crear un NPC, que te lleve a 1000 1000 7 solo si tienes vocación.

Doy REP+ a quienes me ayuden.

Gracias

:+rep:

#2 Re: Pedido NPC el Vie Dic 14, 2012 10:12 am

Invitado


Arriba!

#3 Re: Pedido NPC el Sáb Dic 15, 2012 8:25 am

NvSo


Miembro
Ve a NPC y Crea un nuevo npc.xml por ejemplo y colocas esto:

Código:
 <?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Charles" script="data/npc/scripts/barcovoc.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="133" head="39" body="95" legs="0" feet="35" addons="1"/>
    <parameters>
        <parameter key="message_greet" value="Welcome on board, |PLAYERNAME|. Do you want to {travel}?"/>
        <parameter key="message_farewell" value="Good bye. Recommend us if you were satisfied with our service."/>
    </parameters>
</npc> 


Luego vas a Npc -> Scripts y creas un nuevo lua llamado barcovoc.lua

y pegas lo siguiente:


Código:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, Town = {}, {}
local travel = {
   ['travel1'] = {x=1000, y=1000, z=7},
   ['travel 1'] = {x=1000, y=1000, z=7},
   ['1'] = {x=1000, y=1000, z=7}}
 
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 v = getPlayerVocation(cid)
 
function creatureSayCallback(cid, type, msg)
   local travel = travel[msg]
   if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
      local v, k = getPlayerVocation(cid), getCreatureName(cid)
      if v > 0 then
         npcHandler:say("Hello " .. k .. ", what travel need you travel 1?.", cid)
         Topic[cid] = 1
      else
         npcHandler:say("Hello " .. k .. ", what travel need you travel 1?.", cid)
         Topic[cid] = 1
      end
      Town[cid] = nil
      npcHandler:addFocus(cid)
   elseif(not npcHandler:isFocused(cid)) then
      return false
   elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
      npcHandler:say("Bye, remember come back later.", cid, TRUE)
      Topic[cid] = nil
      Town[cid] = nil
      npcHandler:releaseFocus(cid)
   elseif Topic[cid] == 1 then
      if msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") then
         npcHandler:say("Are you sure the use travel 1?.", cid)
         Topic[cid] = 5
      else
         npcHandler:say("I only understand if you say travel 1." or "Kid, one thing y'should learn. Answer with {travel 1}  and ya'll get much farther than with random babbling.", cid)
         Topic[cid] = 1
   elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "1") and v == 0 then
      npcHandler:say("You dont have vocation, please come back another day {stupid}!", cid)
      Topic[cid] = nil
      npcHandler:releaseFocus(cid)
   elseif msgcontains(msg, "travel 1") or msgcontains(msg, "travel1") or msgcontains(msg, "2") and v > 0 then
      npcHandler:say("Are you sure the use travel 1?.", cid)
      Topic[cid] = 5
   else
      npcHandler:say("You dont have vocation, please come back another day {stupid}!", cid)
      Topic[cid] = nill
      Town[cid] = nil
   end
   elseif Topic[cid] == 5 then
      if msgcontains(msg, 'yes') then
         npcHandler:say("Ok, nice travel.", cid)
         npcHandler:releaseFocus(cid)
         doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
         doTeleportThing(cid, travel[msg])
         doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
         Topic[cid] = nil
      else
         npcHandler:say("You only need say {yes} or {no}.", cid)
         Topic[cid] = 5
      elseif msgcontains(msg, 'no') then
         npcHandler:say("Choose travel 1 or say bye.", cid)
         Topic[cid] = 1
      end
   elseif msgcontains(msg, "Censurado") then
   npcHandler:say("You are a very stupid.", cid)
   Topic[cid] = 0
   end
   return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Sorry, come back later.")
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)


Prueba con este lua si te funciona me avisas.... Estaba configurado para 2 posiciones pero ya esta 1000 1000 7

Solo debes reemplazar las palabras: Travel 1, Travel1 por el nombre de la ciudad y esta listo.

Si te funciono ayudame con un Rep++ asi me animas a ayudar a otros si no avisame que error te da y te lo arreglo

http://www.darknessfamily.com

#4 Re: Pedido NPC el Sáb Dic 15, 2012 8:52 am

Invitado


Me arrojó este error:

[15/12/2012 10:20:26] [Error - LuaInterface::loadFile] data/npc/scripts/Vocacion traveler.lua:44: 'end' expected (to close 'if' at line 38) near 'elseif'
[15/12/2012 10:20:26] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/Vocacion traveler.lua
[15/12/2012 10:20:26] data/npc/scripts/Vocacion traveler.lua:44: 'end' expected (to close 'if' at line 38) near 'elseif'[15/12/2012 10:20:26] [Error - LuaInterface::loadFile] data/npc/scripts/Vocacion traveler.lua:44: 'end' expected (to close 'if' at line 38) near 'elseif'
[15/12/2012 10:20:26] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/Vocacion traveler.lua
[15/12/2012 10:20:26] data/npc/scripts/Vocacion traveler.lua:44: 'end' expected (to close 'if' at line 38) near 'elseif'

#5 Re: Pedido NPC el Sáb Dic 15, 2012 8:59 am

NvSo


Miembro
Ok entonces espera un momento y te lo hago en base al oracle.. otra cosa estas usando Tfs? si es asi dime que version.

http://www.darknessfamily.com

#6 Re: Pedido NPC el Sáb Dic 15, 2012 9:01 am

NvSo


Miembro
Ah y dime que nombre le quieres a la city asi solo reemplazas el lua y listo.

http://www.darknessfamily.com

#7 Re: Pedido NPC el Sáb Dic 15, 2012 9:16 am

Invitado


es que quiero que sea algo como "continente".

#8 Re: Pedido NPC el Sáb Dic 15, 2012 9:18 am

Invitado


@NvSo escribió:Ok entonces espera un momento y te lo hago en base al oracle.. otra cosa estas usando Tfs? si es asi dime que version.

Uso OTX para versión 9.61

#9 Re: Pedido NPC el Sáb Dic 15, 2012 9:37 am

NvSo


Miembro
dame un segundo que esta dificil por la libreria de npc.. ya lo tengo pero me falta algo.

http://www.darknessfamily.com

#10 Re: Pedido NPC el Sáb Dic 15, 2012 9:56 am

Invitado


@NvSo escribió:dame un segundo que esta dificil por la libreria de npc.. ya lo tengo pero me falta algo.

Está dificil?
de todas formas estoy online todo el dia, asi que no hay apuros

#11 Re: Pedido NPC el Sáb Dic 15, 2012 9:59 am

NvSo


Miembro
[Tienes que estar registrado y conectado para ver este vínculo] escribió:
[Tienes que estar registrado y conectado para ver este vínculo] escribió:dame un segundo que esta dificil por la libreria de npc.. ya lo tengo pero me falta algo.

Está dificil?
de todas formas estoy online todo el dia, asi que no hay apuros


pues si xd... estare haciendolo no te precupes ando testeandolo en mi ot

para estar seguro me estoy fijando en el Oracle ya que tiene esa funcion peor le ando quitando que no de vocacion. o quieres que la de?

http://www.darknessfamily.com

#12 Re: Pedido NPC el Sáb Dic 15, 2012 10:12 am

Invitado


@NvSo escribió:
@Amy Azzkaban escribió:
@NvSo escribió:dame un segundo que esta dificil por la libreria de npc.. ya lo tengo pero me falta algo.

Está dificil?
de todas formas estoy online todo el dia, asi que no hay apuros


pues si xd... estare haciendolo no te precupes ando testeandolo en mi ot

para estar seguro me estoy fijando en el Oracle ya que tiene esa funcion peor le ando quitando que no de vocacion. o quieres que la de?

No, que no la de, ya que que solo quiero que verifique que tenga vocacion para viajar.

#13 Re: Pedido NPC el Sáb Dic 15, 2012 11:32 am

NvSo


Miembro
Al fin lo termine me tuve que buscar el oracle de tibia rl actual y modificarlo asi que veras que tiene contenido extra pero cumple con las funciones que tu quieres... solo cambia la LUA por la siguiente -->

Código:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, vocation, town, destination = {}, {}, {}, {}
local TOWN_ISLANDOFDESTINY = 1
local islandOfDestinyEnabled = true
 
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 greetCallback(cid)
   if(getPlayerVocation(cid) < 1) then
      npcHandler:say("CHILD! COME BACK WHEN YOU HAVE VOCATION!!!", cid)
      return false
   else
      local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
      Topic[talkUser], vocation[talkUser], town[talkUser], destination[talkUser] = 0, 0, 0, 0
      return true
   end
end
 
function creatureSayCallback(cid, type, msg)
   local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
   if(not npcHandler:isFocused(cid)) then
      return false
   elseif msgcontains(msg, "yes") and Topic[talkUser] == 0 then
      npcHandler:say(islandOfDestinyEnabled and "I WILL BRING YOU TO THE CONTINENT ARE YOU SURE?!!" or "IN WHICH TOWN DO YOU WANT TO LIVE: {CARLIN}, {AB'DENDRIEL}, {KAZORDOON}" .. (isPremium(cid) == TRUE and ", {THAIS}, {VENORE}, {DARASHIA}, {ANKRAHMUN}, {EDRON} OR {PORT HOPE}?" or " OR {THAIS}?"), cid)
      Topic[talkUser] = islandOfDestinyEnabled and 4 or 1
   elseif Topic[talkUser] == 0 then
      npcHandler:unGreet(cid)
   elseif msgcontains(msg, "carlin") and Topic[talkUser] == 1 then
      npcHandler:say("IN CARLIN! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 2
      destination[talkUser] = {x=32360, y=31782, z=7}
   elseif msgcontains(msg, "ab'dendriel") and Topic[talkUser] == 1 then
      npcHandler:say("IN AB'DENDRIEL! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 3
      destination[talkUser] = {x=32732, y=31634, z=7}
   elseif msgcontains(msg, "kazordoon") and Topic[talkUser] == 1 then
      npcHandler:say("IN KAZORDOON! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 4
      destination[talkUser] = {x=32649, y=31925, z=11}
   elseif msgcontains(msg, "thais") and Topic[talkUser] == 1 then
      npcHandler:say("IN THAIS! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 5
      destination[talkUser] = {x=32369, y=32241, z=7}
   elseif msgcontains(msg, "venore") and Topic[talkUser] == 1 then
      npcHandler:say("IN VENORE! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 6
      destination[talkUser] = {x=32957, y=32076, z=7}
   elseif msgcontains(msg, "darashia") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN DARASHIA! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 7
         destination[talkUser] = {x=33213, y=32454, z=1}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif msgcontains(msg, "ankrahmun") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN ANKRAHMUN! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 8
         destination[talkUser] = {x=33194, y=32853, z=8}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif msgcontains(msg, "edron") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN EDRON! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 9
         destination[talkUser] = {x=33217, y=31814, z=8}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif msgcontains(msg, "port") and msgcontains(msg, "hope") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN PORT HOPE! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 10
         destination[talkUser] = {x=32595, y=32744, z=6}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif Topic[talkUser] == 1 then
      npcHandler:say("{CARLIN}, {AB'DENDRIEL}, {KAZORDOON}" .. (isPremium(cid) == TRUE and ", {THAIS}, {VENORE}, {DARASHIA}, {ANKRAHMUN}, {EDRON} OR {PORT HOPE}?" or " OR {THAIS}?"), cid)
      Topic[talkUser] = 1
   elseif msgcontains(msg, "sorcerer") and Topic[talkUser] == 2 then
      npcHandler:say("A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 1
   elseif msgcontains(msg, "druid") and Topic[talkUser] == 2 then
      npcHandler:say("A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 2
   elseif msgcontains(msg, "paladin") and Topic[talkUser] == 2 then
      npcHandler:say("A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 3
   elseif msgcontains(msg, "knight") and Topic[talkUser] == 2 then
      npcHandler:say("A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 4
   elseif Topic[talkUser] == 2 then
      npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
   elseif msgcontains(msg, "yes") and Topic[talkUser] == 3 then
      npcHandler:say("SO BE IT!", cid)
      Topic[talkUser] = 0
      doPlayerSetVocation(cid, vocation[talkUser])
      doPlayerSetTown(cid, town[talkUser])
      npcHandler:releaseFocus(cid)
      doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
      doTeleportThing(cid, destination[talkUser])
      doSendMagicEffect(destination[talkUser], CONST_ME_TELEPORT)
   elseif Topic[talkUser] == 3 then
      npcHandler:unGreet(cid)
   elseif Topic[talkUser] == 4 then
      if msgcontains(msg, "yes") then
         npcHandler:say("SO BE IT!", cid)
         Topic[talkUser] = 0
         npcHandler:releaseFocus(cid)
         doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
         doTeleportThing(cid, {x=1000,y=1000,z=7})
         doSendMagicEffect({x=1000,y=1000,z=7}, CONST_ME_TELEPORT)
      else
         npcHandler:unGreet(cid)
      end
   end
   return TRUE
end
 
npcHandler:setMessage(MESSAGE_GREET, "|PLAYERNAME|, YOU NEED TRAVEL??")
npcHandler:setMessage(MESSAGE_WALKAWAY, "COME BACK WHEN YOU ARE PREPARED!")
npcHandler:setMessage(MESSAGE_FAREWELL, "COME BACK WHEN YOU ARE PREPARED!")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Cualquier cosa me vuelves a decir.. si queires añadirle mas funciones o algo

http://www.darknessfamily.com

#14 Re: Pedido NPC el Sáb Dic 15, 2012 11:46 am

Invitado


@NvSo escribió:Al fin lo termine me tuve que buscar el oracle de tibia rl actual y modificarlo asi que veras que tiene contenido extra pero cumple con las funciones que tu quieres... solo cambia la LUA por la siguiente -->

Código:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, vocation, town, destination = {}, {}, {}, {}
local TOWN_ISLANDOFDESTINY = 1
local islandOfDestinyEnabled = true
 
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 greetCallback(cid)
   if(getPlayerVocation(cid) < 1) then
      npcHandler:say("CHILD! COME BACK WHEN YOU HAVE VOCATION!!!", cid)
      return false
   else
      local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
      Topic[talkUser], vocation[talkUser], town[talkUser], destination[talkUser] = 0, 0, 0, 0
      return true
   end
end
 
function creatureSayCallback(cid, type, msg)
   local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
   if(not npcHandler:isFocused(cid)) then
      return false
   elseif msgcontains(msg, "yes") and Topic[talkUser] == 0 then
      npcHandler:say(islandOfDestinyEnabled and "I WILL BRING YOU TO THE CONTINENT ARE YOU SURE?!!" or "IN WHICH TOWN DO YOU WANT TO LIVE: {CARLIN}, {AB'DENDRIEL}, {KAZORDOON}" .. (isPremium(cid) == TRUE and ", {THAIS}, {VENORE}, {DARASHIA}, {ANKRAHMUN}, {EDRON} OR {PORT HOPE}?" or " OR {THAIS}?"), cid)
      Topic[talkUser] = islandOfDestinyEnabled and 4 or 1
   elseif Topic[talkUser] == 0 then
      npcHandler:unGreet(cid)
   elseif msgcontains(msg, "carlin") and Topic[talkUser] == 1 then
      npcHandler:say("IN CARLIN! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 2
      destination[talkUser] = {x=32360, y=31782, z=7}
   elseif msgcontains(msg, "ab'dendriel") and Topic[talkUser] == 1 then
      npcHandler:say("IN AB'DENDRIEL! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 3
      destination[talkUser] = {x=32732, y=31634, z=7}
   elseif msgcontains(msg, "kazordoon") and Topic[talkUser] == 1 then
      npcHandler:say("IN KAZORDOON! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 4
      destination[talkUser] = {x=32649, y=31925, z=11}
   elseif msgcontains(msg, "thais") and Topic[talkUser] == 1 then
      npcHandler:say("IN THAIS! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 5
      destination[talkUser] = {x=32369, y=32241, z=7}
   elseif msgcontains(msg, "venore") and Topic[talkUser] == 1 then
      npcHandler:say("IN VENORE! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 6
      destination[talkUser] = {x=32957, y=32076, z=7}
   elseif msgcontains(msg, "darashia") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN DARASHIA! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 7
         destination[talkUser] = {x=33213, y=32454, z=1}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif msgcontains(msg, "ankrahmun") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN ANKRAHMUN! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 8
         destination[talkUser] = {x=33194, y=32853, z=8}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif msgcontains(msg, "edron") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN EDRON! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 9
         destination[talkUser] = {x=33217, y=31814, z=8}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif msgcontains(msg, "port") and msgcontains(msg, "hope") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN PORT HOPE! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 10
         destination[talkUser] = {x=32595, y=32744, z=6}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif Topic[talkUser] == 1 then
      npcHandler:say("{CARLIN}, {AB'DENDRIEL}, {KAZORDOON}" .. (isPremium(cid) == TRUE and ", {THAIS}, {VENORE}, {DARASHIA}, {ANKRAHMUN}, {EDRON} OR {PORT HOPE}?" or " OR {THAIS}?"), cid)
      Topic[talkUser] = 1
   elseif msgcontains(msg, "sorcerer") and Topic[talkUser] == 2 then
      npcHandler:say("A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 1
   elseif msgcontains(msg, "druid") and Topic[talkUser] == 2 then
      npcHandler:say("A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 2
   elseif msgcontains(msg, "paladin") and Topic[talkUser] == 2 then
      npcHandler:say("A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 3
   elseif msgcontains(msg, "knight") and Topic[talkUser] == 2 then
      npcHandler:say("A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 4
   elseif Topic[talkUser] == 2 then
      npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
   elseif msgcontains(msg, "yes") and Topic[talkUser] == 3 then
      npcHandler:say("SO BE IT!", cid)
      Topic[talkUser] = 0
      doPlayerSetVocation(cid, vocation[talkUser])
      doPlayerSetTown(cid, town[talkUser])
      npcHandler:releaseFocus(cid)
      doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
      doTeleportThing(cid, destination[talkUser])
      doSendMagicEffect(destination[talkUser], CONST_ME_TELEPORT)
   elseif Topic[talkUser] == 3 then
      npcHandler:unGreet(cid)
   elseif Topic[talkUser] == 4 then
      if msgcontains(msg, "yes") then
         npcHandler:say("SO BE IT!", cid)
         Topic[talkUser] = 0
         npcHandler:releaseFocus(cid)
         doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
         doTeleportThing(cid, {x=1000,y=1000,z=7})
         doSendMagicEffect({x=1000,y=1000,z=7}, CONST_ME_TELEPORT)
      else
         npcHandler:unGreet(cid)
      end
   end
   return TRUE
end
 
npcHandler:setMessage(MESSAGE_GREET, "|PLAYERNAME|, YOU NEED TRAVEL??")
npcHandler:setMessage(MESSAGE_WALKAWAY, "COME BACK WHEN YOU ARE PREPARED!")
npcHandler:setMessage(MESSAGE_FAREWELL, "COME BACK WHEN YOU ARE PREPARED!")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Cualquier cosa me vuelves a decir.. si queires añadirle mas funciones o algo

Quedó mucho mejor de lo que lo queria!!!!! Muchas gracias! Te agregaré mas rep :+rep: :+Rep: :+rep:

#15 Re: Pedido NPC el Sáb Dic 15, 2012 11:49 am

NvSo


Miembro
[Tienes que estar registrado y conectado para ver este vínculo] escribió:
[Tienes que estar registrado y conectado para ver este vínculo] escribió:Al fin lo termine me tuve que buscar el oracle de tibia rl actual y modificarlo asi que veras que tiene contenido extra pero cumple con las funciones que tu quieres... solo cambia la LUA por la siguiente -->

Código:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic, vocation, town, destination = {}, {}, {}, {}
local TOWN_ISLANDOFDESTINY = 1
local islandOfDestinyEnabled = true
 
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 greetCallback(cid)
   if(getPlayerVocation(cid) < 1) then
      npcHandler:say("CHILD! COME BACK WHEN YOU HAVE VOCATION!!!", cid)
      return false
   else
      local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
      Topic[talkUser], vocation[talkUser], town[talkUser], destination[talkUser] = 0, 0, 0, 0
      return true
   end
end
 
function creatureSayCallback(cid, type, msg)
   local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
   if(not npcHandler:isFocused(cid)) then
      return false
   elseif msgcontains(msg, "yes") and Topic[talkUser] == 0 then
      npcHandler:say(islandOfDestinyEnabled and "I WILL BRING YOU TO THE CONTINENT ARE YOU SURE?!!" or "IN WHICH TOWN DO YOU WANT TO LIVE: {CARLIN}, {AB'DENDRIEL}, {KAZORDOON}" .. (isPremium(cid) == TRUE and ", {THAIS}, {VENORE}, {DARASHIA}, {ANKRAHMUN}, {EDRON} OR {PORT HOPE}?" or " OR {THAIS}?"), cid)
      Topic[talkUser] = islandOfDestinyEnabled and 4 or 1
   elseif Topic[talkUser] == 0 then
      npcHandler:unGreet(cid)
   elseif msgcontains(msg, "carlin") and Topic[talkUser] == 1 then
      npcHandler:say("IN CARLIN! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 2
      destination[talkUser] = {x=32360, y=31782, z=7}
   elseif msgcontains(msg, "ab'dendriel") and Topic[talkUser] == 1 then
      npcHandler:say("IN AB'DENDRIEL! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 3
      destination[talkUser] = {x=32732, y=31634, z=7}
   elseif msgcontains(msg, "kazordoon") and Topic[talkUser] == 1 then
      npcHandler:say("IN KAZORDOON! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 4
      destination[talkUser] = {x=32649, y=31925, z=11}
   elseif msgcontains(msg, "thais") and Topic[talkUser] == 1 then
      npcHandler:say("IN THAIS! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 5
      destination[talkUser] = {x=32369, y=32241, z=7}
   elseif msgcontains(msg, "venore") and Topic[talkUser] == 1 then
      npcHandler:say("IN VENORE! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
      town[talkUser] = 6
      destination[talkUser] = {x=32957, y=32076, z=7}
   elseif msgcontains(msg, "darashia") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN DARASHIA! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 7
         destination[talkUser] = {x=33213, y=32454, z=1}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif msgcontains(msg, "ankrahmun") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN ANKRAHMUN! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 8
         destination[talkUser] = {x=33194, y=32853, z=8}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif msgcontains(msg, "edron") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN EDRON! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 9
         destination[talkUser] = {x=33217, y=31814, z=8}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif msgcontains(msg, "port") and msgcontains(msg, "hope") and Topic[talkUser] == 1 then
      if isPremium(cid) == TRUE then
         npcHandler:say("IN PORT HOPE! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
         Topic[talkUser] = 2
         town[talkUser] = 10
         destination[talkUser] = {x=32595, y=32744, z=6}
      else
         npcHandler:say("YOU NEED A PREMIUM ACCOUNT IN ORDER TO GO THERE!", cid)
         Topic[talkUser] = 1
      end
   elseif Topic[talkUser] == 1 then
      npcHandler:say("{CARLIN}, {AB'DENDRIEL}, {KAZORDOON}" .. (isPremium(cid) == TRUE and ", {THAIS}, {VENORE}, {DARASHIA}, {ANKRAHMUN}, {EDRON} OR {PORT HOPE}?" or " OR {THAIS}?"), cid)
      Topic[talkUser] = 1
   elseif msgcontains(msg, "sorcerer") and Topic[talkUser] == 2 then
      npcHandler:say("A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 1
   elseif msgcontains(msg, "druid") and Topic[talkUser] == 2 then
      npcHandler:say("A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 2
   elseif msgcontains(msg, "paladin") and Topic[talkUser] == 2 then
      npcHandler:say("A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 3
   elseif msgcontains(msg, "knight") and Topic[talkUser] == 2 then
      npcHandler:say("A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
      Topic[talkUser] = 3
      vocation[talkUser] = 4
   elseif Topic[talkUser] == 2 then
      npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
      Topic[talkUser] = 2
   elseif msgcontains(msg, "yes") and Topic[talkUser] == 3 then
      npcHandler:say("SO BE IT!", cid)
      Topic[talkUser] = 0
      doPlayerSetVocation(cid, vocation[talkUser])
      doPlayerSetTown(cid, town[talkUser])
      npcHandler:releaseFocus(cid)
      doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
      doTeleportThing(cid, destination[talkUser])
      doSendMagicEffect(destination[talkUser], CONST_ME_TELEPORT)
   elseif Topic[talkUser] == 3 then
      npcHandler:unGreet(cid)
   elseif Topic[talkUser] == 4 then
      if msgcontains(msg, "yes") then
         npcHandler:say("SO BE IT!", cid)
         Topic[talkUser] = 0
         npcHandler:releaseFocus(cid)
         doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
         doTeleportThing(cid, {x=1000,y=1000,z=7})
         doSendMagicEffect({x=1000,y=1000,z=7}, CONST_ME_TELEPORT)
      else
         npcHandler:unGreet(cid)
      end
   end
   return TRUE
end
 
npcHandler:setMessage(MESSAGE_GREET, "|PLAYERNAME|, YOU NEED TRAVEL??")
npcHandler:setMessage(MESSAGE_WALKAWAY, "COME BACK WHEN YOU ARE PREPARED!")
npcHandler:setMessage(MESSAGE_FAREWELL, "COME BACK WHEN YOU ARE PREPARED!")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Cualquier cosa me vuelves a decir.. si queires añadirle mas funciones o algo

Quedó mucho mejor de lo que lo queria!!!!! Muchas gracias! Te agregaré mas rep :+rep: :+Rep: :+rep:


Me alegro de que alla funcionado correctamente, eso esperaba debido a que lo probe en mi servidor y funciono correctamente.... Gracias por el +Rep me animas a seguir colaborando meparto

http://www.darknessfamily.com

#16 Re: Pedido NPC el Vie Oct 18, 2013 11:30 pm

isaias12


Novato

Olaa! Amigo Ocupo Tu Ayuda Estoy Haciendo Un Server Y AGrege La Cuidad De Gengia Y Oken Pero No Se Como Hacer Qe EL Npcs Del Barco De Thais Te Lleve A Esas Cuidad SI Me Ayudas Te Dare +Rep
Ocupo Tu Ayuda

#17 Re: Pedido NPC el Vie Oct 18, 2013 11:33 pm

GMLeonardoPM


Miembro
Pasa el XML del NPC...

http://krudaserver.sytes.net

#18 Re: Pedido NPC el Sáb Oct 19, 2013 12:21 am

isaias12


Novato
Ok Bro!





















Asi Es Como TE Lo Puedo PAsar

#19 Re: Pedido NPC el Sáb Oct 19, 2013 12:22 am

isaias12


Novato
Bro! La Neta SOy Nuevo Y no Se Como MAndarlo

#20 Re: Pedido NPC Hoy a las 12:17 pm

Contenido patrocinado


Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje [Página 1 de 1.]

Permisos de este foro:
No puedes responder a temas en este foro.

 

¿Quién está en línea?

En total hay 1 usuario en línea: 1 Registrado, 0 Ocultos y 0 Invitado

Usuarios navegando en este foro: vicente9908

Forum Statistics

Nuestros miembros han públicado un total de posts en temas.
Actualmente hay miembros registrados.
Démosle la bienvenida al miembro más reciente,
La mayor cantidad de usuarios en línea ha sido de .