• 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 Npc Examples

Mokerhamer

Retired Global Mod
Joined
Aug 6, 2007
Messages
1,767
Best answers
0
Reaction score
35
yea i stole this from ******, if you want to whine because i took the npc examples from an other forum, Please go to the richt top of your screen and click on the X.

If you want more examples tell me what kind of npc and i'll make an example from it

Thx for reminindig me Ispro i totally forgot it!
Credits to Jiddo for maiking the examples!

Npcs:
data\npc\Distance.xml:
Code:
<npc name="Frenzy" script="data/npc/scripts/distance.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="134" head="57" body="59" legs="40" feet="76" corpse="2212"/>
    <parameters>
        <parameter key="module_shop" value="1" />
        <parameter key="shop_sellable" value="crossbow,2455,150;bow,2456,130" />
        <parameter key="shop_buyable" value="crossbow,2455,360;bow,2456,200;spear,2389,20;power bolt,2547,200;burst arrow,2546,56;poison arrow,2545,18;bolt,2543,3;arrow,2544,2" />
    </parameters>
</npc>
data\npc\scripts\distance.lua:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
npcHandler:addModule(FocusModule:new())
data\npc\Boat.xml (most functions in boat.xml):
Code:
<npc name="Captain Steven" script="data/npc/scripts/travel.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="133" head="20" body="120" legs="75" feet="13" corpse="2212"/>
    <parameters>
        <parameter key="module_travel" value="1" />
        <parameter key="travel_destinations" value="derelin,1294,429,6,119;farda,865,251,6,123;taqinata,868,690,6,134" />
 
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="job;name;offer;help;mission;quest" />
        <parameter key="keyword_reply1" value="I am the captain of this ship." />
        <parameter key="keyword_reply2" value="My name is Steven. Why do you ask?" />
        <parameter key="keyword_reply3" value="I offer only the possability to travel to far away cities on this continent." />
        <parameter key="keyword_reply4" value="Do I look like a helpful guy to you?" />
        <parameter key="keyword_reply5" value="What are you talking about?" />
        <parameter key="keyword_reply6" value="Hum. I'll tell you what! If you come back in a month or so I might be able to help you with that my friend." />
    </parameters>
</npc>
data\npc\scripts\travel.lua:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
 
 
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
data\npc\Boat.xml (All functions are in lua):
Code:
<npc name="Captain Steven" script="data/npc/scripts/travel.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="133" head="20" body="120" legs="75" feet="13" corpse="2212"/>
    <parameters>
 
    </parameters>
</npc>
data\npc\scripts\travel.lua:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
 
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'derelin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Derelin for 119 gold coins?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 119, destination = {x=1367, y=403, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'})
 
local travelNode = keywordHandler:addKeyword({'drunia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Drunia for 123 gold coins?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 123, destination = {x=967, y=247, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})
 
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Derelin or Drunia for just a small fee.'})
 
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
[/quote]

data\npc\King.xml:
Code:
<npc name="The King" script="data/npc/scripts/promotion.lua" autowalk="0" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="137" head="140" body="64" legs="121" feet="76" corpse="2212"/>
    <parameters>
        <parameter key="message_farewell" value="Farewell |PLAYERNAME|!" />
    </parameters>
</npc>
data\npc\script\promotion.lua:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
    node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, promotions = {[1] = 5, [2] = 6, [3] = 7, [4] = 8}, cost = 20000, level = 20, text = 'Congratulations! You are now promoted.'})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Allright then. Come back when you are ready.', reset = true})
 
npcHandler:addModule(FocusModule:new())
data\npc\Oracle.xml:
Code:
<npc name="The Oracle" script="data/npc/scripts/oracle.lua" autowalk="0" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look typeex="1448" corpse="2212"/>
    <parameters>
 
    </parameters>
</npc>
data\npc\scripts\oracle.lua:
Code:
local LEVEL = 8
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
 
function oracle(cid, message, keywords, parameters, node)
    if(cid ~= npcHandler.focus) then
        return false
    end
 
    local cityNode = node:getParent():getParent()
    local vocNode = node:getParent()
 
    local destination = cityNode:getParameters().destination
    local townid = cityNode:getParameters().townid
    local voc = vocNode:getParameters().voc
 
    if(destination ~= nil and voc ~= nil and townid ~= nil) then
        if(getPlayerLevel(cid) < parameters.level) then
            npcHandler:say('You must first reach level ' .. parameters.level .. '!')
        else
            doPlayerSetVocation(cid,voc)
            doPlayerSetTown(cid,townid)
            --doPlayerSetMasterPos(cid,destination)
            doTeleportThing(cid,destination)
        end
    else
        error('Destination:', destination, 'Vocation:', vocation, 'Townid:', townid)
    end
    npcHandler:resetNpc()
    return true
