• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Runemaker

Status
Not open for further replies.

Movement

New Member
Joined
Dec 5, 2007
Messages
102
Reaction score
0
HELP NEEDED!!!!!!

I changed our server of tfs 0.2.12.770 to 0.2.13 rev. 866. Because many bugs. Now all bugs gone but our Npc are crazy. Now Our Runemaker Npc fucked up.

Must i edit my Npc's because newer Tfs Version or so?

Player:hi

Runemaker: Sell runes etc....

Player: Buy XXXX item

Runemaker: Want u buy XXXX for 1000gp?

Player: Yes

Game: Nothing. The Player not get the Item and the NPC not take the Money.



Please Help Me:

Npc:

Code:
<?xml version="1.0"?>

<npc name="Runemaker" script="data/npc/scripts/runes.lua" access="5" lookdir="1" autowalk="1">
    <health now="1000" max="1000"/>
<look type="130" head="1" body="316" legs="216" feet="66" addons="3"/>
</npc>
runes:

Code:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
      if focus == cid then
          selfSay('Good bye then.')
          focus = 0
          talk_start = 0
      end
end


function onCreatureTurn(creature)

end


function msgcontains(txt, str)
      return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
      local msg = string.lower(msg)

      if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
          selfSay('Hello ' .. creatureGetName(cid) .. '! I sell runes, wands, rods, and whole bps with runes.')
          focus = cid
          talk_start = os.clock()

      elseif msgcontains(msg, 'hi') and focus ~= cid and getDistanceToCreature(cid) < 4 then
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

    elseif focus == cid then
        talk_start = os.clock()

        if msgcontains(msg, 'runes') then
            selfSay('I sell hmms (100gps), uhs (150gps), gfbs (100gps), explosions (225gps), sds (300gps), blank runes (10gps).')
        elseif msgcontains(msg, 'wands') then
            selfSay('I sell wand of inferno (5k), plague (1k), cosmic energy (3k), vortex (Free) and dragonbreath (100gp).')
        elseif msgcontains(msg, 'rods') then
            selfSay('I sell quagmire (3k), snakebite (Free), tempest (5k), volcanic (1k) and moonlight rod (100gp).')

        elseif msgcontains(msg, 'inferno') then
            buy(cid,2187,getCount(msg),5000)
        elseif msgcontains(msg, 'plague') then
            buy(cid,2188,getCount(msg),1000)
        elseif msgcontains(msg, 'cosmic energy') then
            buy(cid,2189,getCount(msg),3000)
        elseif msgcontains(msg, 'vortex') then
            buy(cid,2190,getCount(msg),0)
        elseif msgcontains(msg, 'dragonbreath') then
            buy(cid,2191,getCount(msg),100)

        elseif msgcontains(msg, 'quagmire') then
            buy(cid,2181,getCount(msg),3000)
        elseif msgcontains(msg, 'snakebite') then
            buy(cid,2182,getCount(msg),0)
        elseif msgcontains(msg, 'tempest') then
            buy(cid,2183,getCount(msg),5000)
        elseif msgcontains(msg, 'volcanic') then
            buy(cid,2185,getCount(msg),1000)
        elseif msgcontains(msg, 'moonlight') then
            buy(cid,2186,getCount(msg),100)

        elseif msgcontains(msg, 'bp sds') then
            buyContainer(cid,2003,2268,3,4000)
            
                elseif msgcontains(msg, 'bp hmms') then
            buyContainer(cid,2001,2311,15,500)            
                
                elseif msgcontains(msg, 'bp manafluids') then
            buyContainer(cid,3940,2006,7,1000)                
                
                elseif msgcontains(msg, 'bp uhs') then
            buyContainer(cid,2002,2273,3,3000)        
         
                elseif msgcontains(msg, 'bp gfbs') then
            buyContainer(cid,2000,2304,6,1000)               
        
                elseif msgcontains(msg, 'bp explosions') then
            buyContainer(cid,2001,2313,9,2000)                
         
                elseif msgcontains(msg, 'bp blank') then
            buyContainer(cid,1988,2260,1,200)
        
        elseif msgcontains(msg, 'bp magic walls') then
            buyContainer(cid,1999,2293,12,1000)
        
        elseif msgcontains(msg, 'bp fire bombs') then
            buyContainer(cid,2000,2305,9,500)
    
        elseif msgcontains(msg, 'bp destroy fields') then
            buyContainer(cid,2003,2261,9,500)
        
        elseif msgcontains(msg, 'bp great mana potions') then
            buyContainer(cid,7590,2006,7,2000)
        
        elseif msgcontains(msg, 'bp strong mana potions') then
            buyContainer(cid,7589,2006,7,1500)

        elseif msgcontains(msg, 'bp great health potions') then
            buyContainer(cid,7591,2006,7,2000)

        elseif msgcontains(msg, 'bp strong health potions') then
            buyContainer(cid,7588,2006,7,1500)              
                

        elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
            selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
            focus = 0
            talk_start = 0
        end
    end
end

function onCreatureChangeOutfit(creature)

end


function onThink()
      if (os.clock() - talk_start) > 30 then
          if focus > 0 then
              selfSay('Next Please...')
          end
        
        focus = 0
      end
    
     if focus ~= 0 then
         if getDistanceToCreature(focus) > 5 then
             selfSay('Good bye then.')
             focus = 0
         end
     end
    
end
 
Last edited by a moderator:
please help me

Please help us. I'M tried all 2 whole nights now idk.

This Runemaker are working or?

Or post here a working Npc who sells runes potions etc. with bps
 
creatureGetName() should be getCreatureName();
buy - there is no such a function in TFS use:
Code:
if doPlayerRemoveMoney(cid, MONEY) == TRUE then
    doPlayerAddItem(cid, ITEMID, ITEMCOUNT)
else
    --do smth
end
buyContainer - there is no such a function in TFS use:
Code:
if msgcontains(msg, 'bp sd') then
    if doPlayerRemoveMoney(cid, MONEY) == TRUE then
        local container = doPlayerAddItem(cid, CONTAINERID, 1)
        for i = 1, 20 do -- 20 cos backpack got 20 slots
            doAddContainerItem(container, ITEMID, ITEMCOUNT/TYPE)
        end
    else
        -- more money pls
    end
end

--
btw, Ive made buyContainer for you :p
Code:
function buyContainer(cid, containerid, itemid, itemcount, price)
    if doPlayerRemoveMoney(cid, price) == TRUE then
        local container = doPlayerAddItem(cid, containerid, 1)
        for i = 1, 20 do
            doAddContainerItem(container, itemid, itemcount)
        end
        selfSay("Here you are.")
    else
        selfSay("Not enough money.")
    end
end

Place it in your global.lua/functions.lua, although idk if it will work with selfSay().

--
Also, here is buy function, supports only 1 item-at-time:
Code:
function buy(cid, itemid, charges, price)
    if doPlayerRemoveMoney(cid, price) == TRUE then
        doPlayerAddItem(cid, itemid, charges)
        selfSay("Here you are.")
    else
        selfSay("Not enough money.")
    end
end
 
Last edited:
Your NPC is using functions not supported by TFS.

You need to either rewrite the NPC or place the functions Ive made in your functions.lua or global.lua.

If you will choose the functions way, then you need to change in every buy() at NPC file this getCount(msg) to 1.

If you are going to rewrite the NPC you will have to change every buy and buy container in the same way as Ive wrote in my post above.

So, instead of:
Code:
elseif msgcontains(msg, 'inferno') then
buy(cid,2187,getCount(msg),5000)
You will have to do:
Code:
elseif msgcontains(msg, 'inferno') then
    if doPlayerRemoveMoney(cid, 5000) == TRUE then
        doPlayerAddItem(cid, 2187, 1)
        selfSay("Here is your wand, enjoy.")
    else
        selfSay("Sorry, you do not have enough gold.")
    end

Okay? :confused:
 
@up Can you post your functions also in the lua functions board? I think it would help much people :) Rep+
 
This npc for tfs and working or?(i hope it so hard):


NPC:

