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

Windows Warper!!

Arkangel Nyx

Member
Joined
Feb 23, 2012
Messages
176
Reaction score
6
Location
U.S.A.
I have made a warper on my server (an npc that teleports you to specific locations.) As of right now i have it so it shows you a list of places you can go like as follows

Where would you like to travel too? Carlin, Thais, or Pits of inferno?(just an example)

So to travel to one of those places you say one of those three names. Heres how i WANT it though.

Where would you like to travel? 1 (Carlin), 2 (Thais), 3 (Pits of Inferno)

and then to travel to one of those places...you say the NUMBER not the NAME, but i still want the name to be visible to the user in parenthesis so they know where they are going. See what i'm saying? Anyways if you know how to do that i got you with REP++.

Thanks Otland.

- - - Updated - - -

Hers the script:

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Geoffrey" script="default.lua" walkinterval="0" floorchange="0">
<health now="150" max="150"/>
<look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/>
<parameters>
<parameter key="module_travel" value="1"/>
<parameter key="message_greet" value="Hello |PLAYERNAME|. To see a list of locations to teleport too, say {travel}."/>
<parameter key="travel_destinations" value="Carlin",901,844,5,50;Hell,1354,1360,7,50;th ais,248,1455,7,50;Pits of inferno,612,1356,7,50;Graveyard,717,732,7,50;Cults ,905,942,8,50;Hero's,563,751,11,50"/>
</parameters>
</npc>
 
untested

XML file

XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Geoffrey" script="data/npc/scripts/travelFile.lua" walkinterval="0" floorchange="0">
<health now="150" max="150"/>
<look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/>
<parameters>
<parameter key="message_farewell" value="Good bye. Recommend us if you were satisfied with our service." />
<parameter key="message_walkaway" value="Good bye. Recommend us if you were satisfied with our service." />
 <parameter key="message_greet" value="Welcome aboard, |PLAYERNAME|. To see a list of locations to teleport to, say {travel}."/>
</parameters>
</npc>


LUA file (travelFile.lua)

LUA:
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
        
        
        -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
        local travelNode = keywordHandler:addKeyword({'1'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Carlin for 50 gold?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 50, destination = {x=901, y=844, z=5} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
        
	local travelNode = keywordHandler:addKeyword({'2'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Thais for 50 gold?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 50, destination = {x=248, y=1455, z=7} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
        
	local travelNode = keywordHandler:addKeyword({'3'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to the Pits of Inferno for 50 gold?'})
        	travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 50, destination = {x=612, y=1356, z=7} })
        	travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})

        keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Where do you want to go? {1} (Carlin), {2} (Thais), {3} (Pits of Inferno).'})
        keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
		keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
       

        npcHandler:addModule(FocusModule:new())
 
Back
Top