ignas1415
Senior Member
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
npc/script/boat.lua
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: