• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Add function ifItem to NPC

BugaS

Donżuan
Joined
Mar 12, 2009
Messages
1,219
Reaction score
9
Location
NYC
Hey guys!

I've got this NPC script:

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
--Na Facc
local travelNode = keywordHandler:addKeyword({'stone'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Have you got a stone?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 1, cost = 0, destination = {x=921, y=92, z=7}})
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Tell me when you will be ready.'})

Please add there a function (after "yes" on NPC question 'Have you got a stone?') which will check that player got specific item, than remove it from player and give another one. And after player's 'yes' the NPC will say 'Are you ready for a tournament?' if player say 'yes' the NPC will teleport player to specific position. Thanks guys!
 
Back
Top