BlackTibia

No estás conectado. Conéctate o registrate

 » Open Tibia » Pedido de Scripts » 

Pidan el script que quieran

Pidan el script que quieran

Ir a la página : 1, 2, 3  Siguiente

#1 Pidan el script que quieran el Dom Ene 11, 2015 10:15 pm

ander.oviedo


Miembro
bueno amigos este tema es para lo que necesiten un script q me digan yo lo intento hacer si ? es para practicar xd

#2 Re: Pidan el script que quieran el Dom Ene 11, 2015 11:07 pm

Machetes97


Miembro
Bro me podias hacer un piso que suba stamina cuando estes parado? Asi como terminas tus 2hr de stamina y te vas a skiliar y mientras skileas en trainers subes stamina para irte de nuevo a hunt (:

- 8.6
Si me podrias juntar el script con el de subir skill en 1 sqm estaria mucho mejor.

Suerte BRO!

#3 Re: Pidan el script que quieran el Lun Ene 12, 2015 3:48 am

Boogie


Miembro
un script que te de skills al PRIMER LOGIN Y QUE NO LOS VUELVA A DAR segun la vocacion

#4 Re: Pidan el script que quieran el Lun Ene 12, 2015 12:45 pm

Black Prada


Miembro
@Boogie aqui tienes
Código:

function onLogin(cid)
local playerVoc = getPlayerVocation(cid)
local reqTries = getPlayerRequiredSkillTries
local skillStor = 56363
local gotSkills = getPlayerStorageValue(cid, 56363)


if playerVoc == 1 and gotSkills == -1 then
doPlayerAddMagLevel(cid, 90)
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 2 and gotSkills == -1 then
doPlayerAddMagLevel(cid, 90)
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 3 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_DISTANCE, reqTries(cid, SKILL_DISTANCE, 104))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 99))
doPlayerAddMagLevel(cid, 15)
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 4 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_AXE, reqTries(cid, SKILL_AXE, 104))
doPlayerAddSkillTry(cid, SKILL_SWORD, reqTries(cid, SKILL_SWORD, 104))
doPlayerAddSkillTry(cid, SKILL_CLUB, reqTries(cid, SKILL_CLUB, 104))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 110))
doPlayerAddMagLevel(cid, 13)
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 5 and gotSkills == -1 then
doPlayerAddMagLevel(cid, 90)
doPlayerAddSkillTry(cid, SKILL_DISTANCE, reqTries(cid, SKILL_DISTANCE, 104))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 99))
setPlayerStorageValue(cid, skillStor, 1)


end
return TRUE
end
espero lo sepas editar

#5 Re: Pidan el script que quieran el Lun Ene 12, 2015 5:23 pm

nckrmn


Novato
Hola ander... yo tengo un problema al clicar con el derecho el blueberry bush para poder coger las ballas desaparece... podrias arreglarlo?

#6 Re: Pidan el script que quieran el Lun Ene 12, 2015 6:28 pm

ander.oviedo


Miembro
[Tienes que estar registrado y conectado para ver este vínculo] escribió:un script que te de skills al PRIMER LOGIN Y QUE NO LOS VUELVA A DAR segun la vocacion
boogie mira

Código:
function onLogin(cid)
local playerVoc = getPlayerVocation(cid)
local reqTries = getPlayerRequiredSkillTries
local skillStor = 56363
local gotSkills = getPlayerStorageValue(cid, 56363)


if playerVoc == 1 and gotSkills == -1 then
doPlayerAddMagLevel(cid, 90) -- por ejemplo aqui si es un sorcerer te dare 90 magic level
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 2 and gotSkills == -1 then
doPlayerAddMagLevel(cid, 90) -- aqui igual
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 3 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_DISTANCE, reqTries(cid, SKILL_DISTANCE, 104)) -- aqui el paladin dara 104 distance y 99 shield
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 99))
doPlayerAddMagLevel(cid, 15) --y ml 15
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 4 and gotSkills == -1 then
doPlayerAddSkillTry(cid, SKILL_AXE, reqTries(cid, SKILL_AXE, 104))
doPlayerAddSkillTry(cid, SKILL_SWORD, reqTries(cid, SKILL_SWORD, 104))
doPlayerAddSkillTry(cid, SKILL_CLUB, reqTries(cid, SKILL_CLUB, 104))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 110))
doPlayerAddMagLevel(cid, 13)
setPlayerStorageValue(cid, skillStor, 1)

elseif playerVoc == 5 and gotSkills == -1 then
doPlayerAddMagLevel(cid, 90)
doPlayerAddSkillTry(cid, SKILL_DISTANCE, reqTries(cid, SKILL_DISTANCE, 104))
doPlayerAddSkillTry(cid, SKILL_SHIELD, reqTries(cid, SKILL_SHIELD, 99))
setPlayerStorageValue(cid, skillStor, 1)


end
return TRUE
end

y asi lo editas todo

#7 Re: Pidan el script que quieran el Mar Ene 13, 2015 3:51 pm

naruto6


Miembro
Sabes por casualidad del algún secrip de upgrade system que funke en TFS 1.0?

#8 Re: Pidan el script que quieran el Mar Ene 13, 2015 5:12 pm

Dantarrix


Miembro
Solo quise acortar el script de los skills...
Código:

local t = {
-- [playervoc] = {fist, club, sword, axe, distance, shield, fishing, maglevel}
[1] = {0,0,0,0,0,10,10,30},
[2] = {0,0,0,0,0,10,10,30},
[3] = {10,0,0,0,40,10,10,5},
[4] = {10,10,10,10,0,20,10,5}
}
function onLogin(cid)
local playerVoc = getPlayerVocation(cid)
local reqTries = getPlayerRequiredSkillTries
local skillStor = 56363
local gotSkills = getPlayerStorageValue(cid, 56363)
local att = t[playerVoc]

if gotSkills == -1 and att then
for i = 1, #att do
doPlayerAddSkillTry(cid, i, reqTries(cid, i, att.i))
end
setPlayerStorageValue(cid, skillStor, 1)
end
return true
end

Lo más probable es que no sirva para Magic Level... Pero algo es algo y hay que probar jajajaja XD

#9 Re: Pidan el script que quieran el Mar Ene 13, 2015 7:03 pm

Krápula


Miembro
Bro podrias hacer un script q al pisar 1 sqm salga 1 mostro random y solo puedan, volver a usar en 30 sec para 7.6

Gracias de antemano Bro

#10 Re: Pidan el script que quieran el Miér Ene 14, 2015 8:47 pm

Krápula


Miembro
y tmb no se si esto tenga algo q ver con script pero hacer que las red skull sean x stage

Osea Red Skull

Nivel 10 a 70 = 30 dias
Nivel 70 a 120 = 20 dias
NIvel 120 a 200 = 15 dias
NIvel 200 a XXX = 10 dias

Algo asi me comprendes?

#11 Re: Pidan el script que quieran el Jue Ene 15, 2015 2:48 am

Blod


Estudiante
Gordittox escribió:Bro podrias hacer un script q al pisar 1 sqm salga 1 mostro random y solo puedan, volver a usar en 30 sec para 7.6

Gracias de antemano Bro

data/movemets/scripts/randomsummon.lua
Código:

