NPC Mount NPC w/mounts and lua script

JohnJohn90

Member
Joined
Apr 29, 2011
Messages
70
Best answers
0
Reaction score
4
Location
USA
Hello Guys done some searching and figured that i would add what i was looking for all in one place!


goto mounts.xml and add
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mounts>
    <mount id="1" clientid="368" name="Widow Queen" speed="20" premium="yes" />
    <mount id="2" clientid="369" name="Racing Bird" speed="20" premium="yes" />
    <mount id="3" clientid="370" name="War Bear" speed="20" premium="yes" />
    <mount id="4" clientid="371" name="Black Sheep" speed="20" premium="yes" />
    <mount id="5" clientid="372" name="Midnight Panther" speed="20" premium="yes" />
    <mount id="6" clientid="373" name="Draptor" speed="20" premium="yes" />
    <mount id="7" clientid="374" name="Titanica" speed="20" premium="yes" />
    <mount id="8" clientid="375" name="Tin Lizzard" speed="20" premium="yes" />
    <mount id="9" clientid="376" name="Blazebringer" speed="20" premium="yes" />
    <mount id="10" clientid="377" name="Rapid Boar" speed="20" premium="yes" />
    <mount id="11" clientid="378" name="Stampor" speed="20" premium="yes" />
    <mount id="12" clientid="379" name="Undead Cavebear" speed="20" premium="yes" />
    <mount id="13" clientid="387" name="Mule" speed="20" premium="yes" />
    <mount id="14" clientid="388" name="Tiger Slug" speed="20" premium="yes" />
    <mount id="15" clientid="389" name="Uniwheel" speed="20" premium="yes" />
    <mount id="16" clientid="390" name="Crystal Wolf" speed="20" premium="yes" />
    <mount id="17" clientid="392" name="War Horse" speed="20" premium="yes" />
    <mount id="18" clientid="401" name="Kingly Deer" speed="20" premium="yes" />
    <mount id="19" clientid="402" name="Tamed Panda" speed="20" premium="yes" />
    <mount id="20" clientid="405" name="Dromedary" speed="20" premium="yes" />
    <mount id="21" clientid="406" name="Sandstone Scorpion" speed="20" premium="yes" />
    <mount id="22" clientid="421" name="Rented Horse" speed="20" premium="yes" />
    <mount id="23" clientid="426" name="Fire War Horse" speed="20" premium="yes" />
    <mount id="24" clientid="427" name="Shadow Draptor" speed="20" premium="yes" />
    <mount id="25" clientid="437" name="Rented Horse" speed="20" premium="yes" />
    <mount id="26" clientid="438" name="Rented Horse" speed="20" premium="yes" />
</mounts>
create an npc xml and insert it into data/npcs name it as mountseller.xml


Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mount Seller" script="mountseller.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}, {Mule}, {Tiger Slug}, {Uniwheel}, {Crystal Wolf}, {War Horse}, {Kingly Deer}, {Tamed Panda}, {Dramedary}, {Sandstone Scorpion}, {Rented Horse 1}, {Fire War Horse}, {Shadow Draptor}, {Rented Horse 2}, {Rented Horse 3}}."/>
    </parameters>
</npc>


now goto data/npc/scripts and add create this file mountseller.lua

Code:
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},
    ["Mule"] = {price = 0, id = 13},
    ["Tiger Slug"] = {price = 0, id = 14},
    ["Uniwheel"] = {price = 0, id = 15},
    ["Crystal Wolf"] = {price = 0, id = 16},
    ["War Horse"] = {price = 0, id = 17},
    ["Kingly Deer"] = {price = 0, id = 18},
    ["Tamed Panda"] = {price = 0, id = 19},
    ["Dramedary"] = {price = 0, id = 20},
    ["Sandstone Scorion"] = {price = 0, id = 21},
    ["Rented Horse 1"] = {price = 0, id = 22},
    ["Fire War Horse"] = {price = 0, id = 23},
    ["Shadow Draptor"] = {price = 0, id = 24},
    ["Rented Horse 2"] = {price = 0, id = 25},
    ["Rented Horse 3"] = {price = 0, id = 26}
} 
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())
tested in 9.44 as of now and worked just didnt fell like adding newer mounts into script easy to do yourself though if i done everthing for you how would you learn anything
 
