Script Npc Error

S

Sasketoon

Invited
Hola estoy tratando de hacer un Npc que su funcion sea el de dar teleportear a un jugador que traiga cierto item.

Este item que el revisa que traigan los jugadores el mismo lo otorga al intercambiar 4 items por ese item.

Una vez que ya tiene ese item para poder acceder a la sala donde los envia ya no les pedira esos 4 items solo revisara que siempre que quieran ir a la sala tengan ese item.

Codigo:
local internalNpcName = "Torkada"
local npcType = Game.createNpcType(Torkada_hall)
local npcConfig = {}

npcConfig.name = internalNpcName
npcConfig.description = internalNpcName

npcConfig.health = 100
npcConfig.maxHealth = npcConfig.health
npcConfig.walkInterval = 2000
npcConfig.walkRadius = 2

npcConfig.outfit = {
lookType = 1243,
lookHead = 95,
lookBody = 113,
lookLegs = 39,
lookFeet = 115
}

npcConfig.flags = {
floorchange = false
}

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)

npcType.onThink = function(npc, interval)
npcHandler:eek:nThink(npc, interval)
end

npcType.onAppear = function(npc, creature)
npcHandler:eek:nAppear(npc, creature)
end

npcType.onDisappear = function(npc, creature)
npcHandler:eek:nDisappear(npc, creature)
end

npcType.onMove = function(npc, creature, fromPosition, toPosition)
npcHandler:eek:nMove(npc, creature, fromPosition, toPosition)
end

npcType.onSay = function(npc, creature, type, message)
npcHandler:eek:nSay(npc, creature, type, message)
end

npcType.onCloseChannel = function(npc, creature)
npcHandler:eek:nCloseChannel(npc, creature)
end

keywordHandler:addKeyword({'hi'}, StdModule.say, {npcHandler = npcHandler, text = "Hello mortal, do you have what it takes to prove your entry into the abode of my blood lord?"})

local ItemID = {43501,43502,43503,43504}
local pergamin = {12540}

local function creatureSayCallback(npc, creature, type, message)

local player = Player(creature)

if MsgContains(message, 'yes') then
for i=1, #ItemID do
if player:getItemCount(ItemID) >= 1 then
player:removeItem(ItemID, 1)
player:addItem(12540, 1)
npcHandler:say("Very well take this as a reward for defeating the main servants.!", npc, creature)
break
else
for i=1, #pergamin do
if player:getItemCount(pergamin) >= 1 then
local travelNode = keywordHandler:addKeyword({'Bakragore'}, StdModule.say, {npcHandler = npcHandler, text = 'Are you ready to face my lord {Bakragore}?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = Position(34141, 32049, 13) })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, reset = true, text = 'When you stop shaking, come back to me.'})
break
if MsgContains(message, 'no') then
npcHandler:say("Get away from my mortal presence!", npc, creature)
break
end
end
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

-- npcType registering the npcConfig table
npcType:register(npcConfig)


Gracias.
 
Solution
Hola estoy tratando de hacer un Npc que su funcion sea el de dar teleportear a un jugador que traiga cierto item.

Este item que el revisa que traigan los jugadores el mismo lo otorga al intercambiar 4 items por ese item.

Una vez que ya tiene ese item para poder acceder a la sala donde los envia ya no les pedira esos 4 items solo revisara que siempre que quieran ir a la sala tengan ese item.

Codigo:


Gracias.
Hola

Podrías usar un simple script de un capitán de barco , en la parte donde da teleport , antes, agregas la parte if player:getItemCount(…) , cuando hace el tp, en vez de seleccionar de la lista una ciudad agregas las coordenadas, y debería solo dar tp si tienes el ítem, al ser un script existente...
Hola estoy tratando de hacer un Npc que su funcion sea el de dar teleportear a un jugador que traiga cierto item.

Este item que el revisa que traigan los jugadores el mismo lo otorga al intercambiar 4 items por ese item.

Una vez que ya tiene ese item para poder acceder a la sala donde los envia ya no les pedira esos 4 items solo revisara que siempre que quieran ir a la sala tengan ese item.

Codigo:


Gracias.
Hola

Podrías usar un simple script de un capitán de barco , en la parte donde da teleport , antes, agregas la parte if player:getItemCount(…) , cuando hace el tp, en vez de seleccionar de la lista una ciudad agregas las coordenadas, y debería solo dar tp si tienes el ítem, al ser un script existente no debería de dar error.
Después para que tenga un shop si quieres para el trade fíjate a un simple npc que hace trade debe de tener un module shop que hace que al decir trade abre la ventana , agrégalo a tu script y listo.
Ando en el móvil , pero si no consigues dime qué versión y/o servidor utilizas.
 
Solution

Tibia Server Lists

#1 FEATURED US Ultron OT 1,497 / 5,000Online EXPStages PROTO8.6 ENGINEUltron OT RANK PTS5.9 +100% VOTES0 #2 FEATURED US Nefera 176 / 0Online EXPx1 PROTO15.20 ENGINECrystal Server RANK PTS5.1 +100% VOTES0 #3 FEATURED ES Deixis 1 / 0Online EXPStages PROTO1098 ENGINETFS RANK PTS3.7 +100% VOTES1 #4 FEATURED ES Maeli 10 / 150Online EXPx10 PROTO10.98 ENGINETFS 1.4.2 RANK PTS3.7 +100% VOTES0 #5 MX Marlboro War 36 / 300Online EXP999 PROTO8.6 ENGINETFS 0.3.7 RANK PTS5.5 -33% VOTES0 #6 BR Tibinha YurOts 18 / 150Online EXPStages PROTO7.4 ENGINEYurOTS 1.5 RANK PTS5.2 -14% VOTES0 #7 US Halera 2 / 0Online EXPStages PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.9 -83% VOTES0 #8 BR Exordion Legacy 52 / 2,000Online EXPx2 PROTO7.72 ENGINEExordion RANK PTS4.9 +100% VOTES0 #9 PL Lubelski 5 / 1,000Online EXP200 PROTO7.6 ENGINELubelskiOTS 2.56.0 RANK PTS4.6 -15% VOTES0 #10 DE DBU Online 0 / 400Online EXP11 PROTO8.6 ENGINETFS 1.0 RANK PTS4.3 +100% VOTES0 #11 PL ReWar 0 / 2,000Online EXPcustom PROTO8.6 ENGINEOther RANK PTS4.3 0% VOTES0 #12 PL Velesta 0 / 1,000Offline EXP20 PROTO8.0 ENGINETFS 1.4.2 RANK PTS4.3 -99% VOTES0 #13 ES JustRL FreeTC 1530 22 / 250Online EXPx2 PROTO15.30 ENGINECrystal Server RANK PTS4.3 +100% VOTES0 #14 ES Farlia Global 2026 0 / 333Offline EXPx5 PROTO15.25 ENGINEFarliaServ 1.525 RANK PTS3.9 -22% VOTES0 #15 SE MortalisOT Custom 0 / 500Offline EXP100x -1.2x PROTO10.98 ENGINEMortalisOT V1 RANK PTS3.8 +100% VOTES0 #16 US Rommania 0 / 500Online EXPstages, x10 PROTO7.4 ENGINETFS 0.4 RANK PTS3.6 +100% VOTES0 #17 US BerethaOnline 3 / 2,000Online EXPStages PROTO10.98 ENGINETFS RANK PTS3.5 +100% VOTES0
Top