Summonpos = { -- Posicion donde apareceran los monsters
x=994,
y=1005,
z=7,
}
monsters = {
--Lista de monsters
"Dragon",
"Dragon Lord",
"Frost Dragon",


}
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) == TRUE then
doSummonCreature(monsters[math.random(1, #monsters)], Summonpos)
end
return TRUE
end

Movements.xml
Cambias el id por el id quele quieras poner al piso para que el monsters se apareza
Código:

<movevent type="StepIn" actionid="5463" event="script" value="randomsummon.lua"/>

http://oldland.sytes.net/

#12 Re: Pidan el script que quieran el Jue Ene 15, 2015 2:15 pm

Krápula


Miembro
Gracias bro aun no lo probare pero si funciona realmente?

#13 Re: Pidan el script que quieran el Jue Ene 15, 2015 2:24 pm

Dantarrix


Miembro
Gordittox escribió:Gracias bro aun no lo probare pero si funciona realmente?

Sí funcionará si se le corrigen dos errores que tiene, pero no tiene la restricción de que pueda ser usado cada 30 segundos, se usa infinitas veces...

Lo edité para que funcione cada 30 segundos:
Código:

local Summonpos = {x=994,y=1005,z=7}
local monsters = {"Dragon","Dragon Lord","Frost Dragon"}
local globalstor = 36457
function onStepIn(cid, item, position, fromPosition)
if os.time() >= getGlobalStorageValue(globalstor) then
if isPlayer(cid) then
doSummonCreature(monsters[math.random(1, #monsters)], Summonpos)
setGlobalStorageValue(globalstor, os.time()+30)
end
end
return true
end

Espero sirva... Saludos

#14 Re: Pidan el script que quieran el Jue Ene 15, 2015 3:12 pm

Camilooh


Miembro
Hm Que Las Firewalker Al Caminar Valla Dejando Fuego En El Piso

#15 Re: Pidan el script que quieran el Jue Ene 15, 2015 5:07 pm

Blod


Estudiante
cierto olvide eso

http://oldland.sytes.net/

#16 Re: Pidan el script que quieran el Jue Ene 15, 2015 8:39 pm

ander.oviedo


Miembro
Pidan scripts medios no difíciles es solo practica

#17 Re: Pidan el script que quieran el Jue Ene 15, 2015 9:45 pm

Sumdu


Nuevo
Eh ando en busca de un script para auto arreglar la gold coins, crystal y etc si me podrias ayudar de ante mano gracias Men

#18 Re: Pidan el script que quieran el Vie Ene 16, 2015 11:08 am

Krápula


Miembro
Gracias dantarix, gracias blod

Son unas cuchituras los 2 huashuashasusahuashasuas

y jajaja okey ander disculpa por ponerla dificil

#19 Re: Pidan el script que quieran el Sáb Ene 17, 2015 2:22 am

Krápula


Miembro
@blod bro me sale el siguien error
[17/1/2015 1:48:54] >>> Loading movements... [Error - LuaInterface::loadFile] cannot open data/movements/scripts/randomsummon.lua: No such file or directory [17/1/2015 1:48:54] [Error - Event::checkScript] Cannot load script (data/movements/scripts/randomsummon.lua) [17/1/2015 1:48:54] cannot open data/movements/scripts/randomsummon.lua: No such file or directory:
q fue lo q hice mal?.


y si de casualidad podrian tambien ayudarme con este error con los npc , no me responden nunca nada son muy odiosos conmigo y sale este error en la consola
[17/1/2015 2:7:40] [Error - NpcScript Interface] [17/1/2015 2:7:40] data/npc/scripts/rashid.lua:onCreatureSay [17/1/2015 2:7:40] Description: [17/1/2015 2:7:40] data/npc/scripts/lib/npcsystem/npchandler.lua:404: attempt to call global 'selfGetPosition' (a nil value) [17/1/2015 2:7:40] stack traceback: [17/1/2015 2:7:40] data/npc/scripts/lib/npcsystem/npchandler.lua:404: in function 'isInRange' [17/1/2015 2:7:40] data/npc/scripts/lib/npcsystem/npchandler.lua:309: in function 'onCreatureSay' [17/1/2015 2:7:40] data/npc/scripts/rashid.lua:8: in function :

por lo q yo entiendo de lo q dice alli dice q el error esta en el scrip de el npc llamado rashid y es este para q sepan
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start 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 -- OTServ event handling functions end local shopModule = ShopModule:new() npcHandler:addModule(shopModule) shopModule:addSellableItem({'dragon scale mail'}, 2492, 40000, 'dragon scale mail') shopModule:addSellableItem({'dwarven armor'}, 2503, 30000, 'dwarven armor') shopModule:addSellableItem({'golden armor'}, 2466, 20000, 'golden armor') shopModule:addSellableItem({'leopard armor'}, 3968, 1000, 'leopard armor') shopModule:addSellableItem({'magic plate armor'}, 2472, 90000, 'magic plate armor') shopModule:addSellableItem({'golden legs'}, 2470, 70000, 'golden legs') shopModule:addSellableItem({'bone shield'}, 25480, 'bone shield') shopModule:addSellableItem({'dark shield'}, 252400, 'dark shield') shopModule:addSellableItem({'demon shield'}, 2520, 30000, 'demon shield') shopModule:addSellableItem({'medusa shield'}, 2536, 9000, 'medusa shield') shopModule:addSellableItem({'scarab shield'}, 2540, 2000, 'scarab shield') shopModule:addSellableItem({'mastermind shield'}, 2514,50000, 'mastermind shield') shopModule:addSellableItem({'beholder helmet'}, 3972, 7500, 'beholder helmet') shopModule:addSellableItem({'devil helmet'}, 2462, 1000, 'devil helmet') shopModule:addSellableItem({'crocodile boots'}, 3892, 1000, 'crocodile boots') shopModule:addSellableItem({'traper boots'}, 2642000, 'traper boots') shopModule:addSellableItem({'steel boots'}, 2645, 30000, 'steel boots') shopModule:addSellableItem({'daramanian mace'}, 2439, 110, 'daramanian mace') shopModule:addSellableItem({'daramanian waraxe'}, 2440, 1000, 'daramanian waraxe') shopModule:addSellableItem({'guardian halberd'}, 2427, 11000, 'guardian halberd') shopModule:addSellableItem({'heavy machete'}, 2442, 90, 'heavy machete') shopModule:addSellableItem({'silver dagger'}, 2402, 500, 'silver dagger') shopModule:addSellableItem({'war axe'}, 2454, 9000, 'war axe') shopModule:addSellableItem({'ancient amulet'}, 2142, 200, 'ancient amulet') shopModule:addSellableItem({'crystal necklace'}, 2125, 400, 'crystal necklace') shopModule:addSellableItem({'crystal ring'}, 2124, 250, 'crystal ring') shopModule:addSellableItem({'demonbone amulet'}, 2136, 32000, 'demonbone amulet') shopModule:addSellableItem({'emerald bangle'}, 2127, 800, 'emerald bangle') shopModule:addSellableItem({'golden ring'}, 2179, 8000, 'golden ring') shopModule:addSellableItem({'platinum amulet'}, 2172500, 'platinum amulet') shopModule:addSellableItem({'ring of the sky'}, 2123, 30000, 'ring of the sky') shopModule:addSellableItem({'ruby necklace'}, 2133, 2000, 'ruby necklace') shopModule:addSellableItem({'scarab amulet'}, 2135, 200, 'scarab amulet') shopModule:addSellableItem({'silver brooch'}, 2134, 150,'silver brooch') shopModule:addSellableItem({'doll'},2100 , 200, 'doll') shopModule:addSellableItem({'voodoo doll'}, 3955, 400, 'voodoo doll') npcHandler:addModule(FocusModule:new()):

y lo otro podria ser el system y NpcChadler

System:
if(NpcSystem == nil) then -- Loads the underlying classes of the npcsystem. dofile(getDataDir() .. 'npc/scripts/lib/npcsystem/keywordhandler.lua') dofile(getDataDir() .. 'npc/scripts/lib/npcsystem/queue.lua') dofile(getDataDir() .. 'npc/scripts/lib/npcsystem/npchandler.lua') dofile(getDataDir() .. 'npc/scripts/lib/npcsystem/modules.lua') -- Global npc constants: -- Keyword nestling behavior. For more information look at the top of keywordhandler.lua KEYWORD_BEHAVIOR = BEHAVIOR_NORMAL_EXTENDED -- Gerrting and unGreeting keywords. For mor information look at the top of modules.lua FOCUS_GREETWORDS = {'hi', 'hello'} FOCUS_FAREWELLWORDS = {'bye', 'farewell', 'cya'} -- The word for accepting/declining an offer. CAN ONLY CONTAIN ONE FIELD! For more information look at the top of modules.lua SHOP_YESWORD = {'yes'} SHOP_NOWORD = {'no'} -- Pattern used to get the amount of an item a player wants to buy/sell. PATTERN_COUNT = '%d+' -- Talkdelay behavior. For mor information, look at the top of npchandler.lua. NPCHANDLER_TALKDELAY = TALKDELAY_ONTHINK -- Constant strings defining the keywords to replace in the default messages. -- For more information, look at the top of npchandler.lua... TAG_PLAYERNAME = '|PLAYERNAME|' TAG_ITEMCOUNT = '|ITEMCOUNT|' TAG_TOTALCOST = '|TOTALCOST|' TAG_ITEMNAME = '|ITEMNAME|' TAG_QUEUESIZE = '|QUEUESIZE|' NpcSystem = { -- } -- Gets an npcparameter with the specified key. Returns nil if no such parameter is found. function NpcSystem.getParameter(key) local ret = getNpcParameter(tostring(key)) if((type(ret) == 'number' and ret == 0) or ret == nil) then return nil else return ret end end -- Parses all known parameters for the npc. Also parses parseable modules. function NpcSystem.parseParameters(npcHandler) local ret = NpcSystem.getParameter('idletime') if(ret ~= nil) then npcHandler.idleTime = tonumber(ret) end local ret = NpcSystem.getParameter('talkradius') if(ret ~= nil) then npcHandler.talkRadius = tonumber(ret) end local ret = NpcSystem.getParameter('talkdelaytime') if(ret ~= nil) then npcHandler.talkDelayTime = tonumber(ret) end local ret = NpcSystem.getParameter('message_greet') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_GREET, ret) end local ret = NpcSystem.getParameter('message_farewell') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_FAREWELL, ret) end local ret = NpcSystem.getParameter('message_buy') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_BUY, ret) end local ret = NpcSystem.getParameter('message_sell') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_SELL, ret) end local ret = NpcSystem.getParameter('message_onbuy') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_ONBUY, ret) end local ret = NpcSystem.getParameter('message_onsell') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_ONSELL, ret) end local ret = NpcSystem.getParameter('message_needmoremoney') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_NEEDMOREMONEY, ret) end local ret = NpcSystem.getParameter('message_nothaveitem') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_NOTHAVEITEM, ret) end local ret = NpcSystem.getParameter('message_idletimeout') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_IDLETIMEOUT, ret) end local ret = NpcSystem.getParameter('message_walkaway') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_WALKAWAY, ret) end local ret = NpcSystem.getParameter('message_alreadyfocused') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_ALREADYFOCUSED, ret) end local ret = NpcSystem.getParameter('message_placedinqueue') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_PLACEDINQUEUE, ret) end local ret = NpcSystem.getParameter('message_decline') if(ret ~= nil) then npcHandler:setMessage(MESSAGE_DECLINE, ret) end -- Parse modules. for parameter, module in pairs(Modules.parseableModules) do local ret = NpcSystem.getParameter(parameter) if(ret ~= nil) then local number = tonumber(ret) if(number ~= 0 and module.parseParameters ~= nil) then local instance = module:new() npcHandler:addModule(instance) instance:parseParameters() end end end end end:

