• 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 compatibility please.

zniC

o hio
Joined
Jun 2, 2007
Messages
1,482
Reaction score
1
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 ' .. getPlayerName(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, ' .. getPlayerName(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, 'lightning') then
            buy(cid,2187,getCount(msg),10000)
        elseif msgcontains(msg, 'inferno') then
            buy(cid,2187,getCount(msg),10000)
        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),10000)
        elseif msgcontains(msg, 'hailstorm') then
            buy(cid,2183,getCount(msg),10000)
        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,200)            
                
                elseif msgcontains(msg, 'bp manafluids') then
            buyContainer(cid,3940,2006,7,1000)                
                
                elseif msgcontains(msg, 'bp uhs') then
            buyContainer(cid,2002,2273,3,2000)        
         
                elseif msgcontains(msg, 'bp gfbs') then
            buyContainer(cid,2000,2304,6,1500)               
        
                elseif msgcontains(msg, 'bp explosions') then
            buyContainer(cid,2001,2313,6,3500)                
         
                elseif msgcontains(msg, 'bp blank') then
            buyContainer(cid,1988,2260,1,200)
    
        elseif msgcontains(msg, 'bp destroy fields') then
            buyContainer(cid,2003,2261,6,1000)               
                

        elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
            selfSay('Good bye, ' .. getPlayerName(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
When saying hi he answers but it's like saying bye. He starts walking. (conversation over)

---------------------------

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!

keywordHandler:addKeyword({'chairs'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell wooden, sofa, red cushioned, green cushioned, tusk and ivory chairs.'})
keywordHandler:addKeyword({'tables'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell big, square, round, small, stone, tusk, bamboo tables.'})
keywordHandler:addKeyword({'plants'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell pink and green flowers, also christmas trees.'})
keywordHandler:addKeyword({'furniture'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell large trunks, boxes, drawers, dressers, lockers and troughs.'})
keywordHandler:addKeyword({'more'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell coal basins, birdcages, harps, pianos, globes, clocks and lamps.'})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell blue, green, orange, pink, red, white and yellow tapestries.'})

keywordHandler:addKeyword({'small'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell small purple, small green, small red, small blue, small orange, small turquiose and small white pillows.'})
keywordHandler:addKeyword({'round'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell round blue, round red, round purple and round turquiose pillows.'})
keywordHandler:addKeyword({'square'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell blue, red, green and yellow pillows.'})
keywordHandler:addKeyword({'pillows'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell heart, small, sqare and round pillows.'})

-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
Furniture.
Furniture said:
]Lua Script Error: [Npc interface]
data/npc/scripts/furniture.lua

data/npc/scripts/furniture.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/furniture.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

------

A list of errors:
data/npc/scripts/soft boots.lua

data/npc/scripts/soft boots.lua:3: attempt to index global 'NpcSystem' (a nil valu
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/soft boots.l


Lua Script Error: [Npc interface]
data/npc/scripts/amulet.lua

data/npc/scripts/amulet.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/amulet.lua


Lua Script Error: [Npc interface]
data/npc/scripts/kharos.lua

data/npc/scripts/kharos.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/kharos.lua

Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/priest.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/armor.lua

data/npc/scripts/armor.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/armor.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/weapon.lua

data/npc/scripts/weapon.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/weapon.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/mail.lua

data/npc/scripts/mail.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/mail.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/seller.lua

data/npc/scripts/seller.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/seller.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/seller.lua

data/npc/scripts/seller.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/seller.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/weapon.lua

data/npc/scripts/weapon.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/weapon.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/armor.lua

data/npc/scripts/armor.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/armor.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/mail.lua

data/npc/scripts/mail.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/mail.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/armor.lua

data/npc/scripts/armor.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/armor.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/food.lua

data/npc/scripts/food.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/food.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/weapon.lua

data/npc/scripts/weapon.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/weapon.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/seller.lua

data/npc/scripts/seller.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/seller.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/bows.lua

data/npc/scripts/bows.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/bows.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'

Lua Script Error: [Npc interface]
data/npc/scripts/djinn.lua

data/npc/scripts/djinn.lua:3: attempt to index global 'NpcSystem' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/djinn.lua
data/npc/scripts/priest.lua:39: ')' expected near 'are'


This ain't good is it? x_x


Anyways, please help me getting these work in TFS?
 
Back
Top