• 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!

Soft boot script i got needs Editing!!!

Status
Not open for further replies.

Big M O O K

New Member
Joined
Aug 24, 2008
Messages
35
Reaction score
0
Read here FIRST!!! please :P I took my last post and put it up here

@empty
well, still i had a ton of errors in my .exe with the npc ignas gave me

@master
how do i control the money ammount it takes? thx for that btw

Edit: I also get this error when i get soft boots from him.
Lua Script Error: [Npc interface]
data/npc/scripts/soft_boots.lua:onCreatureSay

luaCreatureGetName<>/ Deprecated function. Use getCreatureName

but it still gives soft boots, and still takes 0 money :\

also did i put it in right spot? marked it red

soft_boot.lua
Code:
local focus = 0
local talk_start = 0
local target = 0
local following = true
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)
      msg = string.lower(msg)

      if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
          selfSay('Hello, ' .. creatureGetName(cid) .. '! Can I help you?')
          focus = cid
          talk_start = os.clock()

      elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! Wait a fuckin minute.')

    elseif focus == cid then
        talk_start = os.clock()
        if msgcontains(msg, 'soft boots') or msgcontains(msg, 'worn soft boots') then
            if doPlayerRemoveItem(cid,6530,1) == 0 then 
		[COLOR="Red"]doPlayerRemoveMoney(cid, money)[/COLOR]

                selfSay('I do it for free')
                addon_state = 0
            else 
                selfSay('Now, your boots are new!')
                doPlayerAddItem(cid, 6132, 1)
                talk_start = 0
            end 

         elseif msgcontains(msg, 'offer') then
              selfSay('I repair soft boots.')

        elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
            selfSay('Good bye, ' .. creatureGetName(cid) .. '! Come back soon!')
            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:
there is no error :P i just need the script to take money AND the worn soft boots. the npc works fine, it only takes the worn softboots and gives the new ones back :P

i dont even got the function added to even try and take money, dont know how :(
 
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 creatureSayCallback(cid, type, msg)
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    if(npcHandler.focus ~= cid) then
        return false
    end

        if msgcontains(msg, 'specialised') or msgcontains(msg, 'boot') then
            selfSay('Yes, my fathers was a great one blacksmith, it was a wise person , but when he decided to teach me he dies and i just learn about the lovely boots. So, did you bring me some boots? which one?')
        elseif msgcontains(msg, 'soft boots') or msgcontains(msg, 'worn soft boots') or msgcontains(msg, 'soft boot') or msgcontains(msg, 'worn soft boot') then
            selfSay('Did u like that i fix ur worn soft boots? it will cost 100 platinum coins')
            talk_state = 1
        

        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            if getPlayerItemCount(cid,6530) >= 1 and getPlayerItemCount(cid,2152) >= 100 then
                if doPlayerTakeItem(cid,6530,1) and doPlayerTakeItem(cid,2152,100) == 0 then
                selfSay('Here you are.')
                    doPlayerAddItem(cid,2640,1)
                end
            else
                selfSay('Sorry, you don\'t have the item.')
            end
          

        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('Ok than.')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

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


No problems
 
Last edited by a moderator:
everything is wrong with that :\ thats not even for xml. can anyone help me with this 8.1 soft boot npc? i use devlands :\
 
@empty
well, still i had a ton of errors in my .exe with the npc ignas gave me

@master
how do i control the money ammount it takes? thx for that btw

Edit: I also get this error when i get soft boots from him.
Lua Script Error: [Npc interface]
data/npc/scripts/soft_boots.lua:onCreatureSay

luaCreatureGetName<>/ Deprecated function. Use getCreatureName

but it still gives soft boots, and still takes 0 money :\

also did i put it in right spot? marked it red

soft_boot.lua
Code:
local focus = 0
local talk_start = 0
local target = 0
local following = true
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)
      msg = string.lower(msg)

      if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
          selfSay('Hello, ' .. creatureGetName(cid) .. '! Can I help you?')
          focus = cid
          talk_start = os.clock()

      elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! Wait a fuckin minute.')

    elseif focus == cid then
        talk_start = os.clock()
        if msgcontains(msg, 'soft boots') or msgcontains(msg, 'worn soft boots') then
            if doPlayerRemoveItem(cid,6530,1) == 0 then 
		[COLOR="Red"]doPlayerRemoveMoney(cid, money)[/COLOR]

                selfSay('I do it for free')
                addon_state = 0
            else 
                selfSay('Now, your boots are new!')
                doPlayerAddItem(cid, 6132, 1)
                talk_start = 0
            end 

         elseif msgcontains(msg, 'offer') then
              selfSay('I repair soft boots.')

        elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
            selfSay('Good bye, ' .. creatureGetName(cid) .. '! Come back soon!')
            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:
You need to change money to the ammount you want, like 1000 for 1000gp

edit: sorry use this one:
Code:
local focus = 0
local talk_start = 0
local target = 0
local following = true
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)
      msg = string.lower(msg)

      if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
          selfSay('Hello, ' .. creatureGetName(cid) .. '! Can I help you?')
          focus = cid
          talk_start = os.clock()

      elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! Wait a fuckin minute.')

    elseif focus == cid then
        talk_start = os.clock()
        if msgcontains(msg, 'soft boots') or msgcontains(msg, 'worn soft boots') then
            if doPlayerRemoveItem(cid,6530,1) and doPlayerRemoveMoney(cid, 10000) == 1 then 
 selfSay('Now, your boots are new!')
                doPlayerAddItem(cid, 6132, 1)
                talk_start = 0
             else 
                selfSay('I do it for free')
                addon_state = 0
                       end 

         elseif msgcontains(msg, 'offer') then
              selfSay('I repair soft boots.')

        elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
            selfSay('Good bye, ' .. creatureGetName(cid) .. '! Come back soon!')
            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:
Status
Not open for further replies.
Back
Top