• 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!

NPC to check level and teleport

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,812
Solutions
6
Reaction score
822
Hello,
I want a npc you talk to him

Me: Hi
Npc: Hello Dear Warrior, Are you level X now?
Me: Yes
Npc: Are you ready to meet the world?
Me: Yes
Then i get teleported to X place

If he isnt level X, it says, Sorry but you are not level X yet.
If i say no
He says: Dont give up, I know you can do it!

Im using tfs 0.3.6pl1
 
travel.lua
Code:
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
			
	local travelNode = keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Are you ready to meet the world?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=2032, y=2140, z=6} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'dont give up, I know you can do it!'})
			
        npcHandler:addModule(FocusModule:new())
captain traveller.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Captain Traveller" script="data/npc/scripts/teleport.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="129" head="19" body="69" legs="107" feet="50" addons="0"/>
    <parameters>
        <parameter key="message_greet" value="Hello Dear Warrior, Are you level {X} now?"/>
        <parameter key="message_farewell" value="Dont give up, I know you can do it!"/>
    </parameters>
</npc>
 
Back
Top