end
 
 
function greetCallback(cid)
    if(getPlayerLevel(cid) < LEVEL) then
        npcHandler:say('CHILD! COME BACK WHEN YOU HAVE GROWN UP!')
        return false
    else
        return true
    end
end
 
-- Set the greeting callback function
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
 
-- Set the greeting message.
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|. Are you prepared to face your destiny?')
 
-- Pre-create the yes/no nodes.
local yesNode = KeywordNode:new({'yes'}, oracle, {level = LEVEL})
local noNode = KeywordNode:new({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then what vocation do you want to become?'})
 
-- Create the actual keyword structure...
local node1 = keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'What city do you wish to live in? Derelin or Drunia?'})
    local node2 = node1:addChildKeyword({'derelin'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 3, destination = {x=1330, y=368, z=7}, text = 'The desert city of Derelin, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'})
        local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
 
    local node2 = node1:addChildKeyword({'drunia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, townid = 1, destination = {x=939, y=263, z=7}, text = 'The town of Drunia, eh? So what vocation do you wish to become? Sorcerer, druid, paladin or knight?'})
        local node3 = node2:addChildKeyword({'sorcerer'}, StdModule.say, {npcHandler = npcHandler, voc = 1, onlyFocus = true, text = 'So, you wish to be a powerful magician? Are you sure about that? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'druid'}, StdModule.say, {npcHandler = npcHandler, voc = 2, onlyFocus = true, text = 'Are you sure that a druid is what you wish to become? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'paladin'}, StdModule.say, {npcHandler = npcHandler, voc = 3, onlyFocus = true, text = 'A ranged marksman. Are you sure? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
        local node3 = node2:addChildKeyword({'knight'}, StdModule.say, {npcHandler = npcHandler, voc = 4, onlyFocus = true, text = 'A mighty warrior. Is that your final decision? This decision is irreversible!'})
            node3:addChildKeywordNode(yesNode)
            node3:addChildKeywordNode(noNode)
 
keywordHandler:addKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Then come back when you are ready.'})
 
-- Make it react to hi/bye etc.
npcHandler:addModule(FocusModule:new())
data\npc\Runes.xml:
Code:
<npc name="Mike" script="data/npc/scripts/runes.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="130" head="39" body="122" legs="125" feet="57" corpse="2212"/>
    <parameters>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. Do you want to buy any spell runes?" />
        <parameter key="message_needmoremoney" value="You do not have enough money." />
        <parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you? Get out of here!" />
    </parameters>
</npc>
data\npc\scripts\runes.lua:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
 
shopModule:addBuyableItem({'light wand', 'lightwand'},         2163, 500,         'magic light wand')
shopModule:addBuyableItem({'mana fluid', 'manafluid'},         2006, 100,     7,     'mana fluid')
shopModule:addBuyableItem({'life fluid', 'lifefluid'},         2006, 80,     10,    'life fluid')
shopModule:addBuyableItem({'heavy magic missile', 'hmm'},     2311, 125,     10,    'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball', 'gfb'},             2304, 180,     4,     'great fireball rune')
shopModule:addBuyableItem({'explo', 'xpl'},                     2313, 250,     6,     'explosion rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'},         2273, 175,     2,     'ultimate healing rune')
shopModule:addBuyableItem({'sudden death', 'sd'},             2268, 325,     2,     'sudden death rune')
shopModule:addBuyableItem({'blank', 'rune'},                     2260, 10,         'blank rune')
 
 
npcHandler:addModule(FocusModule:new())

Npc buys all empty vial script:

add this at the bottem of data/global.lua:
Code:
PLAYERSLOT_FIRST = 1
PLAYERSLOT_LAST = 10
function removePlayerItemsWithCharges(cid, itemid, charges)
    if(isItemRune(itemid) ~= TRUE and isItemFluidContainer(itemid) ~= TRUE) then
        error('[Error] removePlayerItemsWithCharges: Item ' .. itemid .. ' is not a rune or fluid container.', 2)
        return 0
    end
 
    local n = 0
 
    for slot = PLAYERSLOT_FIRST, PLAYERSLOT_LAST, 1 do
        local item = getPlayerSlotItem(cid, slot)
        if(item.itemid > 0) then
            if(item.itemid == itemid and item.type == charges) then
                if(doRemoveItem(item.uid, -1) == LUA_NO_ERROR) then
                    n = n + 1
                else
                    print('[Warning] removePlayerItemsWithCharges: ', 'Could not remove item with uid ' .. item.uid)
                end
            elseif(isContainer(item.uid) == TRUE) then
                n = n + removeContainerItemsWithCharges(item.uid, itemid, charges)
            end
        end
    end
 
    return n
 
end
 
function removeContainerItemsWithCharges(uid, itemid, charges)
    if(isItemRune(itemid) ~= TRUE and isItemFluidContainer(itemid) ~= TRUE) then
        error('[Error] removeContainerItemsWithCharges: Item ' .. itemid .. ' is not a rune or fluid container.', 2)
        return 0
    end
 
    local n = 0
 
    local slot = 0
    local cap = getContainerCap(uid)
    while(slot <= cap) do
        local item = getContainerItem(uid, slot)
        if(item.itemid > 0) then
            if(item.itemid == itemid and item.type == charges) then
                if(doRemoveItem(item.uid, -1) == LUA_NO_ERROR) then
                    n = n+1
                    slot = slot-1
                else
                    print('[Warning] removeContainerItemsWithCharges: ', 'Could not remove item with uid ' .. item.uid)
                end
            elseif(isContainer(item.uid) == TRUE) then
                n = n + removeContainerItemsWithCharges(item.uid, itemid, charges)
            end
        end
        slot = slot+1
    end
 
    return n
end
the buy vials buildet in the rune npc data/npcs/scripts/runes.lua:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
 
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
 
function returnVials(cid, message, keywords, parameters, node)
    if(npcHandler.focus ~= cid) then
        return false
    end
 
    local amount = removePlayerItemsWithCharges(cid, parameters.itemid, parameters.charges)
    if(amount <= 0) then
        npcHandler:say('You do not have any.')
    else
        local price = amount*parameters.cost
        if(doPlayerAddMoney(cid, price) == LUA_NO_ERROR) then
            npcHandler:say('Here are your reward of ' .. price .. ' gold coins. It was a pleasure doing business with you.')
        else
            error('[Error] returnVials:', 'Could not give ' .. price .. ' gold coins to player ' .. getPlayerName(cid))
        end
    end
    npcHandler:resetNpc()
    return true
end
 
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
 
shopModule:addBuyableItem({'light wand', 'lightwand'},         2163, 500,     1,    'magic light wand')
shopModule:addBuyableItem({'mana fluid', 'manafluid'},         2006, 100,     7,     'mana fluid')
shopModule:addBuyableItem({'life fluid', 'lifefluid'},         2006, 80,     10,    'life fluid')
shopModule:addBuyableItem({'heavy magic missile', 'hmm'},     2311, 125,     10,    'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball', 'gfb'},             2304, 180,     4,     'great fireball rune')
shopModule:addBuyableItem({'explo', 'xpl'},                     2313, 250,     6,     'explosion rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'},         2273, 175,     2,     'ultimate healing rune')
shopModule:addBuyableItem({'sudden death', 'sd'},             2268, 325,     2,     'sudden death rune')
shopModule:addBuyableItem({'blank', 'rune'},                     2260, 10,     1,    'blank rune')
 
 
local node = keywordHandler:addKeyword({'flask'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to return all your empty vials for 5 gold coins each?'})
    node:addChildKeyword({'yes'}, returnVials, {itemid = 2006, charges = 0, cost = 5})
    node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Allright then.'})
 
npcHandler:addModule(FocusModule:new())
 
Last edited by a moderator:

kish

New Member
Joined
Aug 31, 2007
Messages
31
Best answers
0
Reaction score
0
thx i needed the vials npc
 

Velik

Ghost Member
Joined
Aug 20, 2007
Messages
58
Best answers
0
Reaction score
0
Location
Brazil
About Runes where i can put price and amount of charge? example:

I want Buy 55 charges of HMM for 3,5k..


The amount of charges is fix?
If i put 30 charges he will only 30 charges?
 

Jester

Off
Joined
May 28, 2007
Messages
2,661
Best answers
0
Reaction score
31
Location
Romania.
Hope it's as usefull for other as it is for us, good job
 

Herox

the hero of girls :O
Joined
Aug 21, 2007
Messages
62
Best answers
0
Reaction score
0
Location
Brazil
I find an error, you change the oracle.lua for king.xml (FIXED)

and i can't modify the script for getCount(msg)

the npc for premium is too simples, he will give a premmy account of 7 days for 10k and will promote if the player is 20+

npc for blesses i find, thanks

so, i can't work with parameters, please made it for me :D

thanks for attention :D
 
Last edited:

Reyen

New Member
Joined
Aug 30, 2007
Messages
23
Best answers
0
Reaction score
0
how do i do it? i want to have the sell flask but what do i do?
 
OP
Mokerhamer

Mokerhamer

Retired Global Mod
Joined
Aug 6, 2007
Messages
1,767
Best answers
0
Reaction score
35
About Runes where i can put price and amount of charge? example:

I want Buy 55 charges of HMM for 3,5k..


The amount of charges is fix?
If i put 30 charges he will only 30 charges?
Uhm
RUNEID, PRICE, CHARGES,



you change the promotion.lua for oracle.xml :S

and

have a code for you say 84 changes?
example:
hi
77 changes
yes
.. because this script of npcs you need config the changes, and it sucks :(

and

do you have a NPC to sell premium account ?!

and

NPC for blesses...

and

a NPC for trade worn soft boots (id 6530) to a net soft boots (id 6132) with 14400 second :)

THANKS!!
Gone fix the promotion/oracle thigy.
Well i have an helping thread start the script and if you have trouble with it i'll help you (Hint* change charges to count)


Hmm a premmium Npc i can build it on many ways can you exactly tell me how you want it?

Blesses? like i said before if you download The forgotten server, There's already an blesser inside!

Uhm? you can make it easly.


thanks but whats it called global.lua
Global.lua is anlua script with the global npc functions :p
data>global.lua

You need to add the vial code in there to let the npc work :p

thanks bro I was looking for npc of vials
Hehe Np i like people that needed that :p

how do i do it? i want to have the sell flask but what do i do?
You need add the first vial code in global.lua
and the other vial script is the Npc
 
OP
Mokerhamer

Mokerhamer

Retired Global Mod
Joined
Aug 6, 2007
Messages
1,767
Best answers
0
Reaction score
35
read my last post ;D
Gone make an Premmy npc oke?? but need to finish Svarground


what kind of error do u get with getCount?? if it dosen't know how to read getCount

add this at the bottum data>npc>lib>npc.lua
Code:
function getCount(msg)
 local ret = -1
 local b, e = string.find(msg, "%d+")
    if b ~= nil and e ~= nil then
       ret = tonumber(string.sub(msg, b, e))
    end
 
    return ret
end
 

Herox

the hero of girls :O
Joined
Aug 21, 2007
Messages
62
Best answers
0
Reaction score
0
Location
Brazil
hmm, i see the topic who show's the Lua Functions, and i Maked a Premium NPC, Soft Boots Trader, DIstance NPC, Seller, Furniture and some others :D

thanks, you helped ALOT:)
 
Last edited:
OP
Mokerhamer

Mokerhamer

Retired Global Mod
Joined
Aug 6, 2007
Messages
1,767
Best answers
0
Reaction score
35
can you gimme a line of example ?

shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 125, getCount(msg), 'heavy magic missile rune')

