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

Small question about my softboots refiller

dediol

New Member
Joined
Apr 15, 2008
Messages
37
Reaction score
0
Location
Belgium
Hellow

I dunno again if im a t the wrong spot , but if i am feel free to remove it. I got a question about my softboots refiller, he only takes 100 platinum coins and like on every server you always got noobs who always take crystal coins in their bp and never try it with 100platinum coins. So my question is can somebody have a look in my lua script and change it + explain me what was wrongcause im also learning a little about scripting :p

HTML:
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())


ps: the first person that helps me out = free rep points! :D
 
Last edited:
This one should work.
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)
    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
            doPlayerTakeItem(cid,6530,1)
            doPlayerRemoveMoney(cid,10000)
            selfSay('Here you are.')
            doPlayerAddItem(cid,2640,1)
        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
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
sorry to say empty but nop :( dint worked, i only took crystal coins in my bp and when he asked to repair them i said yes, then my npc says: Sorry you dont got this item.

edit: and i had an worn soft boots in my bp ;)
 
Last edited:
Haha, sorry. I forgot to change the count money function. ;P Here you go!
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)
    if(npcHandler.focus ~= cid) then
        return false
    end

    player_gold = getPlayerItemCount(cid,2148)
    player_plat = getPlayerItemCount(cid,2152)*100
    player_crys = getPlayerItemCount(cid,2160)*10000
    player_money = player_gold + player_plat + player_crys
    
    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 
            if player_money >= 10000 then
            doPlayerTakeItem(cid,6530,1)
            doPlayerRemoveMoney(cid,10000)
            selfSay('Here you are.')
            doPlayerAddItem(cid,2640,1)
            else
                selfSay('Sorry, you don\'t have the item.')
            end
        end
    elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
        selfSay('Ok than.')
        talk_state = 0
    end
    return true
end

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