Code:
<?xml version="1.0"?>
       
       <npc name="Bobbie" script="data/npc/scripts/runes.lua" speed="200" access="3" floorchange="0" autowalk="30">
           <health now="1000" max="1000"/>
           <look type="130" head="96" body="71" legs="72" feet="33" corpse="3128"/>
          <parameters>
          <parameter key="message_greet" value="Hello,  |PLAYERNAME|. Im selling runes,wands/rods and potions!" />    
          </parameters>
       </npc>
[/CODE}


RUNES:
[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({'blank'},                     2260, 10,         'blank rune')



shopModule:buyContainer({'bp sudden death'},                  2003, 2268, 3000, 3,      'Backpack of sudden death')
shopModule:buyContainer({'bp ultimate healing'},          2002, 2273, 5000, 2,      'Backpack of ultimate healing')
shopModule:buyContainer({'bp intense healing'},          1988, 2265, 300, 1,      'Backpack of intense healing')
shopModule:buyContainer({'bp great fire ball'},          2000, 2304, 1000, 4,      'Backpack of great fireball')
shopModule:buyContainer({'bp explosion'},                  2001, 2313, 3000, 3,      'Backpack of explosion rune')
shopModule:buyContainer({'bp heavy magic missile'},          1998, 2311, 700, 10,      'Backpack of heavy magic missile')
shopModule:buyContainer({'bp magic wall'},                  1999, 2293, 2000, 4,      'Backpack of magic wall')
shopModule:buyContainer({'bp fire bomb'},                  2000, 2305, 1000, 2,      'Backpack of fire bomb')
shopModule:buyContainer({'bp destroy fields'},                  2003, 2261, 1000, 3,      'Backpack of destroy field')
shopModule:buyContainer({'bp great mana potion'},          2003, 7590, 3500, 1,      'Backpack of great mana potion')
shopModule:buyContainer({'bp strong mana potion'},          2003, 7589, 1600, 1,      'Backpack of strong mana potion')
shopModule:buyContainer({'bp mana potion'},                  2003, 7620, 1000, 1,      'Backpack of mana potion')
shopModule:buyContainer({'bp great health potion'},          2003, 7591, 5000, 1,      'Backpack of great health potion')
shopModule:buyContainer({'bp strong health potion'},          2003, 7588, 2200, 1,      'Backpack of strong health potion')
shopModule:buyContainer({'bp health potion'},                  2003, 7618, 1000, 1,      'Backpack of health potion')
shopModule:buyContainer({'bp ultimate health potion'},                  2003, 8377, 7000, 1,      'Backpack of ultimate health potion')
shopModule:buyContainer({'bp great spirit potion'},                  2003, 8376, 4000, 1,      'Backpack of great spirit potion')


npcHandler:addModule(FocusModule:new())



Sorry idk how i can post it with code:
 
Last edited by a moderator:
Ok, so once again:

Paste this in your either functions.lua or global.lua or NPC lua file:
Code:
function buyContainer(cid, containerid, itemid, itemcount, price)
    if doPlayerRemoveMoney(cid, price) == TRUE then
        local container = doPlayerAddItem(cid, containerid, 1)
        for i = 1, 20 do
            doAddContainerItem(container, itemid, itemcount)
        end
        selfSay("Here you are.")
    else
        selfSay("Not enough money.")
    end
end

well, and thats all.
 
This npc for tfs and working or?(i hope it so hard):


NPC:

<?xml version="1.0"?>

<npc name="Bobbie" script="data/npc/scripts/runes.lua" speed="200" access="3" floorchange="0" autowalk="30">
<health now="1000" max="1000"/>
<look type="130" head="96" body="71" legs="72" feet="33" corpse="3128"/>
<parameters>
<parameter key="message_greet" value="Hello, |PLAYERNAME|. Im selling runes,wands/rods and potions!" />
</parameters>
</npc>



RUNES:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
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
-- OTServ event handling functions end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'blank'}, 2260, 10, 'blank rune')