and can you help me with this error:

Lua Script Error: [Npc interface]
data/npc/scripts/promote.lua: onThink
luaSetNpcFocus(). Creature not found.

thanks :D
Anywais the rune system.. you can onlyb uy the charges as u bought them getCount dosen't work there..






Promotion bugged? it works fine here
 

diegobudis

New Member
Joined
Aug 25, 2007
Messages
23
Best answers
0
Reaction score
0
Lua Script Error: [Npc interface]
data/npc/scripts/oraculo.lua:eek:nCreatureSay

attempt to index a number value


Está apresentando este erro o oráculo quando está no final, alguem pode me dar uma dica??
 
OP
Mokerhamer

Mokerhamer

Retired Global Mod
Joined
Aug 6, 2007
Messages
1,767
Best answers
0
Reaction score
35
Lua Script Error: [Npc interface]
data/npc/scripts/oraculo.lua:eek:nCreatureSay

attempt to index a number value


Está apresentando este erro o oráculo quando está no final, alguem pode me dar uma dica??
now in the english langues?
 

fokuleh

New Member
Joined
Oct 25, 2007
Messages
156
Best answers
0
Reaction score
0
how to do that king ask you items for the promote, like 100 iron ore for the elite knight or something?, and how to personalize the npc?, like to put, if the voc id is 4 change voc id to 11????, i make new npc that gives you custom vocations if you are the correct =P, plz help!
 
Last edited:
Top