Last edited:

haohellstorm

New Member
Joined
Dec 20, 2010
Messages
13
Best answers
0
Reaction score
0
you got the new server version or have tested it? anyway thanks
 
OP
JohnJohn90

JohnJohn90

Member
Joined
Apr 29, 2011
Messages
70
Best answers
0
Reaction score
4
Location
USA
Not tested yet

I have yet to be able to test i had a slight machanical malfunction with fist to my cpu and i have to get a new cpu.When i do i will test and give status for yall!
 
OP
JohnJohn90

JohnJohn90

Member
Joined
Apr 29, 2011
Messages
70
Best answers
0
Reaction score
4
Location
USA
cant get npc to spawn even when using remears but made gm and i have al mounts that i added all mounts are on server my server is Project Name
The Forgotten Server

Version
0.2.11pl2

Codenamed
"Mystic Spirit"
runing on a 9.2
 
OP
JohnJohn90

JohnJohn90

Member
Joined
Apr 29, 2011
Messages
70
Best answers
0
Reaction score
4
Location
USA
loading a video shortly of working mounts [video=youtube;YigMwAlywwE]http://www.youtube.com/watch?v=YigMwAlywwE&feature=youtu.be[/video]
 
Last edited:

Dylanaw

Godly Member
Joined
Feb 18, 2009
Messages
473
Best answers
0
Reaction score
9
[01/05/2012 21:49:24] [Error - LuaScriptInterface::loadFile] data/npc/scripts/mountseller.lua:14: '}' expected (to close '{' at line 1) near '['
[01/05/2012 21:49:24] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/mountseller.lua
[01/05/2012 21:49:24] data/npc/scripts/mountseller.lua:14: '}' expected (to close '{' at line 1) near '['

Hmm what is wrong?
 

Dylanaw

Godly Member
Joined
Feb 18, 2009
Messages
473
Best answers
0
Reaction score
9
GO open mountseller.lua Find line 14 and look what is wrong :) easy to fix^^
I don't know how to fix it.
Can anyone help me, that knows how to fix it?

___________________________

Code:
[01/05/2012 21:49:24] [Error - LuaScriptInterface::loadFile] data/npc/scripts/mountseller.lua:14: '}' expected (to close '{' at line 1) near '['
[01/05/2012 21:49:24] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/mountseller.lua
[01/05/2012 21:49:24] data/npc/scripts/mountseller.lua:14: '}' expected (to close '{' at line 1) near '['
Code:
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} 
    ["Mule"] = {price = 0, id = 13}
    ["Tiger Slug"] = {price = 0, id = 14}
    ["Uniwheel"] = {price = 0, id = 15}
    ["Crystal Wolf"] = {price = 0, id = 16}
    ["War Horse"] = {price = 0, id = 17}
    ["Kingly Deer"] = {price = 0, id = 18}
    ["Tamed Panda"] = {price = 0, id = 19}
    ["Dramedary"] = {price = 0, id = 20}
    ["Sandstone Scorion"] = {price = 0, id = 21}
    ["Rented Horse 1"] = {price = 0, id = 22}
    ["Fire War Horse"] = {price = 0, id = 23}
    ["Shadow Draptor"] = {price = 0, id = 24}
    ["Rented Horse 2"] = {price = 0, id = 25}
    ["Rented Horse 3"] = {price = 0, id = 26}
} 
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())
 

pepe

Webón
Joined
Aug 12, 2007
Messages
127
Best answers
0
Reaction score
18
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},
    ["Mule"] = {price = 0, id = 13},
    ["Tiger Slug"] = {price = 0, id = 14},
    ["Uniwheel"] = {price = 0, id = 15},
    ["Crystal Wolf"] = {price = 0, id = 16},
    ["War Horse"] = {price = 0, id = 17},
    ["Kingly Deer"] = {price = 0, id = 18},
    ["Tamed Panda"] = {price = 0, id = 19},
    ["Dramedary"] = {price = 0, id = 20},
    ["Sandstone Scorion"] = {price = 0, id = 21},
    ["Rented Horse 1"] = {price = 0, id = 22},
    ["Fire War Horse"] = {price = 0, id = 23},
    ["Shadow Draptor"] = {price = 0, id = 24},
    ["Rented Horse 2"] = {price = 0, id = 25},
    ["Rented Horse 3"] = {price = 0, id = 26}
} 
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())
lol
 

