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

Need Help!

Bhullen

New Member
Joined
Feb 16, 2008
Messages
546
Reaction score
1
Location
Sweden
Hello i need an nps that takes an item from you and then take you to a place.
like the boat npc but takes an item instead of the gold.
Like:

Player: Hi
Captain: Hello, Player i can take you to the pirates island if you give me a royal helmet.
Player: Ok
Captain: Are you sure, the helmet is worht moutch?
Player: Yes
Captain: (Takes to island)

Can someone help me whit that?
 
Well, I did it:

pirateboat.lua
Code:
local topos = {x=133, y=362, z=7, stackpos = STACKPOS_TOP_CREATURE}

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
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg) 
    if(not npcHandler:isFocused(cid)) then
        return false
    end

if msgcontains(msg, 'boat') or msgcontains(msg, 'transportation') or msgcontains(msg, 'pirate') or msgcontains(msg, 'helmet') then
 
	selfSay('Give me my Royal Helmet', cid)
	if getPlayerItemCount(cid, 2498) > 0 then
		if getPlayerSlotItem(cid, 6).itemid == 2498 then
			selfSay('You really want to go?', cid)
			talk_state = 1642
		else
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, 'Put the helmet in your right hand, below you necklace slot.')
		end
	else
		selfSay('You don\'t even have a royal helmet !', cid)
	end
elseif talk_state == 1642 then
	if msgcontains(msg, 'yes') then
		local pos = getCreaturePosition(cid)
		doPlayerRemoveItem(cid, 2498, 1)
		doTeleportThing(cid, topos, TRUE)
		doSendMagicEffet(pos, CONST_ME_ENERGYAREA) 
	elseif msgcontains(msg, 'no') then
		selfSay('Well, ok.', cid)
	end
talk_state = 0
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

PirateBoat.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Pirate Shipmaster" script="data/npc/scripts/pirateboat.lua" walkinterval="16000" floorchange="0" access="3" level="1" maglevel="1">
	<health now="150" max="150"/>
	<look type="134" head="67" body="86" legs="76" feet="57" addons="3" corpse="2212"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|, I can take you on my boat to the pirates islands if you give me a royal helmet." />
	<parameter key="message_farewell" value="YAAARRGH !" />
	</parameters>
</npc>

Just change the looktype so it look like a pirate :p

YAARRGH !

Tell me if it worked :p
 
Back
Top