• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

npc

Dorianek

Member
Joined
Nov 29, 2018
Messages
252
Reaction score
10
Location
Poland
Hello, I found some useful npc from older servers, I would like to fire them on tfs 1.3 10.98 exactly but the system probably changed because the server can not see if someone can direct me how to change the script below to fire on tfs?

Code:
<?xml version="1.0"?>
<npc name="Bakorek" script="data/npc/scripts/sl.lua" access="3">
     <look type="129" head="114" body="119" legs="114" feet="114"/>
</npc>

scripts lua np

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

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
      if focus == cid then
          selfSay('Dowidzenia.')
          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)
msg = string.lower(msg)

if ((string.find(msg, '(%a*)hi(%a*)')
or string.find(msg, '(%a*)siema(%a*)')
or string.find(msg, '(%a*)czesc(%a*)')
or string.find(msg, '(%a*)cze(%a*)')
or string.find(msg, '(%a*)yo(%a*)')
or string.find(msg, '(%a*)elo(%a*)'))
and (focus == 0)) and getDistanceToCreature(cid) < 4 then

rsay = math.random(1,4)
if rsay == 1 then says = 'Waazzuup'
elseif rsay == 2 then says = 'Siema'
elseif rsay == 3 then says = 'Czesc'
elseif rsay == 4 then says = 'Witam'
end


       if isPremium(cid) then
           selfSay('Siemka ' .. creatureGetName(cid) .. '! Czy chcesz kupic wypasiony amulet?( star light) za 500 cc?')
           focus = cid
           talk_start = os.clock()
       else
           selfSay('Ten amulet moga miec osoby tylko z Pacc !')
           focus = 0
           talk_start = 0
       end

     elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
         selfSay('Spadaj do kolejki ' .. creatureGetName(cid) .. ' .')

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

       if msgcontains(msg, 'nie') then
           selfSay('Gdy nosisz ten amulet to nie spada eq ani skile (dziala tylko dla pacc) kosztuje 500 cc.')
       


elseif msgcontains(msg, 'starlight') then
           buy(cid,2138,1,5000000)
elseif msgcontains(msg, 'sl') then
           buy(cid,2138,1,5000000)
elseif msgcontains(msg, 'tak') then
           buy(cid,2138,1,5000000)
elseif msgcontains(msg, 'yes') then
           buy(cid,2138,1,5000000)




       elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
           selfSay('Dowidzenia ' .. 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('Nastepny prosze.')
         end
             focus = 0
     end
   if focus ~= 0 then
         if getDistanceToCreature(focus) > 5 then
             selfSay('Dowiedzenia.')
             focus = 0
         end
     end
end
 
I have same problem I wish to implement blind orc from rookgaard to answer on "charach" rather than humans "hi" or "hello" tfs1.3,10.98...

What if you use this one: npc would probably answer only on word "hi" and "bye" but other speak line would be in Polish:
I just made quest so that if you bring 500cc he will give you reward (sapphire amulet) and you could repeat that.
As You have no answer maybe this will help You a little :)


LUA:
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 voices =   {{ text = 'Najlepsze amulety tylko u mnie!' },
                             { text = 'Jak mozesz jeszcze nie mieć najlepszego amuletu!?' }}

-- Greeting and Farewell
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Phi, spadaj')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Pieknego dnia Ci zycze')
npcHandler:setMessage(MESSAGE_GREET, 'Serwus |PLAYERNAME|! Na pewno chcialbys kupic moj {amulet}')

-- Amulet
keywordHandler:addKeyword({'amulet'}, StdModule.say, {npcHandler = npcHandler, text = 'Gdy nosisz {Star Light} to nie spada eq ani skile (dziala tylko dla pacc) kosztuje 500 cc.'})

local boxKeyword = keywordHandler:addKeyword({'star light'}, StdModule.say, {npcHandler = npcHandler, text = 'Czy chcesz kupic wypasiony star light za 500 cc?'})
    boxKeyword:addChildKeyword({'tak'}, StdModule.say, {npcHandler = npcHandler, text = 'Prosze Cie bardzo, oto twoj amulet', reset = true},
        function(player) return player:getItemCount(2160) > 500 end,
        function(player) player:removeItem(2160, 500) player:addItem(2138, 1) end)
    boxKeyword:addChildKeyword({''}, StdModule.say, {npcHandler = npcHandler, text = 'Wracaj biedaku skad przyszedles i nastepnym razem przynies mi 500 cc!', reset = true})
 
Back
Top