shopModule:buyContainer({'bp sudden death'}, 2003, 2268, 3000, 3, 'Backpack of sudden death')
shopModule:buyContainer({'bp ultimate healing'}, 2002, 2273, 5000, 2, 'Backpack of ultimate healing')
shopModule:buyContainer({'bp intense healing'}, 1988, 2265, 300, 1, 'Backpack of intense healing')
shopModule:buyContainer({'bp great fire ball'}, 2000, 2304, 1000, 4, 'Backpack of great fireball')
shopModule:buyContainer({'bp explosion'}, 2001, 2313, 3000, 3, 'Backpack of explosion rune')
shopModule:buyContainer({'bp heavy magic missile'}, 1998, 2311, 700, 10, 'Backpack of heavy magic missile')
shopModule:buyContainer({'bp magic wall'}, 1999, 2293, 2000, 4, 'Backpack of magic wall')
shopModule:buyContainer({'bp fire bomb'}, 2000, 2305, 1000, 2, 'Backpack of fire bomb')
shopModule:buyContainer({'bp destroy fields'}, 2003, 2261, 1000, 3, 'Backpack of destroy field')
shopModule:buyContainer({'bp great mana potion'}, 2003, 7590, 3500, 1, 'Backpack of great mana potion')
shopModule:buyContainer({'bp strong mana potion'}, 2003, 7589, 1600, 1, 'Backpack of strong mana potion')
shopModule:buyContainer({'bp mana potion'}, 2003, 7620, 1000, 1, 'Backpack of mana potion')
shopModule:buyContainer({'bp great health potion'}, 2003, 7591, 5000, 1, 'Backpack of great health potion')
shopModule:buyContainer({'bp strong health potion'}, 2003, 7588, 2200, 1, 'Backpack of strong health potion')
shopModule:buyContainer({'bp health potion'}, 2003, 7618, 1000, 1, 'Backpack of health potion')
shopModule:buyContainer({'bp ultimate health potion'}, 2003, 8377, 7000, 1, 'Backpack of ultimate health potion')
shopModule:buyContainer({'bp great spirit potion'}, 2003, 8376, 4000, 1, 'Backpack of great spirit potion')


npcHandler:addModule(FocusModule:new())




Sorry idk how i can post it with code:


or? When this are working then i nothing to do or?
 
Umm... I guess you cant use it like that, because the function I gave you isnt the shop module.

----
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 creatureSayCallback(cid, type, msg)
	if(npcHandler.focus ~= cid) then
		return false
	end
	
function buyContainer(cid, containerid, itemid, itemcount, price)
    if doPlayerRemoveMoney(cid, price) == TRUE then
        local container = doPlayerAddItem(cid, containerid, 1)
        for i = 1, 20 do
            doAddContainerItem(container, itemid, itemcount)
        end
        selfSay("Here you are.")
    else
        selfSay("Not enough money.")
    end
end

function buy(cid, itemid, charges, price)
    if doPlayerRemoveMoney(cid, price) == TRUE then
        doPlayerAddItem(cid, itemid, charges)
        selfSay("Here you are.")
    else
        selfSay("Not enough money.")
    end
end
		if msgcontains(msg, 'bp sd') then
			buyContainer(cid, 2003, 2268, 3, 6500)
		elseif msgcontains(msg, 'bp uh') then
			buyContainer(cid, 2003, 2273, 1, 3500)
		elseif msgcontains(msg, 'inferno') then
			buy(cid, 2187, 1, 5000)
		elseif msgcontains(msg, 'meat pack') then
			buy(cid, meatID, 5, 100)
		end
	return TRUE
end

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

Try if that works, and of course you can cut function buyContainer and buy and paste them in function.lua
 
Last edited:
NPC:

Code:
<?xml version="1.0"?>

<npc name="Bobbie" script="data/npc/scripts/runes.lua" speed="200" access="3" floorchange="0" autowalk="30">
<health now="1000" max="1000"/>
<look type="130" head="96" body="71" legs="72" feet="33" corpse="3128"/>
<parameters>
<parameter key="message_greet" value="Hello, |PLAYERNAME|. Im selling runes,wands/rods and potions!" />
</parameters>
</npc>


RUNES:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
-- OTServ event handling functions end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'blank'}, 2260, 10, 'blank rune')



