• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Once travel NPC!

ignas1415

Senior Member
Joined
May 15, 2008
Messages
54
Reaction score
0
Location
Europa/Poland
Hello.
Scrypt NPC which moves us into a
place only once!
100% by ignas1415
1.0v
Beta script.
2.0v
+Can add few destinations!!
The script is for example quest place. You can only travel once
npc/captain.xml
Code:
  <?xml version="1.0" encoding="UTF-8" ?> 
- <npc name="Danny" script="data/npc/scripts/Boat.lua" walkinterval="2000" floorchange="0">
  <health now="100" max="100" /> 
  <look type="130" head="19" body="71" legs="128" feet="128" corpse="2212" /> 
- <parameters>
  <parameter key="message_greet" value="Welcome on board |PLAYERNAME|!" /> 
  <parameter key="module_keywords" value="1" /> 
  <parameter key="keywords" value="travel" /> 
  <parameter key="keyword_reply1" value="Need transport?" /> 
 
  </parameters>
  </npc>

npc/script/boat.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

function travel(cid, message, keywords, parameters, node)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

  if getPlayerStorageValue(cid, 63888) == 1 then
  			npcHandler:say("You can not travel with me, I can carry you only once.", cid)
elseif isPremium(cid) == TRUE then
		if doPlayerRemoveMoney(cid, 5000) == TRUE then
					doTeleportThing(cid, parameters.travel)
			                setPlayerStorageValue(cid, 63888, 1)
			npcHandler:say("GO GO!", cid)
		else
			npcHandler:say("You don't have enough money.", cid)
		end
	else
		npcHandler:say("You need a premium account to travel.", cid)
	end

	keywordHandler:moveUp(1)
	return true
end

local node5 = keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to travel the NAME for 5000 gold coins?'})
	node5:addChildKeyword({'yes'}, travel, {travel = {x = 434, y = 550, z = 7}})
	node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'You should think it over once more.'})

npcHandler:addModule(FocusModule:new())
 
Last edited:
the quest to rule them all :O! this is nice (i will try and use it xD)
 
So he should prepare for this quest to not waste one chance.
 
It's not fully for quest, it is too for example teleport to npc it have good price and you can sell one time. If you do this for quest must use this!
\actions\actions.xml\ ADD
Code:
	 <action itemid="2709" script="chest.lua" />
 <action itemid="2720" script="chest.lua" />
 <action itemid="1413" script="chest.lua" />
 <action itemid="1740" script="chest.lua" />
 <action itemid="1747" script="chest.lua" />
 <action itemid="1748" script="chest.lua" />
 <action itemid="1749" script="chest.lua" />
 <action itemid="1770" script="chest.lua" />
\actions\scripts\chest.lua
Code:
function onUse(cid, item, frompos, item2, topos)

QUEST

	if item.uid == 63888 then
 queststatus = getPlayerStorageValue(cid,63888)
 if queststatus == -1 then
 	doPlayerSendTextMessage(cid,22,"You have name.")
 	doPlayerAddItem(cid,xxxx,1)
 	setPlayerStorageValue(cid,63888,1)
 else
 	doPlayerSendTextMessage(cid,22,"You have alread made your decision.")
 end
 
 	end
   	return 1
   end



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

function travel(cid, message, keywords, parameters, node)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

  if getPlayerStorageValue(cid, 63888) == 1 then
  			npcHandler:say("You can not travel with me, I can carry you only once.", cid)
elseif isPremium(cid) == TRUE then
		if doPlayerRemoveMoney(cid, 5000) == TRUE then
					doTeleportThing(cid, parameters.travel)
			npcHandler:say("GO GO!", cid)
		else
			npcHandler:say("You don't have enough money.", cid)
		end
	else
		npcHandler:say("You need a premium account to travel.", cid)
	end

	keywordHandler:moveUp(1)
	return true
end

local node5 = keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to travel the NAME for 5000 gold coins?'})
	node5:addChildKeyword({'yes'}, travel, {travel = {x = 434, y = 550, z = 7}})
	node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'You should think it over once more.'})

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