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,455 / 5,000 EXPStages PROTO8.6 ENGINEUltron OT RANK PTS6.6 -9% VOTES0 #2 FEATURED US Nefera 208 / 0 EXPx1 PROTO15.20 ENGINECrystal Server RANK PTS5.9 +24% VOTES0 #3 FEATURED CL ZHYRAVEX 14 / 500 EXPx5 PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.8 +100% VOTES0 #4 FEATURED ES Deixis 0 / 0 EXPStages PROTO1098 ENGINETFS RANK PTS4.0 -60% VOTES1 #5 DE DBU Online 215 / 400 EXP11 PROTO8.6 ENGINETFS 1.0 RANK PTS6.1 +1,000% VOTES0 #6 BR Exordion Legacy 62 / 2,000 EXPx2 PROTO7.72 ENGINEExordion RANK PTS5.7 +1% VOTES0 #7 MX Marlboro War 43 / 300 EXP999 PROTO8.6 ENGINETFS 0.3.7 RANK PTS5.5 -27% VOTES0 #8 BR Tibinha YurOts 31 / 150 EXPStages PROTO7.4 ENGINEYurOTS 1.5 RANK PTS5.5 +5% VOTES0 #9 US Wiki Ots 55 / 1,000 EXPx9999 PROTOcustom client ENGINETFS 1.4.2 RANK PTS5.1 +100% VOTES0 #10 ES JustRL FreeTC 1530 14 / 250 EXPx2 PROTO15.30 ENGINECrystal Server RANK PTS5.0 +15% VOTES0 #11 PL Lubelski 2 / 1,000 EXP200 PROTO7.6 ENGINELubelskiOTS 2.56.0 RANK PTS4.9 -16% VOTES0 #12 PL ReWar 0 / 2,000 EXPcustom PROTO8.6 ENGINEOther RANK PTS4.6 +100% VOTES0 #13 US Halera 0 / 0 EXPStages PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.4 -83% VOTES0 #14 PL Velesta 0 / 1,000 EXP20 PROTO8.0 ENGINETFS 1.4.2 RANK PTS4.4 -100% VOTES0 #15 BR Turion Server 0 / 2,000 EXPx1 PROTO7.4 ENGINETurion 7.7 Project RANK PTS4.4 +156% VOTES0 #16 US BerethaOnline 0 / 2,000 EXPStages PROTO15.0 ENGINETFS RANK PTS4.3 -72% VOTES0 #17 ES Farlia Global 2026 0 / 333 EXPx5 PROTO15.25 ENGINEFarliaServ 1.525 RANK PTS4.0 -100% VOTES0 #18 SE MortalisOT Custom 0 / 500 EXP100x -1.2x PROTO10.98 ENGINEMortalisOT V1 RANK PTS4.0 -100% VOTES0 #19 RU Oldavia | 8.60 0 / 0 EXPx9999 PROTO8.6 ENGINETFS 1.3 RANK PTS3.9 +100% VOTES0 #20 BR Rethoria OpenToday 7.4 Custom 7 / 0 EXPx10 PROTO10.98 ENGINEOther RANK PTS3.8 +100% VOTES0 #21 US Rommania 0 / 3,000 EXPstages, x10 PROTO7.4 ENGINETFS 0.4 RANK PTS3.7 -88% VOTES0 #22 MX Maeli 0 / 150 EXPx10 PROTO10.98 ENGINETFS 1.4.2 RANK PTS3.5 -36% VOTES0 #23 ES DarkDragon EXPx10 PROTO8.6 ENGINECanary RANK PTS0.0 0% VOTES0
Top