shopModule:buyContainer({'bp sudden death'}, 2003, 2268, 3000, 3, 'Backpack of sudden death')
shopModule:buyContainer({'bp ultimate healing'}, 2002, 2273, 5000, 2, 'Backpack of ultimate healing')
shopModule:buyContainer({'bp intense healing'}, 1988, 2265, 300, 1, 'Backpack of intense healing')
shopModule:buyContainer({'bp great fire ball'}, 2000, 2304, 1000, 4, 'Backpack of great fireball')
shopModule:buyContainer({'bp explosion'}, 2001, 2313, 3000, 3, 'Backpack of explosion rune')
shopModule:buyContainer({'bp heavy magic missile'}, 1998, 2311, 700, 10, 'Backpack of heavy magic missile')
shopModule:buyContainer({'bp magic wall'}, 1999, 2293, 2000, 4, 'Backpack of magic wall')
shopModule:buyContainer({'bp fire bomb'}, 2000, 2305, 1000, 2, 'Backpack of fire bomb')
shopModule:buyContainer({'bp destroy fields'}, 2003, 2261, 1000, 3, 'Backpack of destroy field')
shopModule:buyContainer({'bp great mana potion'}, 2003, 7590, 3500, 1, 'Backpack of great mana potion')
shopModule:buyContainer({'bp strong mana potion'}, 2003, 7589, 1600, 1, 'Backpack of strong mana potion')
shopModule:buyContainer({'bp mana potion'}, 2003, 7620, 1000, 1, 'Backpack of mana potion')
shopModule:buyContainer({'bp great health potion'}, 2003, 7591, 5000, 1, 'Backpack of great health potion')
shopModule:buyContainer({'bp strong health potion'}, 2003, 7588, 2200, 1, 'Backpack of strong health potion')
shopModule:buyContainer({'bp health potion'}, 2003, 7618, 1000, 1, 'Backpack of health potion')
shopModule:buyContainer({'bp ultimate health potion'}, 2003, 8377, 7000, 1, 'Backpack of ultimate health potion')
shopModule:buyContainer({'bp great spirit potion'}, 2003, 8376, 4000, 1, 'Backpack of great spirit potion')


npcHandler:addModule(FocusModule:new())



Sorry idk how i can post it with code:





This are workign when i'm edit this(http://otland.net/showthread.php?t=1375&highlight=backpack+runes)
OR?
 
Last edited by a moderator:
i want know if the npc, 2 above this post are working when i edit my server with advanced buycontainer system.
 
Guess not, since it was for older revisions, you can always try just make a backup of your files.
 
then u must explain where i foudn a rune npc for the 0.2.13 rev 866 or 0.2.13 rev. 906
 