y NPCCHLADER :
if(NpcHandler == nil) then -- Constant talkdelay behaviors. TALKDELAY_NONE = 0 -- No talkdelay. Npc will reply immedeatly. TALKDELAY_ONTHINK = 1 -- Talkdelay handled through the onThink callback function. (Default) TALKDELAY_EVENT = 2 -- Not yet implemented -- Currently applied talkdelay behavior. TALKDELAY_ONTHINK is default. NPCHANDLER_TALKDELAY = TALKDELAY_ONTHINK -- Constant indexes for defining default messages. MESSAGE_GREET = 1 -- When the player greets the npc. MESSAGE_FAREWELL = 2 -- When the player unGreets the npc. MESSAGE_BUY = 3 -- When the npc asks the player if he wants to buy something. MESSAGE_SELL = 4 -- When the npc asks the player if he wants to sell something. MESSAGE_ONBUY = 5 -- When the player successfully buys something MESSAGE_ONSELL = 6 -- When the player successfully sells something MESSAGE_NEEDMOREMONEY = 7 -- When the player does not have enough money MESSAGE_NOTHAVEITEM = 8 -- When the player is trying to sell an item he does not have. MESSAGE_IDLETIMEOUT = 9 -- When the player has been idle for longer then idleTime allows. MESSAGE_WALKAWAY = 10 -- When the player walks out of the talkRadius of the npc. MESSAGE_ALREADYFOCUSED = 11 -- When the player already has the focus of this nopc. MESSAGE_PLACEDINQUEUE = 12 -- When the player has been placed in the costumer queue. MESSAGE_DECLINE = 13 -- When the player sais no to something. -- Constant indexes for callback functions. These are also used for module callback ids. CALLBACK_CREATURE_APPEAR = 1 CALLBACK_CREATURE_DISAPPEAR = 2 CALLBACK_CREATURE_SAY = 3 CALLBACK_ONTHINK = 4 CALLBACK_GREET = 5 CALLBACK_FAREWELL = 6 CALLBACK_MESSAGE_DEFAULT = 7 -- Addidional module callback ids CALLBACK_MODULE_INIT = 10 CALLBACK_MODULE_RESET = 11 -- Constant strings defining the keywords to replace in the default messages. TAG_PLAYERNAME = '|PLAYERNAME|' TAG_ITEMCOUNT = '|ITEMCOUNT|' TAG_TOTALCOST = '|TOTALCOST|' TAG_ITEMNAME = '|ITEMNAME|' TAG_QUEUESIZE = '|QUEUESIZE|' NpcHandler = { keywordHandler = nil, queue = nil, focusGreetKeywords = nil, focusFarewellKeywords = nil, focus = 0, talkStart = 0, idleTime = 30, talkRadius = 5, talkDelayTime = 0, -- Seconds to delay outgoing messages. talkDelay = nil, callbackFunctions = nil, modules = nil, messages = { -- These are the default replies of all npcs. They can/should be changed individually for each npc. [MESSAGE_GREET] = 'Welcome, |PLAYERNAME|! I have been expecting you.', [MESSAGE_FAREWELL] = 'Good bye, |PLAYERNAME|!', [MESSAGE_BUY] = 'Do you want to buy |ITEMCOUNT| |ITEMNAME| for |TOTALCOST| gold coins?', [MESSAGE_SELL] = 'Do you want to sell |ITEMCOUNT| |ITEMNAME| for |TOTALCOST| gold coins?', [MESSAGE_ONBUY] = 'It was a pleasure doing business with you.', [MESSAGE_ONSELL] = 'Thank you for this item, |PLAYERNAME|.', [MESSAGE_NEEDMOREMONEY] = 'You do not have enough money.', [MESSAGE_NOTHAVEITEM] = 'You don't even have that item!', [MESSAGE_IDLETIMEOUT] = 'Next please!', [MESSAGE_WALKAWAY] = 'See you around!', [MESSAGE_ALREADYFOCUSED]= '|PLAYERNAME|, I am already talking to you.', [MESSAGE_PLACEDINQUEUE] = '|PLAYERNAME|, please wait for your turn. There are |QUEUESIZE| customers before you.', [MESSAGE_DECLINE] = 'Not good enough, is it?' } } -- Creates a new NpcHandler with an empty callbackFunction stack. function NpcHandler:new(keywordHandler) local obj = {} obj.callbackFunctions = {} obj.modules = {} obj.talkDelay = { message = nil, time = nil } obj.queue = Queue:new(obj) obj.keywordHandler = keywordHandler obj.messages = {} setmetatable(obj.messages, self.messages) self.messages.__index = self.messages setmetatable(obj, self) self.__index = self return obj end function NpcHandler:getFocusGreetKeywords() return self.focusGreetKeywords end function NpcHandler:setFocusGreetKeywords(...) self.focusGreetKeywords = arg end function NpcHandler:getFocusFarewellKeywords() return self.focusFarewellKeywords end function NpcHandler:setFocusFarewellKeywords(...) self.focusFarewellKeywords = arg end -- Re-defines the maximum idle time allowed for a player when talking to this npc. function NpcHandler:setMaxIdleTime(newTime) self.idleTime = newTime end -- Attaches a new costumer queue to this npchandler. function NpcHandler:setQueue(newQueue) self.queue = newQueue self.queue:setHandler(self) end -- Attackes a new keyword handler to this npchandler function NpcHandler:setKeywordHandler(newHandler) self.keywordHandler = newHandler end -- Function used to change the focus of this npc. function NpcHandler:changeFocus(newFocus) self.focus = newFocus self:updateFocus() end -- This function should be called on each onThink and makes sure the npc faces the player it is talking to. -- Should also be called whenever a new player is focused. function NpcHandler:updateFocus() doNpcSetCreatureFocus(self.focus) end -- Used when the npc should un-focus the player. function NpcHandler:releaseFocus() self:changeFocus(0) end -- Returns the callback function with the specified id or nil if no such callback function exists. function NpcHandler:getCallback(id) local ret = nil if(self.callbackFunctions ~= nil) then ret = self.callbackFunctions[id] end return ret end -- Changes the callback function for the given id to callback. function NpcHandler:setCallback(id, callback) if(self.callbackFunctions ~= nil) then self.callbackFunctions[id] = callback end end -- Adds a module to this npchandler and inits it. function NpcHandler:addModule(module) if(self.modules ~= nil) then table.insert(self.modules, module) module:init(self) end end -- Calls the callback function represented by id for all modules added to this npchandler with the given arguments. function NpcHandler:processModuleCallback(id, ...) local ret = true for i, module in pairs(self.modules) do local tmpRet = true if(id == CALLBACK_CREATURE_APPEAR and module.callbackOnCreatureAppear ~= nil) then tmpRet = module:callbackCreatureAppear(unpack(arg)) elseif(id == CALLBACK_CREATURE_DISAPPEAR and module.callbackOnCreatureDisappear ~= nil) then tmpRet = module:callbackCreatureDisappear(unpack(arg)) elseif(id == CALLBACK_CREATURE_SAY and module.callbackOnCreatureSay ~= nil) then tmpRet = module:callbackCreatureSay(unpack(arg)) elseif(id == CALLBACK_ONTHINK and module.callbackOnThink ~= nil) then tmpRet = module:callbackOnThink(unpack(arg)) elseif(id == CALLBACK_GREET and module.callbackOnGreet ~= nil) then tmpRet = module:callbackOnGreet(unpack(arg)) elseif(id == CALLBACK_FAREWELL and module.callbackOnFarewell ~= nil) then tmpRet = module:callbackOnFarewell(unpack(arg)) elseif(id == CALLBACK_MESSAGE_DEFAULT and module.callbackOnMessageDefault ~= nil) then tmpRet = module:callbackOnMessageDefault(unpack(arg)) elseif(id == CALLBACK_MODULE_RESET and module.callbackOnModuleReset ~= nil) then tmpRet = module:callbackOnModuleReset(unpack(arg)) end if(not tmpRet) then ret = false break end end return ret end -- Returns the message represented by id. function NpcHandler:getMessage(id) local ret = nil if(self.messages ~= nil) then ret = self.messages[id] end return ret end -- Changes the default response message with the specified id to newMessage. function NpcHandler:setMessage(id, newMessage) if(self.messages ~= nil) then self.messages[id] = newMessage end end -- Translates all message tags found in msg using parseInfo function NpcHandler:parseMessage(msg, parseInfo) local ret = msg for search, replace in pairs(parseInfo) do ret = string.gsub(ret, search, replace) end return ret end -- Makes sure the npc un-focuses the furrently focused player, and greets the next player in the queue is it is not empty. function NpcHandler:unGreet() if(self.focus == 0) then return end local callback = self:getCallback(CALLBACK_FAREWELL) if(callback == nil or callback()) then if(self:processModuleCallback(CALLBACK_FAREWELL)) then if(self.queue == nil or not self.queue:greetNext()) then local msg = self:getMessage(MESSAGE_FAREWELL) local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(self.focus) } msg = self:parseMessage(msg, parseInfo) self:say(msg) self:releaseFocus() end end end end -- Greets a new player. function NpcHandler:greet(cid) if(cid ~= 0) then local callback = self:getCallback(CALLBACK_GREET) if(callback == nil or callback(cid)) then if(self:processModuleCallback(CALLBACK_GREET, cid)) then local msg = self:getMessage(MESSAGE_GREET) local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid) } msg = self:parseMessage(msg, parseInfo) self:say(msg) else return end else return end end self:changeFocus(cid) end -- Handles onCreatureAppear events. If you with to handle this yourself, please use the CALLBACK_CREATURE_APPEAR callback. function NpcHandler:onCreatureAppear(cid) local callback = self:getCallback(CALLBACK_CREATURE_APPEAR) if(callback == nil or callback(cid)) then if(self:processModuleCallback(CALLBACK_CREATURE_APPEAR, cid)) then end end end -- Handles onCreatureDisappear events. If you with to handle this yourself, please use the CALLBACK_CREATURE_DISAPPEAR callback. function NpcHandler:onCreatureDisappear(cid) local callback = self:getCallback(CALLBACK_CREATURE_DISAPPEAR) if(callback == nil or callback(cid)) then if(self:processModuleCallback(CALLBACK_CREATURE_DISAPPEAR, cid)) then if(self.focus == cid) then self:unGreet() end end end end -- Handles onCreatureSay events. If you with to handle this yourself, please use the CALLBACK_CREATURE_SAY callback. function NpcHandler:onCreatureSay(cid, msgtype, msg) local callback = self:getCallback(CALLBACK_CREATURE_SAY) if(callback == nil or callback(cid, msgtype, msg)) then if(self:processModuleCallback(CALLBACK_CREATURE_SAY, cid, msgtype, msg)) then if(not self:isInRange(cid)) then return end if(self.keywordHandler ~= nil) then local ret = self.keywordHandler:processMessage(cid, msg) if(not ret) then local callback = self:getCallback(CALLBACK_MESSAGE_DEFAULT) if(callback ~= nil and callback(cid, msgtype, msg)) then self.talkStart = os.time() end else self.talkStart = os.time() end end end end end -- Handles onThink events. If you with to handle this yourself, please use the CALLBACK_ONTHINK callback. function NpcHandler:onThink() local callback = self:getCallback(CALLBACK_ONTHINK) if(callback == nil or callback()) then if(NPCHANDLER_TALKDELAY == TALKDELAY_ONTHINK and self.talkDelay.time ~= nil and self.talkDelay.message ~= nil and os.time() >= self.talkDelay.time) then selfSay(self.talkDelay.message) self.talkDelay.time = nil self.talkDelay.message = nil end if(self:processModuleCallback(CALLBACK_ONTHINK)) then if(self.focus ~= 0) then if(not self:isInRange(self.focus)) then self:onWalkAway(self.focus) elseif(os.time()-self.talkStart > self.idleTime) then self:unGreet() else self:updateFocus() end end end end end -- Tries to greet the player iwth the given cid. This function does not override queue order, current focus etc. function NpcHandler:onGreet(cid) if(self:isInRange(cid)) then if(self.focus == 0) then self:greet(cid) elseif(cid == self.focus) then local msg = self:getMessage(MESSAGE_ALREADYFOCUSED) local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid) } msg = self:parseMessage(msg, parseInfo) self:say(msg) else if(not self.queue:isInQueue(cid)) then self.queue:push(cid) end local msg = self:getMessage(MESSAGE_PLACEDINQUEUE) local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid), [TAG_QUEUESIZE] = self.queue:getSize() } msg = self:parseMessage(msg, parseInfo) self:say(msg) end end end -- Simply calls the underlying unGreet function. function NpcHandler:onFarewell() self:unGreet() end -- Should be called on this npc's focus if the distance to focus is greater then talkRadius. function NpcHandler:onWalkAway(cid) if(cid == self.focus) then local callback = self:getCallback(CALLBACK_CREATURE_DISAPPEAR) if(callback == nil or callback()) then if(self:processModuleCallback(CALLBACK_CREATURE_DISAPPEAR, cid)) then if(self.queue == nil or not self.queue:greetNext()) then local msg = self:getMessage(MESSAGE_WALKAWAY) local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(self.focus) } msg = self:parseMessage(msg, parseInfo) self:say(msg) self:releaseFocus() end end end end end -- Returns true if cid is within the talkRadius of this npc. function NpcHandler:isInRange(cid) local playerPos = getPlayerPosition(cid) if playerPos == LUA_ERROR or playerPos == LUA_NO_ERROR then return false end local sx, sy, sz = selfGetPosition() local dx = math.abs(sx-playerPos.x) local dy = math.abs(sy-playerPos.y) local dz = math.abs(sz-playerPos.z) local dist = (dx^2 + dy^2)^0.5 return (dist <= self.talkRadius and dz == 0) end -- Resets the npc into it's initial state (in regard of the keyrodhandler). -- All modules are also receiving a reset call through their callbackOnModuleReset function. function NpcHandler:resetNpc() if(self:processModuleCallback(CALLBACK_MODULE_RESET)) then self.keywordHandler:reset() end end -- Makes the npc represented by this instance of NpcHandler say something. -- This implements the currently set type of talkdelay. -- shallDelay is a boolean value. If it is false, the message is not delayed. Default value is true. function NpcHandler:say(message, shallDelay) if(shallDelay == nil) then shallDelay = true end if(NPCHANDLER_TALKDELAY == TALKDELAY_NONE or shallDelay == false) then selfSay(message) return end self.talkDelay.message = message self.talkDelay.time = os.time()+self.talkDelayTime end end:

ya con esos datos yo creo q si podrian ayudarme

#20 Re: Pidan el script que quieran el Sáb Ene 17, 2015 11:35 am

Krápula


Miembro
[17/1/2015 11:33:34] [Error - LuaInterface::loadFile] data/movements/scripts/randonsummon.lua:10: 'end' expected (to close 'if' at line 6) near '' [17/1/2015 11:33:34] [Error - Event::checkScript] Cannot load script (data/movements/scripts/randonsummon.lua) [17/1/2015 11:33:34] data/movements/scripts/randonsummon.lua:10: 'end' expected (to close 'if' at line 6) near '':

ahora me este error el mismo script y eso si no lo se acomodar

#21 Re: Pidan el script que quieran el Sáb Ene 17, 2015 1:03 pm

Daek97


Estudiante
Cual es el error? El último?
Si es así, pásame el archivo randonsummon.lúa

#22 Re: Pidan el script que quieran el Sáb Ene 17, 2015 4:25 pm

Krápula


Miembro
esta aqui mismo pero ese es lo de menos me importa mas lo de los npc si sabra resolverlo y el archivo randonsummon esta en este mismo link ya lo hizo o lo paso otro amigo

#23 Re: Pidan el script que quieran el Sáb Ene 17, 2015 6:29 pm

Daek97


Estudiante
Tu primer error está en que el nombre del archivo esta mal, fíjate como está en movements.xml

tu segundo error Rahid y npc handler, están organizados por un perro xD usa mis archivos

Rashid
Código:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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 items = {
{id = 11213, sell = 10},
{id = 11214, sell = 50},
{id = 5883, sell = 120},
{id = 7965, sell = 15},
{id = 12401, sell = 30},
{id = 12467, sell = 55},
{id = 6492, sell = 2000},
{id = 5894, sell = 50},
{id = 5896, sell = 100},
{id = 5930, sell = 2000},
{id = 10562, sell = 190},
{id = 12404, sell = 300},
{id = 12405, sell = 320},
{id = 10550, sell = 100},
{id = 5912, sell = 200},
{id = 10584, sell = 200},
{id = 11321, sell = 150},
{id = 5898, sell = 80},
{id = 11194, sell = 210},
{id = 11237, sell = 180},
{id = 10563, sell = 120},
{id = 12658, sell = 380},
{id = 12659, sell = 210},
{id = 12407, sell = 30},
{id = 12616, sell = 340},
{id = 11335, sell = 100},
{id = 12409, sell = 20},
{id = 12608, sell = 8000},
{id = 13877, sell = 4000},
{id = 12408, sell = 35},
{id = 12617, sell = 120},
{id = 5913, sell = 100},
{id = 10606, sell = 30},
{id = 10605, sell = 800},
{id = 11217, sell = 50},
{id = 11192, sell = 35},
{id = 5480, sell = 2000},
{id = 11218, sell = 28},
{id = 5890, sell = 30},
{id = 10551, sell = 15},
{id = 12470, sell = 110},
{id = 11219, sell = 45},
{id = 15486, sell = 150},
{id = 11326, sell = 700},
{id = 6536, sell = 50000},
{id = 11189, sell = 35},
{id = 15482, sell = 210},
{id = 10555, sell = 280},
{id = 10556, sell = 150},
{id = 12411, sell = 500},
{id = 11327, sell = 320},
{id = 10574, sell = 55},
{id = 11220, sell = 48},
{id = 15424, sell = 90},
{id = 15455, sell = 430},
{id = 15423, sell = 230},
{id = 15452, sell = 360},
{id = 15430, sell = 80},
{id = 15425, sell = 180},
{id = 15426, sell = 290},
{id = 5527, sell = 300},
{id = 5954, sell = 1000},
{id = 13530, sell = 1000},
{id = 10564, sell = 80},
{id = 12412, sell = 120},
{id = 12640, sell = 20},
{id = 6546, sell = 50000},
{id = 9948, sell = 5000},
{id = 5919, sell = 8000},
{id = 11361, sell = 175},
{id = 12413, sell = 100},
{id = 12614, sell = 550},
{id = 12615, sell = 430},
{id = 15622, sell = 130},
{id = 11193, sell = 150},
{id = 12421, sell = 90},
{id = 12420, sell = 50},
{id = 10552, sell = 45},
{id = 5891, sell = 20000},
{id = 11223, sell = 360},
{id = 13870, sell = 150},
{id = 12627, sell = 390},
{id = 10553, sell = 375},
{id = 5895, sell = 150},
{id = 12422, sell = 30},
{id = 5885, sell = 10000},
{id = 10575, sell = 160},
{id = 10565, sell = 30},
{id = 10578, sell = 280},
{id = 10566, sell = 90},
{id = 12414, sell = 80},
{id = 12419, sell = 120},
{id = 11366, sell = 700},
{id = 10607, sell = 90},
{id = 12423, sell = 60},
{id = 11197, sell = 380},
{id = 12399, sell = 30},
{id = 8971, sell = 500},
{id = 9967, sell = 25},
{id = 9966, sell = 20},
{id = 9968, sell = 30},
{id = 12495, sell = 20},
{id = 5877, sell = 100},
{id = 5920, sell = 100},
{id = 5910, sell = 200},
{id = 12402, sell = 350},
{id = 11200, sell = 55},
{id = 10576, sell = 85},
{id = 5925, sell = 70},
{id = 10600, sell = 115},
{id = 2743, sell = 50},
{id = 10554, sell = 500},
{id = 11221, sell = 475},
{id = 11332, sell = 550},
{id = 11333, sell = 130},
{id = 5922, sell = 90},
{id = 5902, sell = 40},
{id = 12425, sell = 80},
{id = 11199, sell = 600},
{id = 5880, sell = 500},
{id = 12426, sell = 180},
{id = 15422, sell = 330},
{id = 15480, sell = 420},
{id = 12427, sell = 100},
{id = 11372, sell = 80},
{id = 11334, sell = 500},
{id = 10608, sell = 60},
{id = 12636, sell = 300},
{id = 5876, sell = 150},
{id = 5881, sell = 120},
{id = 12410, sell = 1000},
{id = 10609, sell = 10},
{id = 11222, sell = 130},
{id = 5904, sell = 8000},
{id = 11238, sell = 100},
{id = 12445, sell = 280},
{id = 12428, sell = 75},
{id = 5878, sell = 80},
{id = 12430, sell = 60},
{id = 6537, sell = 50000},
{id = 10579, sell = 420},
{id = 11225, sell = 50},
{id = 10585, sell = 150},
{id = 10577, sell = 700},
{id = 12431, sell = 250},
{id = 11231, sell = 75},
{id = 12432, sell = 25},
{id = 12442, sell = 430},
{id = 5804, sell = 2000},
{id = 12435, sell = 30},
{id = 11113, sell = 150},
{id = 12433, sell = 85},
{id = 12437, sell = 30},
{id = 5893, sell = 250},
{id = 11337, sell = 250},
{id = 12439, sell = 20},
{id = 11196, sell = 15},
{id = 10580, sell = 420},
{id = 6540, sell = 50000},
{id = 10558, sell = 45},
{id = 12438, sell = 50},
{id = 10610, sell = 10},
{id = 12440, sell = 25},
{id = 12441, sell = 10},
{id = 10557, sell = 50},
{id = 10567, sell = 30},
{id = 12400, sell = 60},
{id = 12429, sell = 110},
{id = 12447, sell = 500},
{id = 12444, sell = 350},
{id = 12446, sell = 410},
{id = 12443, sell = 140},
{id = 5948, sell = 200},
{id = 5882, sell = 200},
{id = 5911, sell = 300},
{id = 12448, sell = 66},
{id = 11208, sell = 30},
{id = 11228, sell = 400},
{id = 12449, sell = 120},
{id = 11373, sell = 20},
{id = 12629, sell = 680},
{id = 10548, sell = 280},
{id = 10568, sell = 25},
{id = 12466, sell = 230},
{id = 11229, sell = 450},
{id = 10583, sell = 520},
{id = 7732, sell = 150},
{id = 11324, sell = 25},
{id = 12434, sell = 45},
{id = 11209, sell = 35},
{id = 6524, sell = 3000},
{id = 12436, sell = 80},
{id = 11191, sell = 50},
{id = 12468, sell = 95},
{id = 12406, sell = 480},
{id = 2062, sell = 150},
{id = 12469, sell = 70},
{id = 10611, sell = 400},
{id = 5875, sell = 2000},
{id = 5809, sell = 6000},
{id = 15421, sell = 280},
{id = 8859, sell = 10},
{id = 5879, sell = 100},
{id = 15485, sell = 450},
{id = 11325, sell = 100},
{id = 15481, sell = 340},
{id = 10559, sell = 95},
{id = 2800, sell = 15},
{id = 2799, sell = 20},
{id = 11195, sell = 120},
{id = 11226, sell = 600},
{id = 2174, sell = 200},
{id = 11210, sell = 50},
{id = 10603, sell = 20},
{id = 15479, sell = 130},
{id = 12628, sell = 240},
{id = 11198, sell = 80},
{id = 10601, sell = 120},
{id = 12622, sell = 5000},
{id = 11370, sell = 50},
{id = 11371, sell = 60},
{id = 11369, sell = 170},
{id = 11190, sell = 95},
{id = 6539, sell = 50000},
{id = 6534, sell = 50000},
{id = 6535, sell = 50000},
{id = 11224, sell = 150},
{id = 10560, sell = 100},
{id = 2805, sell = 25},
{id = 12471, sell = 50},
{id = 5899, sell = 90},
{id = 8614, sell = 100},
{id = 11367, sell = 200},
{id = 11233, sell = 480},
{id = 5905, sell = 100},
{id = 10602, sell = 275},
{id = 11322, sell = 200},
{id = 11235, sell = 30},
{id = 15483, sell = 320},
{id = 15484, sell = 190},
{id = 11314, sell = 250},
{id = 11234, sell = 380},
{id = 5909, sell = 100},
{id = 11328, sell = 110},
{id = 11230, sell = 800},
{id = 11212, sell = 20},
{id = 10569, sell = 60},
{id = 5897, sell = 70},
{id = 5901, sell = 5},
{id = 11236, sell = 15},
{id = 10582, sell = 400},
{id = 10561, sell = 265},
{id = 5914, sell = 150},
{id = 11330, sell = 600},
{id = 11331, sell = 150}
}

for _, it in ipairs(items) do
it.name = getItemNameById(it.id):lower()
end

local shop = {}

function onSell(cid, item, subType, amount)
for _, it in ipairs(items) do
shop[it.id] = {price = it.sell, name = it.name}
end
if getPlayerItemCount(cid, item) >= amount and doPlayerRemoveItem(cid, item, amount) then
doPlayerAddMoney(cid, amount * shop[item].price)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sold x" .. amount .. " " .. shop[item].name .. " for " .. shop[item].price * amount .. " gold.")
else
doPlayerSendCancel(cid, "You do not have that item.")
end
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

if isInArray({"trade", "ariki"}, msg:lower()) then
npcHandler:say("Si! Haneka ariki!", cid)
if doPlayerAddAchievement then --Do you have an achievements system?
doPlayerAddAchievement(cid, "Si, Ariki!", true)
end
openShopWindow(cid, items, onBuy, onSell)
elseif msg:lower() == "name" then
return npcHandler:say("Me Yasir.", cid)
elseif msg:lower() == "job" then
return npcHandler:say("Tje hari ku ne finjala. {Ariki}?", cid)
elseif msg:lower() == "passage" then
return npcHandler:say("Soso yana. <shakes his head>", cid)
end
return true
end

npcHandler:setMessage(MESSAGE_FAREWELL, "Si, jema ze harun. <waves>")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

NpcHandler

Código:
-- Advanced NPC System (Created by Jiddo),
-- Modified by TheForgottenServer Team,
-- Modified by The OTX Server Team.

if(NpcHandler == nil) then
   -- Constant talkdelay behaviors.
   TALKDELAY_NONE = 0 -- No talkdelay. Npc will reply immedeatly.
   TALKDELAY_ONTHINK = 1 -- Talkdelay handled through the onThink callback function. (Default)
   TALKDELAY_EVENT = 2 -- Not yet implemented

   -- Currently applied talkdelay behavior. TALKDELAY_ONTHINK is default.
   NPCHANDLER_TALKDELAY = TALKDELAY_ONTHINK

   -- Constant conversation behaviors.
   CONVERSATION_DEFAULT = 0 -- Conversation through default window, like it was before 8.2 update.
   CONVERSATION_PRIVATE = 1 -- Conversation through NPCs chat window, as of 8.2 update. (Default)
      --Small Note: Private conversations also means the NPC will use multi-focus system.

   -- Currently applied conversation behavior. CONVERSATION_PRIVATE is default.
   NPCHANDLER_CONVBEHAVIOR = CONVERSATION_PRIVATE

   -- Constant indexes for defining default messages.
   MESSAGE_GREET          = 1 -- When the player greets the npc.
   MESSAGE_FAREWELL       = 2 -- When the player unGreets the npc.
   MESSAGE_BUY          = 3 -- When the npc asks the player if he wants to buy something.
   MESSAGE_ONBUY          = 4 -- When the player successfully buys something via talk.
   MESSAGE_BOUGHT         = 5 -- When the player bought something through the shop window.
   MESSAGE_SELL          = 6 -- When the npc asks the player if he wants to sell something.
   MESSAGE_ONSELL          = 7 -- When the player successfully sells something via talk.
   MESSAGE_SOLD         = 8 -- When the player sold something through the shop window.
   MESSAGE_MISSINGMONEY      = 9 -- When the player does not have enough money.
   MESSAGE_MISSINGITEM      = 10 -- When the player is trying to sell an item he does not have.
   MESSAGE_NEEDMONEY      = 11 -- Same as above, used for shop window.
   MESSAGE_NEEDITEM      = 12 -- Same as above, used for shop window.
   MESSAGE_NEEDSPACE       = 13 -- When the player don't have any space to buy an item
   MESSAGE_NEEDMORESPACE      = 14 -- When the player has some space to buy an item, but not enough space
   MESSAGE_IDLETIMEOUT      = 15 -- When the player has been idle for longer then idleTime allows.
   MESSAGE_WALKAWAY      = 16 -- When the player walks out of the talkRadius of the npc.
   MESSAGE_DECLINE         = 17 -- When the player says no to something.
   MESSAGE_SENDTRADE      = 18 -- When the npc sends the trade window to the player
   MESSAGE_NOSHOP         = 19 -- When the npc's shop is requested but he doesn't have any
   MESSAGE_ONCLOSESHOP      = 20 -- When the player closes the npc's shop window
   MESSAGE_ALREADYFOCUSED      = 21 -- When the player already has the focus of this npc.
   MESSAGE_PLACEDINQUEUE      = 22 -- When the player has been placed in the costumer queue.

   -- Constant indexes for callback functions. These are also used for module callback ids.
   CALLBACK_CREATURE_APPEAR    = 1
   CALLBACK_CREATURE_DISAPPEAR   = 2
   CALLBACK_CREATURE_SAY       = 3
   CALLBACK_ONTHINK       = 4
   CALLBACK_GREET          = 5
   CALLBACK_FAREWELL       = 6
   CALLBACK_MESSAGE_DEFAULT    = 7
   CALLBACK_PLAYER_ENDTRADE    = 8
   CALLBACK_PLAYER_CLOSECHANNEL   = 9
   CALLBACK_ONBUY         = 10
   CALLBACK_ONSELL         = 11

   -- Addidional module callback ids
   CALLBACK_MODULE_INIT      = 12
   CALLBACK_MODULE_RESET      = 13

   -- Constant strings defining the keywords to replace in the default messages.
   TAG_PLAYERNAME = '|PLAYERNAME|'
   TAG_ITEMCOUNT = '|ITEMCOUNT|'
   TAG_TOTALCOST = '|TOTALCOST|'
   TAG_ITEMNAME = '|ITEMNAME|'
   TAG_QUEUESIZE = '|QUEUESIZE|'

   NpcHandler = {
      keywordHandler = nil,
      focuses = nil,
      talkStart = nil,
      idleTime = 300,
      talkRadius = 4,
      talkDelayTime = 350, -- Seconds to delay outgoing messages.
      queue = nil,
      talkDelay = nil,
      callbackFunctions = nil,
      modules = nil,
      shopItems = nil, -- They must be here since ShopModule uses "static" functions
      messages = {
         -- These are the default replies of all npcs. They can/should be changed individually for each npc.
         [MESSAGE_GREET]    = 'Welcome, |PLAYERNAME|! I have been expecting you.',
         [MESSAGE_FAREWELL]    = 'Good bye, |PLAYERNAME|!',
         [MESSAGE_BUY]       = 'Do you want to buy |ITEMCOUNT| |ITEMNAME| for |TOTALCOST| gold coins?',
         [MESSAGE_ONBUY]    = 'It was a pleasure doing business with you.',
         [MESSAGE_BOUGHT]    = 'Bought |ITEMCOUNT|x |ITEMNAME| for |TOTALCOST| gold.',
         [MESSAGE_SELL]       = 'Do you want to sell |ITEMCOUNT| |ITEMNAME| for |TOTALCOST| gold coins?',
         [MESSAGE_ONSELL]    = 'Thank you for this |ITEMNAME|, |PLAYERNAME|.',
         [MESSAGE_SOLD]       = 'Sold |ITEMCOUNT|x |ITEMNAME| for |TOTALCOST| gold.',
         [MESSAGE_MISSINGMONEY]   = 'Sorry, you don\'t have enough money.',
         [MESSAGE_MISSINGITEM]    = 'You don\'t even have that item, |PLAYERNAME|!',
         [MESSAGE_NEEDMONEY]    = 'You do not have enough money.',
         [MESSAGE_NEEDITEM]   = 'You do not have this object.',
         [MESSAGE_NEEDSPACE]   = 'You do not have enough capacity.',
         [MESSAGE_NEEDMORESPACE]   = 'You do not have enough capacity for all items.',
         [MESSAGE_IDLETIMEOUT]    = 'Next, please!',
         [MESSAGE_WALKAWAY]    = 'How rude!',
         [MESSAGE_DECLINE]   = 'Not good enough, is it... ?',
         [MESSAGE_SENDTRADE]   = 'Here\'s my offer, |PLAYERNAME|. Don\'t you like it?',
         [MESSAGE_NOSHOP]   = 'Sorry, I\'m not offering anything.',
         [MESSAGE_ONCLOSESHOP]   = 'Thank you, come back when you want something more.',
         [MESSAGE_ALREADYFOCUSED]= '|PLAYERNAME|! I am already talking to you...',
         [MESSAGE_PLACEDINQUEUE] = '|PLAYERNAME|, please wait for your turn. There are |QUEUESIZE| customers before you.'
      }
   }

   -- Creates a new NpcHandler with an empty callbackFunction stack.
   function NpcHandler:new(keywordHandler)
      local obj = {}
      obj.messages = {}

      obj.keywordHandler = keywordHandler
      if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
         obj.focuses = {}
         obj.talkStart = {}
      else
         obj.queue = Queue:new(obj)
         obj.focuses = 0
         obj.talkStart = 0
      end

      obj.callbackFunctions = {}
      obj.modules = {}
      obj.talkDelay = {}
      obj.shopItems = {}

      setmetatable(obj.messages, self.messages)
      self.messages.__index = self.messages

      setmetatable(obj, self)
      self.__index = self
      return obj
   end

   -- Re-defines the maximum idle time allowed for a player when talking to this npc.
   function NpcHandler:setMaxIdleTime(newTime)
      self.idleTime = newTime
   end

   -- Attackes a new keyword handler to this npchandler
   function NpcHandler:setKeywordHandler(newHandler)
      self.keywordHandler = newHandler
   end

   -- Function used to change the focus of this npc.
   function NpcHandler:addFocus(newFocus)
      if(not isCreature(newFocus)) then
         return
      end

      if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
         if(self:isFocused(newFocus, true)) then
            return
         end

         table.insert(self.focuses, newFocus)
      else
         self.focuses = newFocus
      end

      self:updateFocus(true)
   end
   NpcHandler.changeFocus = NpcHandler.addFocus -- "changeFocus" looks better for CONVERSATION_DEFAULT

   -- Function used to verify if npc is focused to certain player
   function NpcHandler:isFocused(focus, creatureCheck)
      local creatureCheck = creatureCheck or false
      if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
         for k, v in pairs(self.focuses) do
            if(v == focus) then
               if(creatureCheck or isCreature(v)) then
                  return true
               end

               self:unsetFocus(focus, k)
               return false
            end
         end

         return false
      end

      if(creatureCheck or isCreature(self.focuses)) then
         return self.focuses == focus
      end

      self:changeFocus(0)
      return false
   end

   -- This function should be called on each onThink and makes sure the npc faces the player it is talking to.
   --   Should also be called whenever a new player is focused.
   function NpcHandler:updateFocus(creatureCheck)
      local creatureCheck = creatureCheck or false
      if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
         for _, focus in pairs(self.focuses) do
            if(creatureCheck or isCreature(focus)) then
               doNpcSetCreatureFocus(focus)
               return
            end
         end
      elseif(creatureCheck or isCreature(self.focuses)) then
         doNpcSetCreatureFocus(self.focuses)
         return
      end

      doNpcSetCreatureFocus(0)
   end

   -- Used when the npc should un-focus the player.
   function NpcHandler:releaseFocus(focus)
      if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
         if(not self:isFocused(focus)) then
            return
         end

         local pos = nil
         for k, v in pairs(self.focuses) do
            if(v == focus) then
               pos = k
            end
         end

         if(pos ~= nil) then
            closeShopWindow(focus)
            self:unsetFocus(focus, pos)
         end
      elseif(self.focuses == focus) then
         if(isCreature(focus)) then
            closeShopWindow(focus)
         end

         self:changeFocus(0)
      end
   end

   -- Internal un-focusing function, beware using!
   function NpcHandler:unsetFocus(focus, pos)
      if(type(self.focuses) ~= "table" or pos == nil or self.focuses[pos] == nil) then
         return
      end

      table.remove(self.focuses, pos)
      self.talkStart[focus] = nil
      self:updateFocus()
   end

   -- Returns the callback function with the specified id or nil if no such callback function exists.
   function NpcHandler:getCallback(id)
      local ret = nil
      if(self.callbackFunctions ~= nil) then
         ret = self.callbackFunctions[id]
      end

      return ret
   end

   -- Changes the callback function for the given id to callback.
   function NpcHandler:setCallback(id, callback)
      if(self.callbackFunctions ~= nil) then
         self.callbackFunctions[id] = callback
      end
   end

   -- Adds a module to this npchandler and inits it.
   function NpcHandler:addModule(module)
      if(self.modules == nil or module == nil) then
         return false
      end

      module:init(self)
      if(module.parseParameters ~= nil) then
         module:parseParameters()
      end

      table.insert(self.modules, module)
      return true
   end

   -- Calls the callback function represented by id for all modules added to this npchandler with the given arguments.
   function NpcHandler:processModuleCallback(id, ...)
      local ret = true
      for _, module in pairs(self.modules) do
         local tmpRet = true
         if(id == CALLBACK_CREATURE_APPEAR and module.callbackOnCreatureAppear ~= nil) then
            tmpRet = module:callbackOnCreatureAppear(...)
         elseif(id == CALLBACK_CREATURE_DISAPPEAR and module.callbackOnCreatureDisappear ~= nil) then
            tmpRet = module:callbackOnCreatureDisappear(...)
         elseif(id == CALLBACK_CREATURE_SAY and module.callbackOnCreatureSay ~= nil) then
            tmpRet = module:callbackOnCreatureSay(...)
         elseif(id == CALLBACK_PLAYER_ENDTRADE and module.callbackOnPlayerEndTrade ~= nil) then
            tmpRet = module:callbackOnPlayerEndTrade(...)
         elseif(id == CALLBACK_PLAYER_CLOSECHANNEL and module.callbackOnPlayerCloseChannel ~= nil) then
            tmpRet = module:callbackOnPlayerCloseChannel(...)
         elseif(id == CALLBACK_ONBUY and module.callbackOnBuy ~= nil) then
            tmpRet = module:callbackOnBuy(...)
         elseif(id == CALLBACK_ONSELL and module.callbackOnSell ~= nil) then
            tmpRet = module:callbackOnSell(...)
         elseif(id == CALLBACK_ONTHINK and module.callbackOnThink ~= nil) then
            tmpRet = module:callbackOnThink(...)
         elseif(id == CALLBACK_GREET and module.callbackOnGreet ~= nil) then
            tmpRet = module:callbackOnGreet(...)
         elseif(id == CALLBACK_FAREWELL and module.callbackOnFarewell ~= nil) then
            tmpRet = module:callbackOnFarewell(...)
         elseif(id == CALLBACK_MESSAGE_DEFAULT and module.callbackOnMessageDefault ~= nil) then
            tmpRet = module:callbackOnMessageDefault(...)
         elseif(id == CALLBACK_MODULE_RESET and module.callbackOnModuleReset ~= nil) then
            tmpRet = module:callbackOnModuleReset(...)
         end

         if(not tmpRet) then
            ret = false
            break
         end
      end

      return ret
   end

   -- Returns the message represented by id.
   function NpcHandler:getMessage(id)
      local ret = nil
      if(self.messages ~= nil) then
         ret = self.messages[id]
      end

      return ret
   end

   -- Changes the default response message with the specified id to newMessage.
   function NpcHandler:setMessage(id, newMessage)
      if(self.messages ~= nil) then
         self.messages[id] = newMessage
      end
   end

   -- Translates all message tags found in msg using parseInfo
   function NpcHandler:parseMessage(msg, parseInfo)
      for search, replace in pairs(parseInfo) do
         if(replace ~= nil) then
            msg = msg:gsub(search, replace)
         end
      end

      return msg
   end

   -- Makes sure the npc un-focuses the currently focused player
   function NpcHandler:unGreet(cid)
      if(not self:isFocused(cid)) then
         return
      end

      local callback = self:getCallback(CALLBACK_FAREWELL)
      if(callback == nil or callback(cid)) then
         if(self:processModuleCallback(CALLBACK_FAREWELL)) then
            if(self.queue == nil or not self.queue:greetNext()) then
               local msg = self:getMessage(MESSAGE_FAREWELL)
               msg = self:parseMessage(msg, { [TAG_PLAYERNAME] = getPlayerName(cid) or -1 })

               self:resetNpc(cid)
               if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
                  self:say(msg, cid, 0, true)
                  msg = msg:gsub('{', ''):gsub('}', '')
                  local ghost, position = isPlayerGhost(cid), getThingPosition(getNpcId())

                  local spectators, nid = getSpectators(position, 7, 7), getNpcId()
                  for _, pid in ipairs(spectators) do
                     if(isPlayer(pid) and pid ~= cid) then
                        if(NPCHANDLER_TALKDELAY ~= TALKDELAY_NONE) then
                           addEvent(doCreatureSay, self.talkDelayTime, nid, msg, TALKTYPE_SAY, ghost, pid, position)
                        else
                           doCreatureSay(nid, msg, TALKTYPE_SAY, ghost, pid, position)
                        end
                     end
                  end
               else
                  self:say(msg)
               end

               self:releaseFocus(cid)
            end
         end
      end
   end

   -- Greets a new player.
   function NpcHandler:greet(cid)
      local callback = self:getCallback(CALLBACK_GREET)
      if(callback == nil or callback(cid)) then
         if(self:processModuleCallback(CALLBACK_GREET, cid)) then
            local msg = self:getMessage(MESSAGE_GREET)
            msg = self:parseMessage(msg, { [TAG_PLAYERNAME] = getCreatureName(cid) })

            self:addFocus(cid)
            if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
               self:say(msg, cid, 0, true)
               msg = msg:gsub('{', ''):gsub('}', '')
               local ghost, position = isPlayerGhost(cid), getThingPosition(getNpcId())

               local spectators, nid = getSpectators(position, 7, 7), getNpcId()
               for _, pid in ipairs(spectators) do
                  if(isPlayer(pid) and pid ~= cid) then
                     if(NPCHANDLER_TALKDELAY ~= TALKDELAY_NONE) then
                        addEvent(doCreatureSay, self.talkDelayTime, nid, msg, TALKTYPE_SAY, ghost, pid, position)
                     else
                        doCreatureSay(nid, msg, TALKTYPE_SAY, ghost, pid, position)
                     end
                  end
               end
            else
               self:say(msg)
            end
         end
      end
   end

   -- Handles onCreatureAppear events. If you with to handle this yourself, please use the CALLBACK_CREATURE_APPEAR callback.
   function NpcHandler:onCreatureAppear(cid)
      local callback = self:getCallback(CALLBACK_CREATURE_APPEAR)
      if(callback == nil or callback(cid)) then
         if(self:processModuleCallback(CALLBACK_CREATURE_APPEAR, cid)) then
            --
         end
      end
   end

   -- Handles onCreatureDisappear events. If you with to handle this yourself, please use the CALLBACK_CREATURE_DISAPPEAR callback.
   function NpcHandler:onCreatureDisappear(cid)
      local callback = self:getCallback(CALLBACK_CREATURE_DISAPPEAR)
      if(callback == nil or callback(cid)) then
         if(self:processModuleCallback(CALLBACK_CREATURE_DISAPPEAR, cid)) then
            if(self:isFocused(cid)) then
               self:unGreet(cid)
            end
         end
      end
   end

   -- Handles onCreatureSay events. If you with to handle this yourself, please use the CALLBACK_CREATURE_SAY callback.
   function NpcHandler:onCreatureSay(cid, class, msg)
      local callback = self:getCallback(CALLBACK_CREATURE_SAY)
      if(callback == nil or callback(cid, class, msg)) then
         if(self:processModuleCallback(CALLBACK_CREATURE_SAY, cid, class, msg)) then
            if(not self:isInRange(cid)) then
               return
            end

            if(self.keywordHandler ~= nil) then
               if((self:isFocused(cid) and (class == TALKTYPE_PRIVATE_PN or NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT)) or not self:isFocused(cid)) then
                  local ret = self.keywordHandler:processMessage(cid, msg)
                  if(not ret) then
                     local callback = self:getCallback(CALLBACK_MESSAGE_DEFAULT)
                     if(callback ~= nil and callback(cid, class, msg)) then
                        if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
                           self.talkStart[cid] = os.time()
                        else
                           self.talkStart = os.time()
                        end
                     end
                  elseif(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
                     self.talkStart[cid] = os.time()
                  else
                     self.talkStart = os.time()
                  end
               end
            end
         end
      end
   end

   -- Handles onPlayerEndTrade events. If you wish to handle this yourself, use the CALLBACK_PLAYER_ENDTRADE callback.
   function NpcHandler:onPlayerEndTrade(cid)
      local callback = self:getCallback(CALLBACK_PLAYER_ENDTRADE)
      if(callback == nil or callback(cid)) then
         if(self:processModuleCallback(CALLBACK_PLAYER_ENDTRADE, cid)) then
            if(self:isFocused(cid)) then
               local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid) }
               local msg = self:parseMessage(self:getMessage(MESSAGE_ONCLOSESHOP), parseInfo)
               self:say(msg, cid)
            end
         end
      end
   end

   -- Handles onPlayerCloseChannel events. If you wish to handle this yourself, use the CALLBACK_PLAYER_CLOSECHANNEL callback.
   function NpcHandler:onPlayerCloseChannel(cid)
      local callback = self:getCallback(CALLBACK_PLAYER_CLOSECHANNEL)
      if(callback == nil or callback(cid)) then
         if(self:processModuleCallback(CALLBACK_PLAYER_CLOSECHANNEL, cid)) then
            if(self:isFocused(cid)) then
               self:unGreet(cid)
            end
         end
      end
   end

   -- Handles onBuy events. If you wish to handle this yourself, use the CALLBACK_ONBUY callback.
   function NpcHandler:onBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks)
      local callback = self:getCallback(CALLBACK_ONBUY)
      if(callback == nil or callback(cid, itemid, subType, amount, ignoreCap, inBackpacks)) then
         if(self:processModuleCallback(CALLBACK_ONBUY, cid, itemid, subType, amount, ignoreCap, inBackpacks)) then
            --
         end
      end
   end

   -- Handles onSell events. If you wish to handle this yourself, use the CALLBACK_ONSELL callback.
   function NpcHandler:onSell(cid, itemid, subType, amount, ignoreCap, inBackpacks)
      local callback = self:getCallback(CALLBACK_ONSELL)
      if(callback == nil or callback(cid, itemid, subType, amount, ignoreCap, inBackpacks)) then
         if(self:processModuleCallback(CALLBACK_ONSELL, cid, itemid, subType, amount, ignoreCap, inBackpacks)) then
            --
         end
      end
   end

   -- Handles onThink events. If you wish to handle this yourself, please use the CALLBACK_ONTHINK callback.
   function NpcHandler:onThink()
      local callback = self:getCallback(CALLBACK_ONTHINK)
      if(callback == nil or callback()) then
         for i, speech in pairs(self.talkDelay) do
            if((speech.cid == nil or speech.cid == 0) and speech.time ~= nil and speech.message ~= nil) then
               if(os.mtime() >= speech.time) then
                  selfSay(speech.message)
                  self.talkDelay[i] = nil
               end
            elseif(isCreature(speech.cid) and speech.start ~= nil and speech.time ~= nil and speech.message ~= nil) then
               if(os.mtime() >= speech.time) then
                  local talkStart = (NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT and self.talkStart[speech.cid] or self.talkStart)
                  if(speech.force or (self:isFocused(speech.cid) and talkStart == speech.start)) then
                     if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
                        selfSay(speech.message, speech.cid)
                     else
                        selfSay(speech.message)
                     end
                  end

                  self.talkDelay[i] = nil
               end
            else
               self.talkDelay[i] = nil
            end
         end

         if(self:processModuleCallback(CALLBACK_ONTHINK)) then
            if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
               for _, focus in pairs(self.focuses) do
                  if(focus ~= nil) then
                     if(not self:isInRange(focus)) then
                        self:onWalkAway(focus)
                     elseif((os.time() - self.talkStart[focus]) > self.idleTime) then
                        self:unGreet(focus)
                     else
                        self:updateFocus()
                     end
                  end
               end
            elseif(self.focuses ~= 0) then
               if(not self:isInRange(self.focuses)) then
                  self:onWalkAway(self.focuses)
               elseif((os.time() - self.talkStart) > self.idleTime) then
                  self:unGreet(self.focuses)
               else
                  self:updateFocus()
               end
            end
         end
      end
   end

   -- Tries to greet the player with the given cid.
   function NpcHandler:onGreet(cid)
      if(self:isInRange(cid)) then
         if(NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE) then
            if(not self:isFocused(cid)) then
               self:greet(cid)
               return
            end
         elseif(NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT) then
            if(self.focuses == 0) then
               self:greet(cid)
            elseif(self.focuses == cid) then
               local msg = self:getMessage(MESSAGE_ALREADYFOCUSED)
               local parseInfo = { [TAG_PLAYERNAME] = getCreatureName(cid) }
               msg = self:parseMessage(msg, parseInfo)
               self:say(msg)
            else
               if(not self.queue:isInQueue(cid)) then
                  self.queue:push(cid)
               end

               local msg = self:getMessage(MESSAGE_PLACEDINQUEUE)
               local parseInfo = { [TAG_PLAYERNAME] = getCreatureName(cid), [TAG_QUEUESIZE] = self.queue:getSize() }
               msg = self:parseMessage(msg, parseInfo)
               self:say(msg)
            end
         end
      end
   end

   -- Simply calls the underlying unGreet function.
   function NpcHandler:onFarewell(cid)
      self:unGreet(cid)
   end

   -- Should be called on this npc's focus if the distance to focus is greater then talkRadius.
   function NpcHandler:onWalkAway(cid)
      if(self:isFocused(cid)) then
         local callback = self:getCallback(CALLBACK_CREATURE_DISAPPEAR)
         if(callback == nil or callback(cid)) then
            if(self:processModuleCallback(CALLBACK_CREATURE_DISAPPEAR, cid)) then
               if(self.queue == nil or not self.queue:greetNext()) then
                  local msg = self:getMessage(MESSAGE_WALKAWAY)
                  self:resetNpc(cid)
                  self:say(self:parseMessage(msg, { [TAG_PLAYERNAME] = getPlayerName(cid) or -1 }))
                  self:releaseFocus(cid)
               end
            end
         end
      end
   end

   -- Returns true if cid is within the talkRadius of this npc.
   function NpcHandler:isInRange(cid)
      if not isPlayer(cid) then
         return false
      end

      local distance = getNpcDistanceTo(cid) or -1
      return distance ~= -1 and distance <= self.talkRadius
   end

   -- Resets the npc into it's initial state (in regard of the keyrodhandler).
   --   All modules are also receiving a reset call through their callbackOnModuleReset function.
   function NpcHandler:resetNpc(cid)
      if(self:processModuleCallback(CALLBACK_MODULE_RESET)) then
         self.keywordHandler:reset(cid)
      end
   end

   -- Makes the npc represented by this instance of NpcHandler say something.
   --   This implements the currently set type of talkdelay.
   function NpcHandler:say(message, focus, delay, force)
      local delay = delay or 0
      if(NPCHANDLER_TALKDELAY == TALKDELAY_NONE or delay <= 0) then
         if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
            selfSay(message, focus)
         else
            selfSay(message)
         end

         return
      end

      -- TODO: Add an event handling method for delayed messages
      table.insert(self.talkDelay, {
         id = getNpcId(),
         cid = focus,
         message = message,
         time = os.mtime() + (delay and delay or self.talkDelayTime),
         start = os.time(),
         force = force or false
      })
   end
end

#24 Re: Pidan el script que quieran el Sáb Ene 17, 2015 8:25 pm

Camilooh


Miembro
Script que a level 49 para abajo te puedan matar pero apareces en el templo o pierdes items ni level nada pasado 50 empiezas a perder tus items

#25 pido scripts el Lun Feb 09, 2015 2:14 pm

ander.oviedo


Miembro
Hola gente de blacktibia bueno hoy en día estoy aprendiendo a scriptear ya se mas o menos pidan el scripts q necesitan no exageren OK.
. scripts normales

#26 Re: Pidan el script que quieran Hoy a las 11:19 am

Contenido patrocinado


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

Ir a la página : 1, 2, 3  Siguiente

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

 

¿Quién está en línea?

En total hay 0 usuarios en línea: 0 Registrados, 0 Ocultos y 0 Invitado

Usuarios navegando en este foro: Ninguno

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 .