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

NPC Mounts Seller

Kudzu

Active Member
Joined
Apr 9, 2008
Messages
512
Reaction score
38
Location
localhost
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mount Seller" script="mount_seller.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="128" head="17" body="54" legs="114" feet="0" addons="2" mount="379"/>
    <parameters>
        <parameter key="message_greet" value="Welcome |PLAYERNAME|! I selling mounts: {Widow Queen}, {Racing Bird}, {War Bear}, {Black Sheep}, {Midnight Panther}, {Draptor}, {Titanica}, {Tin Lizzard}, {Blazebringer}, {Rapid Boar}, {Stampor}, {Undead Cavebear}."/>
    </parameters>
</npc>


REP :)
mount_seller.lua
PHP:
local table = {
    ["Widow Queen"] = {price = 0, id = 1},
    ["Racing Bird"] = {price = 0, id = 2},
    ["War Bear"] = {price = 0, id = 3},
    ["Black Sheep"] = {price = 0, id = 4},
    ["Midnight Panther"] = {price = 0, id = 5},
    ["Draptor"] = {price = 0, id = 6},
    ["Titanica"] = {price = 0, id = 7},
    ["Tin Lizzard"] = {price = 0, id = 8},
    ["Blazebringer"] = {price = 0, id = 9},
    ["Rapid Boar"] = {price = 0, id = 10},
    ["Stampor"] = {price = 0, id = 11},
    ["Undead Cavebear"] = {price = 0, id = 12}
}
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
     if table[msg] then
      local t = table[msg]
      talkState[talkUser] = 1
       if getPlayerPremiumDays(cid) >= 1 then
        if not getPlayerMount(cid, t.id) then
         if doPlayerRemoveMoney(cid, t.cena) then
          doPlayerAddMount(cid, t.id)
          selfSay("You lost "..t.price.." gp! for mount!", cid)
          talkState[talkUser] = 0
         else
          selfSay("Sorry, you do not have enough money!", cid)
          talkState[talkUser] = 0
         end
        else
         selfSay("You already have this mount!", cid)
         talkState[talkUser] = 0
        end
       else
        selfSay("You must be Premium!", cid)
        talkState[talkUser] = 0
       end
    else
    selfSay('What? Please told me a correct name of mount!', cid)
    talkState[talkUser] = 0
   end
   return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
any idea how to place on the map ?. want him on gm island :D. some where :D <-- lawl never mind stupid question. LAWL.. really tired.. rme it is...
 
Last edited:
Import the file of the npc into Remeres map editor then place him wherever you want him
 
[23/10/2011 21:51:36] [Warning - NpcScript::NpcScript] Can not load script: mount_seller.lua
[23/10/2011 21:51:36] cannot open mount_seller.lua: No such file or directory

i get this error in server window. i imported him into rme placed him on map..

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mount Seller" script="mount_seller.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="17" body="54" legs="114" feet="0" addons="2" mount="379"/>
<parameters>
<parameter key="message_greet" value="Welcome |PLAYERNAME|! I selling mounts: {Widow Queen}, {Racing Bird}, {War Bear}, {Black Sheep}, {Midnight Panther}, {Draptor}, {Titanica}, {Tin Lizzard}, {Blazebringer}, {Rapid Boar}, {Stampor}, {Undead Cavebear}."/>
</parameters>
</npc>

i put this in folder data/npx and saved it as an xml file

local table = {
["Widow Queen"] = {price = 0, id = 1},
["Racing Bird"] = {price = 0, id = 2},
["War Bear"] = {price = 0, id = 3},
["Black Sheep"] = {price = 0, id = 4},
["Midnight Panther"] = {price = 0, id = 5},
["Draptor"] = {price = 0, id = 6},
["Titanica"] = {price = 0, id = 7},
["Tin Lizzard"] = {price = 0, id = 8},
["Blazebringer"] = {price = 0, id = 9},
["Rapid Boar"] = {price = 0, id = 10},
["Stampor"] = {price = 0, id = 11},
["Undead Cavebear"] = {price = 0, id = 12}
}
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() 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
if table[msg] then
local t = table[msg]
talkState[talkUser] = 1
if getPlayerPremiumDays(cid) >= 1 then
if not getPlayerMount(cid, t.id) then
if doPlayerRemoveMoney(cid, t.cena) then
doPlayerAddMount(cid, t.id)
selfSay("You lost "..t.price.." gp! for mount!", cid)
talkState[talkUser] = 0
else
selfSay("Sorry, you do not have enough money!", cid)
talkState[talkUser] = 0
end
else
selfSay("You already have this mount!", cid)
talkState[talkUser] = 0
end
else
selfSay("You must be Premium!", cid)
talkState[talkUser] = 0
end
else
selfSay('What? Please told me a correct name of mount!', cid)
talkState[talkUser] = 0
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

i put in data/npc/scripts saved it as a lua.

the name for xml file is Mount Seller

the name of the lua files is mount_seller
 
Please use the quote option.
Paste your scripts, and in what directory are...
 
Last edited:
If its telling you that you have no such file or directory that means you need to recreate the mount_seller.lua file and put it in with your data/npcs/scripts.
 
I remade the file, and the npc, still doesn't work. [27/12/2011 23:18:48] [Warning - NpcScript::NpcScript] Can not load script: mount_seller.lua
[27/12/2011 23:18:48] cannot open mount_seller.lua: No such file or directory
 
Just figured it out. Sorry for the double post but I am just going to post what the problem was for my ot. (The Forgotten Server 0.2.11.2)

"script="mount_seller.lua"
see the script for my version of tfs it needed to be script=data/npc/script/mount_seller.lua
 
[27/12/2011 23:18:48] [Warning - NpcScript::NpcScript] Can not load script: mount_seller.lua
[27/12/2011 23:18:48] cannot open mount_seller.lua: No such file or directory



Please i have problem /:
 
I need an edit so you can trade x item for mount instead of using money.
Example: 50 spider silk for widow queen
 
Back
Top