All give me other links can u explain me why this script of runes looks other as yours?
The Men who give me this said he helped tastalatures and its working(http://otland.net/showthread.php?p=93906#post93906)

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

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

keywordHandler:addKeyword({'spell runes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell convince creature(80gp) and chameleon(210gp), desintegrate(80gp), soulfire(210gp), paralyze(700gp), light magic missile(40gp), heavy magic missile(125gp), icicle(130gp), sudden death(325gp), fireball(95gp), great fireball(180gp), explosion(250gp), fire field(85gp), energy field(115gp), poison field(65gp), destroy field(45gp), fire wall(245gp), energy wall(340gp) and poison wall(210gp), magic wall runes(350gp), fire bomb(210gp), poison bomb(170gp), energy bomb(325gp), intense healing(95gp) and ultimate healing(175gp) runes.'})
keywordHandler:addKeyword({'fluids'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell normal mana potions, normal health potions, strong health potions, strong mana potions, great mana potions, great health potions, ultimate health potions, ultimate mana potions.(example: 4 normal mana potions) Also i selling backpacks with potions.(example: backpack normal mana potion)'})
keywordHandler:addKeyword({'wands'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell wand of vortex(50 gp), dragonbreath(500gp), plague(2.5k), cosmic energy(5k) and inferno(7.5k).'})
keywordHandler:addKeyword({'rods'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell snakebite(50 gp), moonlight(500gp), volcanic(2.5k), quarmire(5k) and hailstorm rod(7.5k).'})


shopModule:addBuyableItem({'normal health potions'}, 			7618, 50, 		'health potions')
shopModule:addBuyableItem({'strong health potions'}, 			7588, 100, 	 	'strong health potions')
shopModule:addBuyableItem({'great health potions'}, 			7591, 190, 	 	'great health potions')
shopModule:addBuyableItem({'ultimate health potions'}, 			8377, 310, 		'ultimate health potions')
shopModule:addBuyableItem({'normal mana potions'}, 				7620, 50, 	 	'mana potions')
shopModule:addBuyableItem({'strong mana potions'}, 				7589, 80, 	 	'strong mana potions')
shopModule:addBuyableItem({'great mana potions'}, 				7590, 120, 		'great mana potions')
shopModule:addBuyableItem({'ultimate mana potions'}, 			8376, 160, 		'ultimate mana potions')

shopModule:addBuyableItem({'blank rune'}, 						2260, 10, 			'blank rune')
shopModule:addBuyableItem({'light magic missile'}, 				2287, 40, 10,		'light magic missile rune')
shopModule:addBuyableItem({'heavy magic missile'}, 				2311, 125, 10,		'heavy magic missile rune')
shopModule:addBuyableItem({'sudden death'}, 					2268, 325, 3, 		'sudden death rune')

shopModule:addBuyableItem({'great fireball'}, 					2304, 180, 4, 		'great fireball rune')
shopModule:addBuyableItem({'fireball'}, 						2302, 95,  5,		'fire ball')
shopModule:addBuyableItem({'explosion'},		 				2313, 250, 6, 		'explosion rune')

shopModule:addBuyableItem({'fire field'}, 						2301, 85,  3,		'fire field rune')
shopModule:addBuyableItem({'energy field'}, 					2277, 115, 3, 		'energy field')
shopModule:addBuyableItem({'poison field'}, 					2285, 65,  3,		'poison field')
shopModule:addBuyableItem({'destroy field'}, 					2261, 45,  3, 		'destroy field')

shopModule:addBuyableItem({'fire wall'}, 						2303, 245, 4,		'fire wall rune')
shopModule:addBuyableItem({'energy wall'}, 						2279, 340, 4,		'energy wall rune')
shopModule:addBuyableItem({'poison wall'}, 						2289, 210, 4,		'poison wall rune')
shopModule:addBuyableItem({'magic wall'}, 						2293, 350, 3,		'magic wall rune')

shopModule:addBuyableItem({'fire bomb'}, 						2305, 235, 2,		'fire bomb rune')
shopModule:addBuyableItem({'poison bomb'}, 						2286, 170, 2,		'poison bomb rune')
shopModule:addBuyableItem({'energy bomb'}, 						2262, 325, 2,		'energy bomb rune')

shopModule:addBuyableItem({'antidote'}, 						2266, 65, 1, 		'antidote rune')
shopModule:addBuyableItem({'intense healing'}, 					2265, 95, 1,		'intense healing rune')
shopModule:addBuyableItem({'ultimate healing'}, 				2273, 175, 1, 		'ultimate healing rune')

shopModule:addBuyableItem({'convince creature'}, 				2290, 80, 1,		'convince creature rune')
shopModule:addBuyableItem({'chameleon rune'}, 					2291, 210, 1, 		'chameleon rune')
shopModule:addBuyableItem({'soulfire'}, 						2308, 210, 3, 		'soulfire rune')
shopModule:addBuyableItem({'Icicle'}, 							2271, 130, 5, 		'icicle runes')
shopModule:addBuyableItem({'paralyze'}, 						2278, 700, 1, 		'paralyze rune')

shopModule:addBuyableItem({'spell book'}, 						2217, 150, 		'spell book')

shopModule:addBuyableItem({'wand of inferno'}, 					2187, 7500, 	'wand of inferno')
shopModule:addBuyableItem({'wand of cosmic energy'}, 			2189, 5000,  	'wand of cosmic energy')
shopModule:addBuyableItem({'wand of plague'}, 					2188, 2500, 	'wand of plague')
shopModule:addBuyableItem({'wand of dragonbreath'}, 			2191, 500, 	'wand of dragonbreath')
shopModule:addBuyableItem({'wand of vortex'}, 					2190, 50, 	'wand of vortex')


shopModule:addBuyableItem({'tempest rod'}, 						2183, 7500, 	'hailstorm rod')
shopModule:addBuyableItem({'quagmire rod'}, 					2181, 5000,  	'quagmire rod')
shopModule:addBuyableItem({'volcanic rod'}, 					2185, 2500, 	'volcanic rod')
shopModule:addBuyableItem({'moonlight rod'}, 					2186, 500, 	'moonlight rod')
shopModule:addBuyableItem({'snakebite rod'}, 					2182, 50, 	'snakebite rod')




npcHandler:addModule(FocusModule:new())
 
because this one is using shopmodule omfg...
 
kk and i know i'm relly hard stupid so:

What must i edit that the shop module working?
 
Well, that script should work what you have posted o.o

btw: now my will look kinda the same, you like it now?
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 creatureSayCallback(cid, type, msg)
	if(npcHandler.focus ~= cid) then
		return false
	end
	
function buyContainer(cid, containerid, itemid, itemcount, price)
    if doPlayerRemoveMoney(cid, price) == TRUE then
        local container = doPlayerAddItem(cid, containerid, 1)
        for i = 1, 20 do
            doAddContainerItem(container, itemid, itemcount)
        end
        selfSay("Here you are.")
    else
        selfSay("Not enough money.")
    end
end

function buy(cid, itemid, charges, price)
    if doPlayerRemoveMoney(cid, price) == TRUE then
        doPlayerAddItem(cid, itemid, charges)
        selfSay("Here you are.")
    else
        selfSay("Not enough money.")
    end
end
		if msgcontains(msg, 'bp sd') then
			buyContainer(cid, 2003, 2268, 3, 6500)
		elseif msgcontains(msg, 'bp uh') then
			buyContainer(cid, 2003, 2273, 1, 3500)
		end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

keywordHandler:addKeyword({'spell runes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell convince creature(80gp) and chameleon(210gp), desintegrate(80gp), soulfire(210gp), paralyze(700gp), light magic missile(40gp), heavy magic missile(125gp), icicle(130gp), sudden death(325gp), fireball(95gp), great fireball(180gp), explosion(250gp), fire field(85gp), energy field(115gp), poison field(65gp), destroy field(45gp), fire wall(245gp), energy wall(340gp) and poison wall(210gp), magic wall runes(350gp), fire bomb(210gp), poison bomb(170gp), energy bomb(325gp), intense healing(95gp) and ultimate healing(175gp) runes.'})
keywordHandler:addKeyword({'fluids'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell normal mana potions, normal health potions, strong health potions, strong mana potions, great mana potions, great health potions, ultimate health potions, ultimate mana potions.(example: 4 normal mana potions) Also i selling backpacks with potions.(example: backpack normal mana potion)'})
keywordHandler:addKeyword({'wands'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell wand of vortex(50 gp), dragonbreath(500gp), plague(2.5k), cosmic energy(5k) and inferno(7.5k).'})
keywordHandler:addKeyword({'rods'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell snakebite(50 gp), moonlight(500gp), volcanic(2.5k), quarmire(5k) and hailstorm rod(7.5k).'})


shopModule:addBuyableItem({'normal health potions'}, 			7618, 50, 		'health potions')
shopModule:addBuyableItem({'strong health potions'}, 			7588, 100, 	 	'strong health potions')
shopModule:addBuyableItem({'great health potions'}, 			7591, 190, 	 	'great health potions')
shopModule:addBuyableItem({'ultimate health potions'}, 			8377, 310, 		'ultimate health potions')
shopModule:addBuyableItem({'normal mana potions'}, 				7620, 50, 	 	'mana potions')
shopModule:addBuyableItem({'strong mana potions'}, 				7589, 80, 	 	'strong mana potions')
shopModule:addBuyableItem({'great mana potions'}, 				7590, 120, 		'great mana potions')
shopModule:addBuyableItem({'ultimate mana potions'}, 			8376, 160, 		'ultimate mana potions')

shopModule:addBuyableItem({'blank rune'}, 						2260, 10, 			'blank rune')
shopModule:addBuyableItem({'light magic missile'}, 				2287, 40, 10,		'light magic missile rune')
shopModule:addBuyableItem({'heavy magic missile'}, 				2311, 125, 10,		'heavy magic missile rune')
shopModule:addBuyableItem({'sudden death'}, 					2268, 325, 3, 		'sudden death rune')

shopModule:addBuyableItem({'great fireball'}, 					2304, 180, 4, 		'great fireball rune')
shopModule:addBuyableItem({'fireball'}, 						2302, 95,  5,		'fire ball')
shopModule:addBuyableItem({'explosion'},		 				2313, 250, 6, 		'explosion rune')

shopModule:addBuyableItem({'fire field'}, 						2301, 85,  3,		'fire field rune')
shopModule:addBuyableItem({'energy field'}, 					2277, 115, 3, 		'energy field')
shopModule:addBuyableItem({'poison field'}, 					2285, 65,  3,		'poison field')
shopModule:addBuyableItem({'destroy field'}, 					2261, 45,  3, 		'destroy field')

shopModule:addBuyableItem({'fire wall'}, 						2303, 245, 4,		'fire wall rune')
shopModule:addBuyableItem({'energy wall'}, 						2279, 340, 4,		'energy wall rune')
shopModule:addBuyableItem({'poison wall'}, 						2289, 210, 4,		'poison wall rune')
shopModule:addBuyableItem({'magic wall'}, 						2293, 350, 3,		'magic wall rune')

shopModule:addBuyableItem({'fire bomb'}, 						2305, 235, 2,		'fire bomb rune')
shopModule:addBuyableItem({'poison bomb'}, 						2286, 170, 2,		'poison bomb rune')
shopModule:addBuyableItem({'energy bomb'}, 						2262, 325, 2,		'energy bomb rune')

shopModule:addBuyableItem({'antidote'}, 						2266, 65, 1, 		'antidote rune')
shopModule:addBuyableItem({'intense healing'}, 					2265, 95, 1,		'intense healing rune')
shopModule:addBuyableItem({'ultimate healing'}, 				2273, 175, 1, 		'ultimate healing rune')

shopModule:addBuyableItem({'convince creature'}, 				2290, 80, 1,		'convince creature rune')
shopModule:addBuyableItem({'chameleon rune'}, 					2291, 210, 1, 		'chameleon rune')
shopModule:addBuyableItem({'soulfire'}, 						2308, 210, 3, 		'soulfire rune')
shopModule:addBuyableItem({'Icicle'}, 							2271, 130, 5, 		'icicle runes')
shopModule:addBuyableItem({'paralyze'}, 						2278, 700, 1, 		'paralyze rune')

shopModule:addBuyableItem({'spell book'}, 						2217, 150, 		'spell book')

shopModule:addBuyableItem({'wand of inferno'}, 					2187, 7500, 	'wand of inferno')
shopModule:addBuyableItem({'wand of cosmic energy'}, 			2189, 5000,  	'wand of cosmic energy')
shopModule:addBuyableItem({'wand of plague'}, 					2188, 2500, 	'wand of plague')
shopModule:addBuyableItem({'wand of dragonbreath'}, 			2191, 500, 	'wand of dragonbreath')
shopModule:addBuyableItem({'wand of vortex'}, 					2190, 50, 	'wand of vortex')


shopModule:addBuyableItem({'tempest rod'}, 						2183, 7500, 	'hailstorm rod')
shopModule:addBuyableItem({'quagmire rod'}, 					2181, 5000,  	'quagmire rod')
shopModule:addBuyableItem({'volcanic rod'}, 					2185, 2500, 	'volcanic rod')
shopModule:addBuyableItem({'moonlight rod'}, 					2186, 500, 	'moonlight rod')
shopModule:addBuyableItem({'snakebite rod'}, 
npcHandler:addModule(FocusModule:new())
 
Status
Not open for further replies.
Back
Top