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

TFS 1.X+ boat npc

Kthxbye

New Member
Joined
Jul 11, 2012
Messages
122
Reaction score
2
[Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/barrackstantchion.lua
cannot open data/npc/scripts/data/npc/scripts/barrackstantchion.lua: No such file or directory

Checked both file directory and they are there and showing everything correctly
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Barrack Stanchion" script="data/npc/scripts/barrackstantchion.lua" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="155" head="60" body="115" legs="12" feet="0" addons="2"/>
    <parameters>
        <parameter key="message_greet" value="Hello Sir |PLAYERNAME|, welcome on board." />
        <parameter key="message_farewell" value="Good bye. Come back when you want to sail." />
        <parameter key="message_idletimeout" value="Hello? Are you there? Good Bye then." />
        <parameter key="message_walkaway" value="Good bye. Recommend us if you were satisfied with our service." />
        <parameter key="message_alreadyfocused" value="Hey? I\'m here." />
    </parameters>

</npc

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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 creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    --//////////////////////GUEST CARD//////////////////////--
    -- [City Name]
    -- TALK = switching 1, 2, 3, 4 accoring to the number of cities
    -- COST = How many will costs the travel (gold coins)
    -- LEVEL = level needed to travel with this NPC
    -- STOR = True or False,
    ---------[True] if the player needs a certain storage in DATABASE.
    ---------[False] if you wanna disable this function.
    -- STORID = In case you put 'True', paste this your StorageID, required to travel.
    -- DESTINATION = X, Y, Z Position of place where will be teleported.
    --//////////////////////GUEST CARD//////////////////////--

    local travels = {
    ["Thais"] = {talk=1, cost=350, level=0,  stor=false,  storId=1010, destination={x=100, y=100, z=7}},
    ["Venore"] = {talk=2, cost=250, level=10, stor=false,  storId=1010, destination={x=100, y=100, z=7}},
    ["Ankrahmun"] = {talk=3, cost=170, level=25, stor=false,  storId=1010, destination={x=100, y=100, z=7}},
    ["Port Hope"] = {talk=4, cost=165, level=50, stor=false,  storId=1010, destination={x=100, y=100, z=7}}
    }

    for k, v in pairs(travels) do
        if(msgcontains(msg, k)) then
            if v.stor then
                if getPlayerStorageValue(cid, v.storId) > 0 then
                    selfSay('Do you want to travel to '..k..' for '..v.cost..' gold coins?', cid)
                    talkState[talkUser] = v.talk
                    else
                        selfSay('You must got Norseman Mission\'s to travel with me. Hics! Hi ckS ! Hic.', cid)
                        talkState[talkUser] = 0
                    end
                    else
                        selfSay('Do you want to travel to '..k..' for '..v.cost..' gold coins?', cid)
                        talkState[talkUser] = v.talk
                    end          
                elseif(msgcontains(msg, 'yes') and talkState[talkUser] == v.talk) then
                                if getPlayerLevel(cid) >= v.level then
                                        if(doPlayerRemoveMoney(cid, v.cost) == TRUE) then
                                                doTeleportThing(cid, v.destination, FALSE)
                                                selfSay('Traveled to '..k..'.', cid)
                                        else
                                        selfSay('Sorry, you don\'t have enough gold coins.', cid)
                                        end
                                else
                                selfSay('Sorry, you don\'t have enough level.', cid)
                                end  
                talkState[talkUser] = 0
                elseif(msgcontains(msg, 'no') and isInArray({v.talk}, talkState[talkUser]) == TRUE) then
                        talkState[talkUser] = 0
                        selfSay('Ok then.', cid)
                end
        end  

        return true
end
 
Solution
[Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/barrackstantchion.lua
cannot open data/npc/scripts/data/npc/scripts/barrackstantchion.lua: No such file or directory

Checked both file directory and they are there and showing everything correctly
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Barrack Stanchion" script="data/npc/scripts/barrackstantchion.lua" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="155" head="60" body="115" legs="12" feet="0" addons="2"/>
    <parameters>
        <parameter key="message_greet" value="Hello Sir |PLAYERNAME|, welcome on board." />
        <parameter key="message_farewell" value="Good bye. Come...
[Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/barrackstantchion.lua
cannot open data/npc/scripts/data/npc/scripts/barrackstantchion.lua: No such file or directory

Checked both file directory and they are there and showing everything correctly
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Barrack Stanchion" script="data/npc/scripts/barrackstantchion.lua" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="155" head="60" body="115" legs="12" feet="0" addons="2"/>
    <parameters>
        <parameter key="message_greet" value="Hello Sir |PLAYERNAME|, welcome on board." />
        <parameter key="message_farewell" value="Good bye. Come back when you want to sail." />
        <parameter key="message_idletimeout" value="Hello? Are you there? Good Bye then." />
        <parameter key="message_walkaway" value="Good bye. Recommend us if you were satisfied with our service." />
        <parameter key="message_alreadyfocused" value="Hey? I\'m here." />
    </parameters>

</npc

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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 creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    --//////////////////////GUEST CARD//////////////////////--
    -- [City Name]
    -- TALK = switching 1, 2, 3, 4 accoring to the number of cities
    -- COST = How many will costs the travel (gold coins)
    -- LEVEL = level needed to travel with this NPC
    -- STOR = True or False,
    ---------[True] if the player needs a certain storage in DATABASE.
    ---------[False] if you wanna disable this function.
    -- STORID = In case you put 'True', paste this your StorageID, required to travel.
    -- DESTINATION = X, Y, Z Position of place where will be teleported.
    --//////////////////////GUEST CARD//////////////////////--

    local travels = {
    ["Thais"] = {talk=1, cost=350, level=0,  stor=false,  storId=1010, destination={x=100, y=100, z=7}},
    ["Venore"] = {talk=2, cost=250, level=10, stor=false,  storId=1010, destination={x=100, y=100, z=7}},
    ["Ankrahmun"] = {talk=3, cost=170, level=25, stor=false,  storId=1010, destination={x=100, y=100, z=7}},
    ["Port Hope"] = {talk=4, cost=165, level=50, stor=false,  storId=1010, destination={x=100, y=100, z=7}}
    }

    for k, v in pairs(travels) do
        if(msgcontains(msg, k)) then
            if v.stor then
                if getPlayerStorageValue(cid, v.storId) > 0 then
                    selfSay('Do you want to travel to '..k..' for '..v.cost..' gold coins?', cid)
                    talkState[talkUser] = v.talk
                    else
                        selfSay('You must got Norseman Mission\'s to travel with me. Hics! Hi ckS ! Hic.', cid)
                        talkState[talkUser] = 0
                    end
                    else
                        selfSay('Do you want to travel to '..k..' for '..v.cost..' gold coins?', cid)
                        talkState[talkUser] = v.talk
                    end        
                elseif(msgcontains(msg, 'yes') and talkState[talkUser] == v.talk) then
                                if getPlayerLevel(cid) >= v.level then
                                        if(doPlayerRemoveMoney(cid, v.cost) == TRUE) then
                                                doTeleportThing(cid, v.destination, FALSE)
                                                selfSay('Traveled to '..k..'.', cid)
                                        else
                                        selfSay('Sorry, you don\'t have enough gold coins.', cid)
                                        end
                                else
                                selfSay('Sorry, you don\'t have enough level.', cid)
                                end
                talkState[talkUser] = 0
                elseif(msgcontains(msg, 'no') and isInArray({v.talk}, talkState[talkUser]) == TRUE) then
                        talkState[talkUser] = 0
                        selfSay('Ok then.', cid)
                end
        end

        return true
end
change
Lua:
script="data/npc/scripts/barrackstantchion.lua"
to
Lua:
script="barrackstantchion.lua"
 
Solution
Back
Top