azzkaban

Monster Maker
Joined
Feb 23, 2010
Messages
1,096
Best answers
0
Reaction score
182
Location
Iquique Chile
[Error - LuaInterface::loadFile] data/npc/scripts/vende mount.lua:14: '}' expected (to close '{' at line 1) near '['
[6/5/2012 10:27:48] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/vende mount.lua
[6/5/2012 10:27:48] data/npc/scripts/vende mount.lua:14: '}' expected (to close '{' at line 1) near '['
[6/5/2012 10:29:5] [Error - LuaInterface::loadFile] data/npc/scripts/vende mount.lua:14: '}' expected (to close '{' at line 1) near '['
[6/5/2012 10:29:5] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/vende mount.lua
[6/5/2012 10:29:5] data/npc/scripts/vende mount.lua:14: '}' expected (to close '{' at line 1) near '['
 

Critico

Sexy
Joined
Mar 25, 2010
Messages
358
Best answers
0
Reaction score
162
Code:
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} ,
    ["Mule"] = {price = 0, id = 13},
    ["Tiger Slug"] = {price = 0, id = 14},
    ["Uniwheel"] = {price = 0, id = 15},
    ["Crystal Wolf"] = {price = 0, id = 16},
    ["War Horse"] = {price = 0, id = 17},
    ["Kingly Deer"] = {price = 0, id = 18},
    ["Tamed Panda"] = {price = 0, id = 19},
    ["Dramedary"] = {price = 0, id = 20},
    ["Sandstone Scorion"] = {price = 0, id = 21},
    ["Rented Horse 1"] = {price = 0, id = 22},
    ["Fire War Horse"] = {price = 0, id = 23},
    ["Shadow Draptor"] = {price = 0, id = 24},
    ["Rented Horse 2"] = {price = 0, id = 25},
    ["Rented Horse 3"] = {price = 0, id = 26}
}
is missing "," in the tabble
 
OP
JohnJohn90

JohnJohn90

Member
Joined
Apr 29, 2011
Messages
70
Best answers
0
Reaction score
4
Location
USA
Guys if your having problems with mounts or scripts please remember what server distro i posted if the server isnt the same then you will have bugs. I had no bugs on mine so i wont be able to help so if another member of otland gives you advice try it out. It should work with tweeks and exc... sorry about not being on much kinda havent had a computer for a few months but now im bak so ask away may take a couple days for reply but il be bak on shortly
 
OP
JohnJohn90

JohnJohn90

Member
Joined
Apr 29, 2011
Messages
70
Best answers
0
Reaction score
4
Location
USA
If anyone needs help on creating quests to recieve mounts let me know and il help you its easy if you have a lil experience with remeres and luas
 
OP
JohnJohn90

JohnJohn90

Member
Joined
Apr 29, 2011
Messages
70
Best answers
0
Reaction score
4
Location
USA
i have 9.44 mounts with working quest scripts if any one needs them related to post @up
 
OP
JohnJohn90

JohnJohn90

Member
Joined
Apr 29, 2011
Messages
70
Best answers
0
Reaction score
4
Location
USA
Code:
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} ,
    ["Mule"] = {price = 0, id = 13},
    ["Tiger Slug"] = {price = 0, id = 14},
    ["Uniwheel"] = {price = 0, id = 15},
    ["Crystal Wolf"] = {price = 0, id = 16},
    ["War Horse"] = {price = 0, id = 17},
    ["Kingly Deer"] = {price = 0, id = 18},
    ["Tamed Panda"] = {price = 0, id = 19},
    ["Dramedary"] = {price = 0, id = 20},
    ["Sandstone Scorion"] = {price = 0, id = 21},
    ["Rented Horse 1"] = {price = 0, id = 22},
    ["Fire War Horse"] = {price = 0, id = 23},
    ["Shadow Draptor"] = {price = 0, id = 24},
    ["Rented Horse 2"] = {price = 0, id = 25},
    ["Rented Horse 3"] = {price = 0, id = 26}
}
is missing "," in the tabble
no comma missing i checked it all in place so it appears that you probally just missed something when you copied it bc i took it straight out of my file and selected all to copy so i didn't miss it try recopying
 
Top