Ir para conteúdo
  • Cadastre-se

Scripting Permissões liberadas no Rashid TFS 1.3


Posts Recomendados

55 minutos atrás, luanluciano93 disse:

Poste em code o scripts dos npcs que você alterar ...

 

Yaman.

 

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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local player = Player(cid)
    if isInArray({"enchanted chicken wing", "boots of haste", "Enchanted Chicken Wing", "Boots of Haste"}, msg) then
        npcHandler:say('Do you want to trade Boots of haste for Enchanted Chicken Wing?', cid)
        npcHandler.topic[cid] = 1
    elseif isInArray({"warrior sweat", "warrior helmet", "Warrior Sweat", "Warrior Helmet"}, msg) then
        npcHandler:say('Do you want to trade 4 Warrior Helmet for Warrior Sweat?', cid)
        npcHandler.topic[cid] = 2
    elseif isInArray({"fighting spirit", "royal helmet", "Fighting Spirit", "Royal Helmet"}, msg) then
        npcHandler:say('Do you want to trade 2 Royal Helmet for Fighting Spirit', cid)
        npcHandler.topic[cid] = 3
    elseif isInArray({"magic sulphur", "fire sword", "Magic Sulphur", "Fire Sword"}, msg) then
        npcHandler:say('Do you want to trade 3 Fire Sword for Magic Sulphur', cid)
        npcHandler.topic[cid] = 4
    elseif isInArray({"job", "items", "Items", "Job"}, msg) then
        npcHandler:say('I trade Enchanted Chicken Wing for Boots of Haste, Warrior Sweat for 4 Warrior Helmets, Fighting Spirit for 2 Royal Helmet Magic Sulphur for 3 Fire Swords', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'cookie') then
        if player:getStorageValue(Storage.WhatAFoolishQuest.Questline) == 31
                and player:getStorageValue(Storage.WhatAFoolishQuest.CookieDelivery.Djinn) ~= 1 then
            npcHandler:say('You brought cookies! How nice of you! Can I have one?', cid)
            npcHandler.topic[cid] = 5
        end
    elseif msgcontains(msg,'yes') then
        if npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 4 then
            local trade = {
                    { NeedItem = 2195, Ncount = 1, GiveItem = 5891, Gcount = 1}, -- Enchanted Chicken Wing
                    { NeedItem = 2475, Ncount = 4, GiveItem = 5885, Gcount = 1}, -- Flask of Warrior's Sweat
                    { NeedItem = 2498, Ncount = 2, GiveItem = 5884, Gcount = 1}, -- Spirit Container
                    { NeedItem = 2392, Ncount = 3, GiveItem = 5904, Gcount = 1}  -- Magic Sulphur
            }
            if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount then
                player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount)
                player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount)
                return npcHandler:say('Here you are.', cid)
            else
                npcHandler:say('Sorry but you don\'t have the item.', cid)
            end
        elseif npcHandler.topic[cid] == 5 then
            if not player:removeItem(8111, 1) then
                npcHandler:say('You have no cookie that I\'d like.', cid)
                npcHandler.topic[cid] = 0
                return true
            end

            player:setStorageValue(Storage.WhatAFoolishQuest.CookieDelivery.Djinn, 1)
            if player:getCookiesDelivered() == 10 then
                player:addAchievement('Allow Cookies?')
            end

            Npc():getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
            npcHandler:say('You see, good deeds like this will ... YOU ... YOU SPAWN OF EVIL! I WILL MAKE SURE THE MASTER LEARNS ABOUT THIS!', cid)
            npcHandler:releaseFocus(cid)
            npcHandler:resetNpc(cid)
        end
    elseif msgcontains(msg,'no') then
        if npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 4 then
            npcHandler:say('Ok then.', cid)
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 5 then
            npcHandler:say('I see.', cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

local function onTradeRequest(cid)
    local player = Player(cid)
    if player:getStorageValue(Storage.DjinnWar.EfreetFaction.Mission03) ~= 3 then
        npcHandler:say('I\'m sorry, but you don\'t have Malor\'s permission to trade with me.', cid)
        return false
    end
    return true
end

-- Greeting
keywordHandler:addGreetKeyword({"djanni'hah"}, {npcHandler = npcHandler, text = "Be greeted, human |PLAYERNAME|. How can a humble djinn be of service?"})

npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell, human.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell, human.")
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

Rashid. 

 

function onStartup()

   --RASHID
   local days =
   {
      [1] = {x = 32328, y = 31782, z = 6}, --Sunday // Domingo
      [2] = {x = 32207, y = 31155, z = 7}, --Monday // Lunes
      [3] = {x = 32300, y = 32837, z = 7}, --Tuesday // Martes
      [4] = {x = 32577, y = 32753, z = 7}, --Wednesday // Miercoles
      [5] = {x = 33066, y = 32879, z = 6}, --Thursday // Jueves
      [6] = {x = 33235, y = 32483, z = 7}, --Friday // Viernes
      [7] = {x = 33166, y = 31810, z = 6} --Saturday // Sabado
   }

   local day = os.date("*t").wday
   if days[day] then
      doCreateNpc("Rashid", days[day])
   else
      print("[!] -> Cannot create Rashid. Day: " .. day .. ".")
   end
   return true
end
 

 

Haroun.

 

 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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if isInArray({"enchanted chicken wing", "boots of haste"}, msg) then
        npcHandler:say('Do you want to trade Boots of haste for Enchanted Chicken Wing?', cid)
        npcHandler.topic[cid] = 1
    elseif isInArray({"warrior sweat", "warrior helmet"}, msg) then
        npcHandler:say('Do you want to trade 4 Warrior Helmet for Warrior Sweat?', cid)
        npcHandler.topic[cid] = 2
    elseif isInArray({"fighting spirit", "royal helmet"}, msg) then
        npcHandler:say('Do you want to trade 2 Royal Helmet for Fighting Spirit', cid)
        npcHandler.topic[cid] = 3
    elseif isInArray({"magic sulphur", "fire sword"}, msg) then
        npcHandler:say('Do you want to trade 3 Fire Sword for Magic Sulphur', cid)
        npcHandler.topic[cid] = 4
    elseif isInArray({"job", "items"}, msg) then
        npcHandler:say('I trade Enchanted Chicken Wing for Boots of Haste, Warrior Sweat for 4 Warrior Helmets, Fighting Spirit for 2 Royal Helmet Magic Sulphur for 3 Fire Swords', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg,'yes') and npcHandler.topic[cid] <= 4 and npcHandler.topic[cid] >= 1 then
        local trade = {
                { NeedItem = 2195, Ncount = 1, GiveItem = 5891, Gcount = 1}, -- Enchanted Chicken Wing
                { NeedItem = 2475, Ncount = 4, GiveItem = 5885, Gcount = 1}, -- Flask of Warrior's Sweat
                { NeedItem = 2498, Ncount = 2, GiveItem = 5884, Gcount = 1}, -- Spirit Container
                { NeedItem = 2392, Ncount = 3, GiveItem = 5904, Gcount = 1}  -- Magic Sulphur
        }
        if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount then
            player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount)
            player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount)
            return npcHandler:say('Here you are.', cid)
        else
            npcHandler:say('Sorry but you don\'t have the item.', cid)
        end
    elseif msgcontains(msg,'no') and (npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 5) then
        npcHandler:say('Ok then.', cid)
        npcHandler.topic[cid] = 0
        npcHandler:releaseFocus(cid)
        npcHandler:resetNpc(cid)
    end
    return true
end

local function onTradeRequest(cid)
    local player = Player(cid)
    
    if player:getStorageValue(Storage.DjinnWar.MaridFaction.Mission03) ~= 3 then
        npcHandler:say('I\'m sorry, human. But you need Gabel\'s permission to trade with me.', cid)
        return false
    end

    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Be greeted, human |PLAYERNAME|. How can a humble djinn be of service?")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell! May the serene light of the enlightened one rest shine on your travels.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell, human.")
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

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

 

Nah Bob.

 

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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local player = Player(cid)

    if msgcontains(msg, 'cookie') then
        if player:getStorageValue(Storage.WhatAFoolishQuest.Questline) == 31
                and player:getStorageValue(Storage.WhatAFoolishQuest.CookieDelivery.Djinn) ~= 1 then
            npcHandler:say('You brought cookies! How nice of you! Can I have one?', cid)
            npcHandler.topic[cid] = 1
        end
    elseif msgcontains(msg, 'yes') then
        if npcHandler.topic[cid] == 1 then
            if not player:removeItem(8111, 1) then
                npcHandler:say('You have no cookie that I\'d like.', cid)
                npcHandler.topic[cid] = 0
                return true
            end

            player:setStorageValue(Storage.WhatAFoolishQuest.CookieDelivery.Djinn, 1)
            if player:getCookiesDelivered() == 10 then
                player:addAchievement('Allow Cookies?')
            end

            Npc():getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
            npcHandler:say('You see, good deeds like this will ... YOU ... YOU SPAWN OF EVIL! I WILL MAKE SURE THE MASTER LEARNS ABOUT THIS!', cid)
            npcHandler:releaseFocus(cid)
            npcHandler:resetNpc(cid)
        end
    elseif msgcontains(msg, 'no') then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say('I see.', cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

local function onTradeRequest(cid)
    local player = Player(cid)
    if player:getStorageValue(Storage.DjinnWar.MaridFaction.Mission03) ~= 3 then
        npcHandler:say('I\'m sorry, human. But you need Gabel\'s permission to trade with me.', cid)
        return false
    end

    return true
end

npcHandler:setMessage(MESSAGE_GREET, "<Sighs> Another {customer}! I've only just sat down! What is it, |PLAYERNAME|?")
npcHandler:setMessage(MESSAGE_FAREWELL, "Bye now, Neutrala |PLAYERNAME|. Visit old Bob again one day!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Bye then.")
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

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

Alesar.

 

 

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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local player = Player(cid)
    local missionProgress = player:getStorageValue(Storage.DjinnWar.EfreetFaction.Mission02)
    if msgcontains(msg, 'mission') then
        if player:getStorageValue(Storage.DjinnWar.EfreetFaction.Mission01) == 3 then
            if missionProgress < 1 then
                npcHandler:say({
                    'So Baa\'leal thinks you are up to do a mission for us? ...',
                    'I think he is getting old, entrusting human scum such as you are with an important mission like that. ...',
                    'Personally, I don\'t understand why you haven\'t been slaughtered right at the gates. ...',
                    'Anyway. Are you prepared to embark on a dangerous mission for us?'
                }, cid)
                npcHandler.topic[cid] = 1

            elseif isInArray({1, 2}, missionProgress) then
                npcHandler:say('Did you find the tear of Daraman?', cid)
                npcHandler.topic[cid] = 2
            else
                npcHandler:say('Don\'t forget to talk to Malor concerning your next mission.', cid)
            end
        end

    elseif npcHandler.topic[cid] == 1 then
        if msgcontains(msg, 'yes') then
            npcHandler:say({
                'All right then, human. Have you ever heard of the {\'Tears of Daraman\'}? ...',
                'They are precious gemstones made of some unknown blue mineral and possess enormous magical power. ...',
                'If you want to learn more about these gemstones don\'t forget to visit our library. ...',
                'Anyway, one of them is enough to create thousands of our mighty djinn blades. ...',
                'Unfortunately my last gemstone broke and therefore I\'m not able to create new blades anymore. ...',
                'To my knowledge there is only one place where you can find these gemstones - I know for a fact that the Marid have at least one of them. ...',
                'Well... to cut a long story short, your mission is to sneak into Ashta\'daramai and to steal it. ...',
                'Needless to say, the Marid won\'t be too eager to part with it. Try not to get killed until you have delivered the stone to me.'
            }, cid)
            player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission02, 1)

        elseif msgcontains(msg, 'no') then
            npcHandler:say('Then not.', cid)
        end
        npcHandler.topic[cid] = 0

    elseif npcHandler.topic[cid] == 2 then
        if msgcontains(msg, 'yes') then
            if player:getItemCount(2346) == 0 or missionProgress ~= 2 then
                npcHandler:say('As I expected. You haven\'t got the stone. Shall I explain your mission again?', cid)
                npcHandler.topic[cid] = 1
            else
                npcHandler:say({
                    'So you have made it? You have really managed to steal a Tear of Daraman? ...',
                    'Amazing how you humans are just impossible to get rid of. Incidentally, you have this character trait in common with many insects and with other vermin. ...',
                    'Nevermind. I hate to say it, but it you have done us a favour, human. That gemstone will serve us well. ...',
                    'Baa\'leal, wants you to talk to Malor concerning some new mission. ...',
                    'Looks like you have managed to extended your life expectancy - for just a bit longer.'
                }, cid)
                player:removeItem(2346, 1)
                player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission02, 3)
                npcHandler.topic[cid] = 0
            end

        elseif msgcontains(msg, 'no') then
            npcHandler:say('As I expected. You haven\'t got the stone. Shall I explain your mission again?', cid)
            npcHandler.topic[cid] = 1
        end
    end
    return true
end

local function onTradeRequest(cid)
    local player = Player(cid)
    
    if player:getStorageValue(Storage.DjinnWar.EfreetFaction.Mission03) ~= 3 then
        npcHandler:say('I\'m sorry, but you don\'t have Malor\'s permission to trade with me.', cid)
        return false
    end

    return true
end

-- Greeting
keywordHandler:addGreetKeyword({"djanni'hah"}, {npcHandler = npcHandler, text = "What do you want from me, |PLAYERNAME|?"})

npcHandler:setMessage(MESSAGE_FAREWELL, 'Finally.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Finally.')
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

npcHandler:addModule(FocusModule:new())

Link para o post
Compartilhar em outros sites

Yaman:

Spoiler

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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local player = Player(cid)
    if isInArray({"enchanted chicken wing", "boots of haste", "Enchanted Chicken Wing", "Boots of Haste"}, msg) then
        npcHandler:say('Do you want to trade Boots of haste for Enchanted Chicken Wing?', cid)
        npcHandler.topic[cid] = 1
    elseif isInArray({"warrior sweat", "warrior helmet", "Warrior Sweat", "Warrior Helmet"}, msg) then
        npcHandler:say('Do you want to trade 4 Warrior Helmet for Warrior Sweat?', cid)
        npcHandler.topic[cid] = 2
    elseif isInArray({"fighting spirit", "royal helmet", "Fighting Spirit", "Royal Helmet"}, msg) then
        npcHandler:say('Do you want to trade 2 Royal Helmet for Fighting Spirit', cid)
        npcHandler.topic[cid] = 3
    elseif isInArray({"magic sulphur", "fire sword", "Magic Sulphur", "Fire Sword"}, msg) then
        npcHandler:say('Do you want to trade 3 Fire Sword for Magic Sulphur', cid)
        npcHandler.topic[cid] = 4
    elseif isInArray({"job", "items", "Items", "Job"}, msg) then
        npcHandler:say('I trade Enchanted Chicken Wing for Boots of Haste, Warrior Sweat for 4 Warrior Helmets, Fighting Spirit for 2 Royal Helmet Magic Sulphur for 3 Fire Swords', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'cookie') then
        npcHandler:say('You brought cookies! How nice of you! Can I have one?', cid)
        npcHandler.topic[cid] = 5
    elseif msgcontains(msg,'yes') then
        if npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 4 then
            local trade = {
                    { NeedItem = 2195, Ncount = 1, GiveItem = 5891, Gcount = 1}, -- Enchanted Chicken Wing
                    { NeedItem = 2475, Ncount = 4, GiveItem = 5885, Gcount = 1}, -- Flask of Warrior's Sweat
                    { NeedItem = 2498, Ncount = 2, GiveItem = 5884, Gcount = 1}, -- Spirit Container
                    { NeedItem = 2392, Ncount = 3, GiveItem = 5904, Gcount = 1}  -- Magic Sulphur
            }
            if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount then
                player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount)
                player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount)
                return npcHandler:say('Here you are.', cid)
            else
                npcHandler:say('Sorry but you don\'t have the item.', cid)
            end
        elseif npcHandler.topic[cid] == 5 then
            if not player:removeItem(8111, 1) then
                npcHandler:say('You have no cookie that I\'d like.', cid)
                npcHandler.topic[cid] = 0
                return true
            end

            player:setStorageValue(Storage.WhatAFoolishQuest.CookieDelivery.Djinn, 1)
            if player:getCookiesDelivered() == 10 then
                player:addAchievement('Allow Cookies?')
            end

            Npc():getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
            npcHandler:say('You see, good deeds like this will ... YOU ... YOU SPAWN OF EVIL! I WILL MAKE SURE THE MASTER LEARNS ABOUT THIS!', cid)
            npcHandler:releaseFocus(cid)
            npcHandler:resetNpc(cid)
        end
    elseif msgcontains(msg,'no') then
        if npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 4 then
            npcHandler:say('Ok then.', cid)
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 5 then
            npcHandler:say('I see.', cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

local function onTradeRequest(cid)
    return true
end

-- Greeting
keywordHandler:addGreetKeyword({"djanni'hah"}, {npcHandler = npcHandler, text = "Be greeted, human |PLAYERNAME|. How can a humble djinn be of service?"})

npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell, human.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell, human.")
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

npcHandler:addModule(FocusModule:new())

 

 

Rashid: o script não é esse que você mandou.

 

Haroun:

Spoiler

 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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if isInArray({"enchanted chicken wing", "boots of haste"}, msg) then
        npcHandler:say('Do you want to trade Boots of haste for Enchanted Chicken Wing?', cid)
        npcHandler.topic[cid] = 1
    elseif isInArray({"warrior sweat", "warrior helmet"}, msg) then
        npcHandler:say('Do you want to trade 4 Warrior Helmet for Warrior Sweat?', cid)
        npcHandler.topic[cid] = 2
    elseif isInArray({"fighting spirit", "royal helmet"}, msg) then
        npcHandler:say('Do you want to trade 2 Royal Helmet for Fighting Spirit', cid)
        npcHandler.topic[cid] = 3
    elseif isInArray({"magic sulphur", "fire sword"}, msg) then
        npcHandler:say('Do you want to trade 3 Fire Sword for Magic Sulphur', cid)
        npcHandler.topic[cid] = 4
    elseif isInArray({"job", "items"}, msg) then
        npcHandler:say('I trade Enchanted Chicken Wing for Boots of Haste, Warrior Sweat for 4 Warrior Helmets, Fighting Spirit for 2 Royal Helmet Magic Sulphur for 3 Fire Swords', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg,'yes') and npcHandler.topic[cid] <= 4 and npcHandler.topic[cid] >= 1 then
        local trade = {
                { NeedItem = 2195, Ncount = 1, GiveItem = 5891, Gcount = 1}, -- Enchanted Chicken Wing
                { NeedItem = 2475, Ncount = 4, GiveItem = 5885, Gcount = 1}, -- Flask of Warrior's Sweat
                { NeedItem = 2498, Ncount = 2, GiveItem = 5884, Gcount = 1}, -- Spirit Container
                { NeedItem = 2392, Ncount = 3, GiveItem = 5904, Gcount = 1}  -- Magic Sulphur
        }
        if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount then
            player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount)
            player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount)
            return npcHandler:say('Here you are.', cid)
        else
            npcHandler:say('Sorry but you don\'t have the item.', cid)
        end
    elseif msgcontains(msg,'no') and (npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 5) then
        npcHandler:say('Ok then.', cid)
        npcHandler.topic[cid] = 0
        npcHandler:releaseFocus(cid)
        npcHandler:resetNpc(cid)
    end
    return true
end

local function onTradeRequest(cid)
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Be greeted, human |PLAYERNAME|. How can a humble djinn be of service?")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell! May the serene light of the enlightened one rest shine on your travels.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell, human.")
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

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

 

 

Nah Bob: 

Spoiler

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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local player = Player(cid)

    if msgcontains(msg, 'cookie') then
        npcHandler:say('You brought cookies! How nice of you! Can I have one?', cid)
        npcHandler.topic[cid] = 1
    elseif msgcontains(msg, 'yes') then
        if npcHandler.topic[cid] == 1 then
            if not player:removeItem(8111, 1) then
                npcHandler:say('You have no cookie that I\'d like.', cid)
                npcHandler.topic[cid] = 0
                return true
            end

            player:setStorageValue(Storage.WhatAFoolishQuest.CookieDelivery.Djinn, 1)
            if player:getCookiesDelivered() == 10 then
                player:addAchievement('Allow Cookies?')
            end

            Npc():getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
            npcHandler:say('You see, good deeds like this will ... YOU ... YOU SPAWN OF EVIL! I WILL MAKE SURE THE MASTER LEARNS ABOUT THIS!', cid)
            npcHandler:releaseFocus(cid)
            npcHandler:resetNpc(cid)
        end
    elseif msgcontains(msg, 'no') then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say('I see.', cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

local function onTradeRequest(cid)
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "<Sighs> Another {customer}! I've only just sat down! What is it, |PLAYERNAME|?")
npcHandler:setMessage(MESSAGE_FAREWELL, "Bye now, Neutrala |PLAYERNAME|. Visit old Bob again one day!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Bye then.")
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

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

 

 

Alesar:

Spoiler

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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local player = Player(cid)
    local missionProgress = player:getStorageValue(Storage.DjinnWar.EfreetFaction.Mission02)
    if msgcontains(msg, 'mission') then
        if player:getStorageValue(Storage.DjinnWar.EfreetFaction.Mission01) == 3 then
            if missionProgress < 1 then
                npcHandler:say({
                    'So Baa\'leal thinks you are up to do a mission for us? ...',
                    'I think he is getting old, entrusting human scum such as you are with an important mission like that. ...',
                    'Personally, I don\'t understand why you haven\'t been slaughtered right at the gates. ...',
                    'Anyway. Are you prepared to embark on a dangerous mission for us?'
                }, cid)
                npcHandler.topic[cid] = 1

            elseif isInArray({1, 2}, missionProgress) then
                npcHandler:say('Did you find the tear of Daraman?', cid)
                npcHandler.topic[cid] = 2
            else
                npcHandler:say('Don\'t forget to talk to Malor concerning your next mission.', cid)
            end
        end

    elseif npcHandler.topic[cid] == 1 then
        if msgcontains(msg, 'yes') then
            npcHandler:say({
                'All right then, human. Have you ever heard of the {\'Tears of Daraman\'}? ...',
                'They are precious gemstones made of some unknown blue mineral and possess enormous magical power. ...',
                'If you want to learn more about these gemstones don\'t forget to visit our library. ...',
                'Anyway, one of them is enough to create thousands of our mighty djinn blades. ...',
                'Unfortunately my last gemstone broke and therefore I\'m not able to create new blades anymore. ...',
                'To my knowledge there is only one place where you can find these gemstones - I know for a fact that the Marid have at least one of them. ...',
                'Well... to cut a long story short, your mission is to sneak into Ashta\'daramai and to steal it. ...',
                'Needless to say, the Marid won\'t be too eager to part with it. Try not to get killed until you have delivered the stone to me.'
            }, cid)
            player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission02, 1)

        elseif msgcontains(msg, 'no') then
            npcHandler:say('Then not.', cid)
        end
        npcHandler.topic[cid] = 0

    elseif npcHandler.topic[cid] == 2 then
        if msgcontains(msg, 'yes') then
            if player:getItemCount(2346) == 0 or missionProgress ~= 2 then
                npcHandler:say('As I expected. You haven\'t got the stone. Shall I explain your mission again?', cid)
                npcHandler.topic[cid] = 1
            else
                npcHandler:say({
                    'So you have made it? You have really managed to steal a Tear of Daraman? ...',
                    'Amazing how you humans are just impossible to get rid of. Incidentally, you have this character trait in common with many insects and with other vermin. ...',
                    'Nevermind. I hate to say it, but it you have done us a favour, human. That gemstone will serve us well. ...',
                    'Baa\'leal, wants you to talk to Malor concerning some new mission. ...',
                    'Looks like you have managed to extended your life expectancy - for just a bit longer.'
                }, cid)
                player:removeItem(2346, 1)
                player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission02, 3)
                npcHandler.topic[cid] = 0
            end

        elseif msgcontains(msg, 'no') then
            npcHandler:say('As I expected. You haven\'t got the stone. Shall I explain your mission again?', cid)
            npcHandler.topic[cid] = 1
        end
    end
    return true
end

local function onTradeRequest(cid)
    return true
end

-- Greeting
keywordHandler:addGreetKeyword({"djanni'hah"}, {npcHandler = npcHandler, text = "What do you want from me, |PLAYERNAME|?"})

npcHandler:setMessage(MESSAGE_FAREWELL, 'Finally.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Finally.')
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

Link para o post
Compartilhar em outros sites
1 hora atrás, luanluciano93 disse:

Yaman:

  Ocultar conteúdo


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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local player = Player(cid)
    if isInArray({"enchanted chicken wing", "boots of haste", "Enchanted Chicken Wing", "Boots of Haste"}, msg) then
        npcHandler:say('Do you want to trade Boots of haste for Enchanted Chicken Wing?', cid)
        npcHandler.topic[cid] = 1
    elseif isInArray({"warrior sweat", "warrior helmet", "Warrior Sweat", "Warrior Helmet"}, msg) then
        npcHandler:say('Do you want to trade 4 Warrior Helmet for Warrior Sweat?', cid)
        npcHandler.topic[cid] = 2
    elseif isInArray({"fighting spirit", "royal helmet", "Fighting Spirit", "Royal Helmet"}, msg) then
        npcHandler:say('Do you want to trade 2 Royal Helmet for Fighting Spirit', cid)
        npcHandler.topic[cid] = 3
    elseif isInArray({"magic sulphur", "fire sword", "Magic Sulphur", "Fire Sword"}, msg) then
        npcHandler:say('Do you want to trade 3 Fire Sword for Magic Sulphur', cid)
        npcHandler.topic[cid] = 4
    elseif isInArray({"job", "items", "Items", "Job"}, msg) then
        npcHandler:say('I trade Enchanted Chicken Wing for Boots of Haste, Warrior Sweat for 4 Warrior Helmets, Fighting Spirit for 2 Royal Helmet Magic Sulphur for 3 Fire Swords', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'cookie') then
        npcHandler:say('You brought cookies! How nice of you! Can I have one?', cid)
        npcHandler.topic[cid] = 5
    elseif msgcontains(msg,'yes') then
        if npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 4 then
            local trade = {
                    { NeedItem = 2195, Ncount = 1, GiveItem = 5891, Gcount = 1}, -- Enchanted Chicken Wing
                    { NeedItem = 2475, Ncount = 4, GiveItem = 5885, Gcount = 1}, -- Flask of Warrior's Sweat
                    { NeedItem = 2498, Ncount = 2, GiveItem = 5884, Gcount = 1}, -- Spirit Container
                    { NeedItem = 2392, Ncount = 3, GiveItem = 5904, Gcount = 1}  -- Magic Sulphur
            }
            if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount then
                player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount)
                player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount)
                return npcHandler:say('Here you are.', cid)
            else
                npcHandler:say('Sorry but you don\'t have the item.', cid)
            end
        elseif npcHandler.topic[cid] == 5 then
            if not player:removeItem(8111, 1) then
                npcHandler:say('You have no cookie that I\'d like.', cid)
                npcHandler.topic[cid] = 0
                return true
            end

            player:setStorageValue(Storage.WhatAFoolishQuest.CookieDelivery.Djinn, 1)
            if player:getCookiesDelivered() == 10 then
                player:addAchievement('Allow Cookies?')
            end

            Npc():getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
            npcHandler:say('You see, good deeds like this will ... YOU ... YOU SPAWN OF EVIL! I WILL MAKE SURE THE MASTER LEARNS ABOUT THIS!', cid)
            npcHandler:releaseFocus(cid)
            npcHandler:resetNpc(cid)
        end
    elseif msgcontains(msg,'no') then
        if npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 4 then
            npcHandler:say('Ok then.', cid)
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 5 then
            npcHandler:say('I see.', cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

local function onTradeRequest(cid)
    return true
end

-- Greeting
keywordHandler:addGreetKeyword({"djanni'hah"}, {npcHandler = npcHandler, text = "Be greeted, human |PLAYERNAME|. How can a humble djinn be of service?"})

npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell, human.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell, human.")
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

npcHandler:addModule(FocusModule:new())

 

 

Rashid: o script não é esse que você mandou.

 

Haroun:

  Mostrar conteúdo oculto


 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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if isInArray({"enchanted chicken wing", "boots of haste"}, msg) then
        npcHandler:say('Do you want to trade Boots of haste for Enchanted Chicken Wing?', cid)
        npcHandler.topic[cid] = 1
    elseif isInArray({"warrior sweat", "warrior helmet"}, msg) then
        npcHandler:say('Do you want to trade 4 Warrior Helmet for Warrior Sweat?', cid)
        npcHandler.topic[cid] = 2
    elseif isInArray({"fighting spirit", "royal helmet"}, msg) then
        npcHandler:say('Do you want to trade 2 Royal Helmet for Fighting Spirit', cid)
        npcHandler.topic[cid] = 3
    elseif isInArray({"magic sulphur", "fire sword"}, msg) then
        npcHandler:say('Do you want to trade 3 Fire Sword for Magic Sulphur', cid)
        npcHandler.topic[cid] = 4
    elseif isInArray({"job", "items"}, msg) then
        npcHandler:say('I trade Enchanted Chicken Wing for Boots of Haste, Warrior Sweat for 4 Warrior Helmets, Fighting Spirit for 2 Royal Helmet Magic Sulphur for 3 Fire Swords', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg,'yes') and npcHandler.topic[cid] <= 4 and npcHandler.topic[cid] >= 1 then
        local trade = {
                { NeedItem = 2195, Ncount = 1, GiveItem = 5891, Gcount = 1}, -- Enchanted Chicken Wing
                { NeedItem = 2475, Ncount = 4, GiveItem = 5885, Gcount = 1}, -- Flask of Warrior's Sweat
                { NeedItem = 2498, Ncount = 2, GiveItem = 5884, Gcount = 1}, -- Spirit Container
                { NeedItem = 2392, Ncount = 3, GiveItem = 5904, Gcount = 1}  -- Magic Sulphur
        }
        if player:getItemCount(trade[npcHandler.topic[cid]].NeedItem) >= trade[npcHandler.topic[cid]].Ncount then
            player:removeItem(trade[npcHandler.topic[cid]].NeedItem, trade[npcHandler.topic[cid]].Ncount)
            player:addItem(trade[npcHandler.topic[cid]].GiveItem, trade[npcHandler.topic[cid]].Gcount)
            return npcHandler:say('Here you are.', cid)
        else
            npcHandler:say('Sorry but you don\'t have the item.', cid)
        end
    elseif msgcontains(msg,'no') and (npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 5) then
        npcHandler:say('Ok then.', cid)
        npcHandler.topic[cid] = 0
        npcHandler:releaseFocus(cid)
        npcHandler:resetNpc(cid)
    end
    return true
end

local function onTradeRequest(cid)
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Be greeted, human |PLAYERNAME|. How can a humble djinn be of service?")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell! May the serene light of the enlightened one rest shine on your travels.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell, human.")
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

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

 

 

Nah Bob: 

  Mostrar conteúdo oculto


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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local player = Player(cid)

    if msgcontains(msg, 'cookie') then
        npcHandler:say('You brought cookies! How nice of you! Can I have one?', cid)
        npcHandler.topic[cid] = 1
    elseif msgcontains(msg, 'yes') then
        if npcHandler.topic[cid] == 1 then
            if not player:removeItem(8111, 1) then
                npcHandler:say('You have no cookie that I\'d like.', cid)
                npcHandler.topic[cid] = 0
                return true
            end

            player:setStorageValue(Storage.WhatAFoolishQuest.CookieDelivery.Djinn, 1)
            if player:getCookiesDelivered() == 10 then
                player:addAchievement('Allow Cookies?')
            end

            Npc():getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
            npcHandler:say('You see, good deeds like this will ... YOU ... YOU SPAWN OF EVIL! I WILL MAKE SURE THE MASTER LEARNS ABOUT THIS!', cid)
            npcHandler:releaseFocus(cid)
            npcHandler:resetNpc(cid)
        end
    elseif msgcontains(msg, 'no') then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say('I see.', cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

local function onTradeRequest(cid)
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "<Sighs> Another {customer}! I've only just sat down! What is it, |PLAYERNAME|?")
npcHandler:setMessage(MESSAGE_FAREWELL, "Bye now, Neutrala |PLAYERNAME|. Visit old Bob again one day!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Bye then.")
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

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

 

 

Alesar:

  Mostrar conteúdo oculto


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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local player = Player(cid)
    local missionProgress = player:getStorageValue(Storage.DjinnWar.EfreetFaction.Mission02)
    if msgcontains(msg, 'mission') then
        if player:getStorageValue(Storage.DjinnWar.EfreetFaction.Mission01) == 3 then
            if missionProgress < 1 then
                npcHandler:say({
                    'So Baa\'leal thinks you are up to do a mission for us? ...',
                    'I think he is getting old, entrusting human scum such as you are with an important mission like that. ...',
                    'Personally, I don\'t understand why you haven\'t been slaughtered right at the gates. ...',
                    'Anyway. Are you prepared to embark on a dangerous mission for us?'
                }, cid)
                npcHandler.topic[cid] = 1

            elseif isInArray({1, 2}, missionProgress) then
                npcHandler:say('Did you find the tear of Daraman?', cid)
                npcHandler.topic[cid] = 2
            else
                npcHandler:say('Don\'t forget to talk to Malor concerning your next mission.', cid)
            end
        end

    elseif npcHandler.topic[cid] == 1 then
        if msgcontains(msg, 'yes') then
            npcHandler:say({
                'All right then, human. Have you ever heard of the {\'Tears of Daraman\'}? ...',
                'They are precious gemstones made of some unknown blue mineral and possess enormous magical power. ...',
                'If you want to learn more about these gemstones don\'t forget to visit our library. ...',
                'Anyway, one of them is enough to create thousands of our mighty djinn blades. ...',
                'Unfortunately my last gemstone broke and therefore I\'m not able to create new blades anymore. ...',
                'To my knowledge there is only one place where you can find these gemstones - I know for a fact that the Marid have at least one of them. ...',
                'Well... to cut a long story short, your mission is to sneak into Ashta\'daramai and to steal it. ...',
                'Needless to say, the Marid won\'t be too eager to part with it. Try not to get killed until you have delivered the stone to me.'
            }, cid)
            player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission02, 1)

        elseif msgcontains(msg, 'no') then
            npcHandler:say('Then not.', cid)
        end
        npcHandler.topic[cid] = 0

    elseif npcHandler.topic[cid] == 2 then
        if msgcontains(msg, 'yes') then
            if player:getItemCount(2346) == 0 or missionProgress ~= 2 then
                npcHandler:say('As I expected. You haven\'t got the stone. Shall I explain your mission again?', cid)
                npcHandler.topic[cid] = 1
            else
                npcHandler:say({
                    'So you have made it? You have really managed to steal a Tear of Daraman? ...',
                    'Amazing how you humans are just impossible to get rid of. Incidentally, you have this character trait in common with many insects and with other vermin. ...',
                    'Nevermind. I hate to say it, but it you have done us a favour, human. That gemstone will serve us well. ...',
                    'Baa\'leal, wants you to talk to Malor concerning some new mission. ...',
                    'Looks like you have managed to extended your life expectancy - for just a bit longer.'
                }, cid)
                player:removeItem(2346, 1)
                player:setStorageValue(Storage.DjinnWar.EfreetFaction.Mission02, 3)
                npcHandler.topic[cid] = 0
            end

        elseif msgcontains(msg, 'no') then
            npcHandler:say('As I expected. You haven\'t got the stone. Shall I explain your mission again?', cid)
            npcHandler.topic[cid] = 1
        end
    end
    return true
end

local function onTradeRequest(cid)
    return true
end

-- Greeting
keywordHandler:addGreetKeyword({"djanni'hah"}, {npcHandler = npcHandler, text = "What do you want from me, |PLAYERNAME|?"})

npcHandler:setMessage(MESSAGE_FAREWELL, 'Finally.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Finally.')
npcHandler:setMessage(MESSAGE_SENDTRADE, 'At your service, just browse through my wares.')

npcHandler:setCallback(CALLBACK_ONTRADEREQUEST, onTradeRequest)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

npcHandler:addModule(FocusModule:new())

 

 

 

Mano funcionou aqui em todos obrigado, no Rashid o código que tem é esse.

 

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 function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local player = Player(cid)
    if(msgcontains(msg, "mission")) then
        if(os.date("%A") == "Monday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission01) < 1) then
                npcHandler:say("Well, you could attempt the mission to become a recognised trader, but it requires a lot of travelling. Are you willing to try?", cid)
                npcHandler.topic[cid] = 1
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission01) == 1) then
                npcHandler:say("Have you managed to obtain a rare deer trophy for my customer?", cid)
                npcHandler.topic[cid] = 3
            end
        elseif(os.date("%A") == "Tuesday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission01) == 2 and player:getStorageValue(Storage.TravellingTrader.Mission02) < 1 ) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 4
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission02) == 4) then
                npcHandler:say("Did you bring me the package?", cid)
                npcHandler.topic[cid] = 6
            end
        elseif(os.date("%A") == "Wednesday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission02) == 5 and player:getStorageValue(Storage.TravellingTrader.Mission03) < 1 ) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 7
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission03) == 2) then
                npcHandler:say("Have you brought the cheese?", cid)
                npcHandler.topic[cid] = 9
            end
        elseif(os.date("%A") == "Thursday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission03) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission04) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 10
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission04) == 2) then
                npcHandler:say("Have you brought the vase?", cid)
                npcHandler.topic[cid] = 12
            end
        elseif(os.date("%A") == "Friday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission04) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission05) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 13
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission05) == 2) then
                npcHandler:say("Have you brought a cheap but good crimson sword?", cid)
                npcHandler.topic[cid] = 15
            end
        elseif(os.date("%A") == "Saturday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission05) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission06) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 16
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission06) == 1) then
                npcHandler:say("Have you brought me a gold fish??", cid)
                npcHandler.topic[cid] = 18
            end
        elseif(os.date("%A") == "Sunday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission06) == 2 and player:getStorageValue(Storage.TravellingTrader.Mission07) ~= 1) then
                npcHandler:say("Ah, right. <ahem> I hereby declare you - one of my recognised traders! Feel free to offer me your wares!", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission07, 1)
                player:addAchievement('Recognised Trader')
                npcHandler.topic[cid] = 0
            end
        end
    elseif(msgcontains(msg, "yes")) then
        if(npcHandler.topic[cid] == 1) then
            npcHandler:say({
                "Very good! I need talented people who are able to handle my wares with care, find good offers and the like, so I'm going to test you. ...",
                "First, I'd like to see if you can dig up rare wares. Something like a ... mastermind shield! ...",
                "Haha, just kidding, fooled you there, didn't I? Always control your nerves, that's quite important during bargaining. ...",
                "Okay, all I want from you is one of these rare deer trophies. I have a customer here in Svargrond who ordered one, so I'd like you to deliver it tome while I'm in Svargrond. ...",
                "Everything clear and understood?"
            }, cid)

            npcHandler.topic[cid] = 2
        elseif(npcHandler.topic[cid] == 2) then
            npcHandler:say("Fine. Then get a hold of that deer trophy and bring it to me while I'm in Svargrond. Just ask me about your mission.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission01, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 3) then
            if player:removeItem(7397, 1) then
                npcHandler:say("Well done! I'll take that from you. <snags it> Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission01, 2)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 4) then
            npcHandler:say({
                "Alright, that's good to hear. From you as my trader and deliveryman, I expect more than finding rare items. ...",
                "You also need to be able to transport heavy wares, weaklings won't get far here. I have ordered a special package from Edron. ...",
                "Pick it up from Willard and bring it back to me while I'm in Liberty Bay. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 5
        elseif(npcHandler.topic[cid] == 5) then
            npcHandler:say("Fine. Then off you go, just ask Willard about the 'package for Rashid'.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission02, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 6) then
            if player:removeItem(7503, 1) then
                npcHandler:say("Great. Just place it over there - yes, thanks, that's it. Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission02, 5)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 7) then
            npcHandler:say({
                "Well, that's good to hear. From you as my trader and deliveryman, I expect more than carrying heavy packages. ...",
                "You also need to be fast and deliver wares in time. I have ordered a very special cheese wheel made from Darashian milk. ...",
                "Unfortunately, the high temperature in the desert makes it rot really fast, so it must not stay in the sun for too long. ...",
                "I'm also afraid that you might not be able to use ships because of the smell of the cheese. ...",
                "Please get the cheese from Miraia and bring it to me while I'm in Port Hope. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 8
        elseif(npcHandler.topic[cid] == ? then
            npcHandler:say("Okay, then please find Miraia in Darashia and ask her about the {'scarab cheese'}.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission03, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 9) then
            if player:removeItem(8112, 1) then
                npcHandler:say("Mmmhh, the lovely odeur of scarab cheese! I really can't understand why most people can't stand it. Thanks, well done! ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission03, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 10) then
            npcHandler:say({
                "Well, that's good to hear. From you as my trader and deliveryman, I expect more than bringing stinky cheese. ...",
                "I wonder if you are able to deliver goods so fragile they almost break when looked at. ...",
                "I have ordered a special elven vase from Briasol in Ab'Dendriel. Get it from him and don't even touch it, just bring it to me while I'm in Ankrahmun. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 11
        elseif(npcHandler.topic[cid] == 11) then
            npcHandler:say("Okay, then please find {Briasol} in {Ab'Dendriel} and ask for a {'fine vase'}.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission04, 1)
            player:addMoney(1000)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 12) then
            if player:removeItem(7582, 1) then
                npcHandler:say("I'm surprised that you managed to bring this vase without a single crack. That was what I needed to know, thank you. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission04, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 13) then
            npcHandler:say({
                "Fine! There's one more skill that I need to test and which is cruicial for a successful trader. ...",
                "Of course you must be able to haggle, else you won't survive long in this business. To make things as hard as possible for you, I have the perfect trade partner for you. ...",
                "Dwarves are said to be the most stubborn of all traders. Travel to {Kazordoon} and try to get the smith {Uzgod} to sell a {crimson sword} to you. ...",
                "Of course, it has to be cheap. Don't come back with anything more expensive than 400 gold. ...",
                "And the quality must not suffer, of course! Everything clear and understood?",
                "Dwarves are said to be the most stubborn of all traders. Travel to Kazordoon and try to get the smith Uzgod to sell a crimson sword to you. ..."
            }, cid)
            npcHandler.topic[cid] = 14
        elseif(npcHandler.topic[cid] == 14) then
            npcHandler:say("Okay, I'm curious how you will do with {Uzgod}. Good luck!", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission05, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 15) then
            if player:removeItem(7385, 1) then
                npcHandler:say("Ha! You are clever indeed, well done! I'll take this from you. Come see me tomorrow, I think we two might get into business after all.", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission05, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 16) then
            npcHandler:say({
                "My friend, it seems you have already learnt a lot about the art of trading. I think you are more than worthy to become a recognised trader. ...",
                "There is just one little favour that I would ask from you... something personal, actually, forgive my boldness. ...",
                "I have always dreamed to have a small pet, one that I could take with me and which wouldn't cause problems. ...",
                "Could you - just maybe - bring me a small goldfish in a bowl? I know that you would be able to get one, wouldn't you?"
            }, cid)
            npcHandler.topic[cid] = 17
        elseif(npcHandler.topic[cid] == 17) then
            npcHandler:say("Thanks so much! I'll be waiting eagerly for your return then.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission06, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 18) then
            if player:removeItem(5929, 1) then
                npcHandler:say("Thank you!! Ah, this makes my day! I'll take the rest of the day off to get to know this little guy. Come see me tomorrow, if you like.", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission06, 2)
                npcHandler.topic[cid] = 0
            end
        end
    end
    return true
end

keywordHandler:addKeyword({"job"}, StdModule.say, {npcHandler = npcHandler, text = "I am a travelling trader. I don't buy everything, though. And not from everyone, for that matter."})
keywordHandler:addKeyword({"name"}, StdModule.say, {npcHandler = npcHandler, text = "I am Rashid, son of the desert."})
keywordHandler:addKeyword({"offers"}, StdModule.say, {npcHandler = npcHandler, text = "Of course, old friend. You can also browse only armor, legs, shields, helmets, boots, weapons, enchanted weapons, jewelry or miscellaneous stuff."})
keywordHandler:addKeyword({"ab'dendriel"}, StdModule.say, {npcHandler = npcHandler, text = "Elves... I don't really trust them. All this talk about nature and flowers and treehugging... I'm sure there's some wicked scheme behind all this."})
keywordHandler:addKeyword({"desert"}, StdModule.say, {npcHandler = npcHandler, text = "My beloved hometown! Ah, the sweet scent of the desert sands, the perfect shape of the pyramids... stunningly beautiful."})
keywordHandler:addKeyword({"carlin"}, StdModule.say, {npcHandler = npcHandler, text = "I have to go to Carlin once in a while, since the queen wishes to see my exclusive wares in regular intervals."})
keywordHandler:addKeyword({"cormaya"}, StdModule.say, {npcHandler = npcHandler, text = "Cormaya? Not a good place to make business, it's way too far and small."})
keywordHandler:addKeyword({"darashia"}, StdModule.say, {npcHandler = npcHandler, text = "It's not the real thing, but almost as good. The merchants there claim ridiculous prices, which is fine for my own business."})
keywordHandler:addKeyword({"edron"}, StdModule.say, {npcHandler = npcHandler, text = "Ah yes, Edron! Such a lovely and quiet island! I usually make some nice business there."})
keywordHandler:addKeyword({"fibula"}, StdModule.say, {npcHandler = npcHandler, text = "Too few customers there, it's not worth the trip."})
keywordHandler:addKeyword({"greenshore"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"kazordoon"}, StdModule.say, {npcHandler = npcHandler, text = "I don't like being underground much. I also tend to get lost in these labyrinthine dwarven tunnels, so I rather avoid them."})
keywordHandler:addKeyword({"liberty bay"}, StdModule.say, {npcHandler = npcHandler, text = "When you avoid the slums, it's a really pretty city. Almost as pretty as the governor's daughter."})
keywordHandler:addKeyword({"northport"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"port hope"}, StdModule.say, {npcHandler = npcHandler, text = "I like the settlement itself, but I don't set my foot into the jungle. Have you seen the size of these centipedes??"})
keywordHandler:addKeyword({"senja"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"svargrond"}, StdModule.say, {npcHandler = npcHandler, text = "I wish it was a little bit warmer there, but with a good mug of barbarian mead in your tummy everything gets a lot cosier."})
keywordHandler:addKeyword({"thais"}, StdModule.say, {npcHandler = npcHandler, text = "I feel uncomfortable and rather unsafe in Thais, so I don't really travel there."})
keywordHandler:addKeyword({"vega"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"venore"}, StdModule.say, {npcHandler = npcHandler, text = "Although it's the flourishing trade centre of Tibia, I don't like going there. Too much competition for my taste."})
keywordHandler:addKeyword({"time"}, StdModule.say, {npcHandler = npcHandler, text = "It's almost time to journey on."})
keywordHandler:addKeyword({"king"}, StdModule.say, {npcHandler = npcHandler, text = "Kings, queens, emperors and kaliphs... everyone claims to be different and unique, but actually it's the same thing everywhere."})

npcHandler:setMessage(MESSAGE_GREET, "Ah, a customer! Be greeted, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell, |PLAYERNAME|, may the winds guide your way.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Come back soon!")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Take all the time you need to decide what you want!")

local function onTradeRequest(cid)
    if Player(cid):getStorageValue(Storage.TravellingTrader.Mission07) ~= 1 then
        npcHandler:say('Sorry, but you do not belong to my exclusive customers. I have to make sure that I can trust in the quality of your wares.', cid)
        return false
    end

    return true
end

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

Editado por Leonardo Oppai
Achei o código que era o correto (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
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 function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local player = Player(cid)
    if(msgcontains(msg, "mission")) then
        if(os.date("%A") == "Monday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission01) < 1) then
                npcHandler:say("Well, you could attempt the mission to become a recognised trader, but it requires a lot of travelling. Are you willing to try?", cid)
                npcHandler.topic[cid] = 1
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission01) == 1) then
                npcHandler:say("Have you managed to obtain a rare deer trophy for my customer?", cid)
                npcHandler.topic[cid] = 3
            end
        elseif(os.date("%A") == "Tuesday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission01) == 2 and player:getStorageValue(Storage.TravellingTrader.Mission02) < 1 ) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 4
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission02) == 4) then
                npcHandler:say("Did you bring me the package?", cid)
                npcHandler.topic[cid] = 6
            end
        elseif(os.date("%A") == "Wednesday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission02) == 5 and player:getStorageValue(Storage.TravellingTrader.Mission03) < 1 ) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 7
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission03) == 2) then
                npcHandler:say("Have you brought the cheese?", cid)
                npcHandler.topic[cid] = 9
            end
        elseif(os.date("%A") == "Thursday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission03) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission04) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 10
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission04) == 2) then
                npcHandler:say("Have you brought the vase?", cid)
                npcHandler.topic[cid] = 12
            end
        elseif(os.date("%A") == "Friday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission04) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission05) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 13
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission05) == 2) then
                npcHandler:say("Have you brought a cheap but good crimson sword?", cid)
                npcHandler.topic[cid] = 15
            end
        elseif(os.date("%A") == "Saturday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission05) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission06) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 16
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission06) == 1) then
                npcHandler:say("Have you brought me a gold fish??", cid)
                npcHandler.topic[cid] = 18
            end
        elseif(os.date("%A") == "Sunday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission06) == 2 and player:getStorageValue(Storage.TravellingTrader.Mission07) ~= 1) then
                npcHandler:say("Ah, right. <ahem> I hereby declare you - one of my recognised traders! Feel free to offer me your wares!", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission07, 1)
                player:addAchievement('Recognised Trader')
                npcHandler.topic[cid] = 0
            end
        end
    elseif(msgcontains(msg, "yes")) then
        if(npcHandler.topic[cid] == 1) then
            npcHandler:say({
                "Very good! I need talented people who are able to handle my wares with care, find good offers and the like, so I'm going to test you. ...",
                "First, I'd like to see if you can dig up rare wares. Something like a ... mastermind shield! ...",
                "Haha, just kidding, fooled you there, didn't I? Always control your nerves, that's quite important during bargaining. ...",
                "Okay, all I want from you is one of these rare deer trophies. I have a customer here in Svargrond who ordered one, so I'd like you to deliver it tome while I'm in Svargrond. ...",
                "Everything clear and understood?"
            }, cid)

            npcHandler.topic[cid] = 2
        elseif(npcHandler.topic[cid] == 2) then
            npcHandler:say("Fine. Then get a hold of that deer trophy and bring it to me while I'm in Svargrond. Just ask me about your mission.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission01, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 3) then
            if player:removeItem(7397, 1) then
                npcHandler:say("Well done! I'll take that from you. <snags it> Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission01, 2)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 4) then
            npcHandler:say({
                "Alright, that's good to hear. From you as my trader and deliveryman, I expect more than finding rare items. ...",
                "You also need to be able to transport heavy wares, weaklings won't get far here. I have ordered a special package from Edron. ...",
                "Pick it up from Willard and bring it back to me while I'm in Liberty Bay. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 5
        elseif(npcHandler.topic[cid] == 5) then
            npcHandler:say("Fine. Then off you go, just ask Willard about the 'package for Rashid'.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission02, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 6) then
            if player:removeItem(7503, 1) then
                npcHandler:say("Great. Just place it over there - yes, thanks, that's it. Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission02, 5)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 7) then
            npcHandler:say({
                "Well, that's good to hear. From you as my trader and deliveryman, I expect more than carrying heavy packages. ...",
                "You also need to be fast and deliver wares in time. I have ordered a very special cheese wheel made from Darashian milk. ...",
                "Unfortunately, the high temperature in the desert makes it rot really fast, so it must not stay in the sun for too long. ...",
                "I'm also afraid that you might not be able to use ships because of the smell of the cheese. ...",
                "Please get the cheese from Miraia and bring it to me while I'm in Port Hope. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 8
        elseif(npcHandler.topic[cid] == ? then
            npcHandler:say("Okay, then please find Miraia in Darashia and ask her about the {'scarab cheese'}.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission03, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 9) then
            if player:removeItem(8112, 1) then
                npcHandler:say("Mmmhh, the lovely odeur of scarab cheese! I really can't understand why most people can't stand it. Thanks, well done! ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission03, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 10) then
            npcHandler:say({
                "Well, that's good to hear. From you as my trader and deliveryman, I expect more than bringing stinky cheese. ...",
                "I wonder if you are able to deliver goods so fragile they almost break when looked at. ...",
                "I have ordered a special elven vase from Briasol in Ab'Dendriel. Get it from him and don't even touch it, just bring it to me while I'm in Ankrahmun. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 11
        elseif(npcHandler.topic[cid] == 11) then
            npcHandler:say("Okay, then please find {Briasol} in {Ab'Dendriel} and ask for a {'fine vase'}.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission04, 1)
            player:addMoney(1000)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 12) then
            if player:removeItem(7582, 1) then
                npcHandler:say("I'm surprised that you managed to bring this vase without a single crack. That was what I needed to know, thank you. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission04, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 13) then
            npcHandler:say({
                "Fine! There's one more skill that I need to test and which is cruicial for a successful trader. ...",
                "Of course you must be able to haggle, else you won't survive long in this business. To make things as hard as possible for you, I have the perfect trade partner for you. ...",
                "Dwarves are said to be the most stubborn of all traders. Travel to {Kazordoon} and try to get the smith {Uzgod} to sell a {crimson sword} to you. ...",
                "Of course, it has to be cheap. Don't come back with anything more expensive than 400 gold. ...",
                "And the quality must not suffer, of course! Everything clear and understood?",
                "Dwarves are said to be the most stubborn of all traders. Travel to Kazordoon and try to get the smith Uzgod to sell a crimson sword to you. ..."
            }, cid)
            npcHandler.topic[cid] = 14
        elseif(npcHandler.topic[cid] == 14) then
            npcHandler:say("Okay, I'm curious how you will do with {Uzgod}. Good luck!", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission05, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 15) then
            if player:removeItem(7385, 1) then
                npcHandler:say("Ha! You are clever indeed, well done! I'll take this from you. Come see me tomorrow, I think we two might get into business after all.", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission05, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 16) then
            npcHandler:say({
                "My friend, it seems you have already learnt a lot about the art of trading. I think you are more than worthy to become a recognised trader. ...",
                "There is just one little favour that I would ask from you... something personal, actually, forgive my boldness. ...",
                "I have always dreamed to have a small pet, one that I could take with me and which wouldn't cause problems. ...",
                "Could you - just maybe - bring me a small goldfish in a bowl? I know that you would be able to get one, wouldn't you?"
            }, cid)
            npcHandler.topic[cid] = 17
        elseif(npcHandler.topic[cid] == 17) then
            npcHandler:say("Thanks so much! I'll be waiting eagerly for your return then.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission06, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 18) then
            if player:removeItem(5929, 1) then
                npcHandler:say("Thank you!! Ah, this makes my day! I'll take the rest of the day off to get to know this little guy. Come see me tomorrow, if you like.", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission06, 2)
                npcHandler.topic[cid] = 0
            end
        end
    end
    return true
end

keywordHandler:addKeyword({"job"}, StdModule.say, {npcHandler = npcHandler, text = "I am a travelling trader. I don't buy everything, though. And not from everyone, for that matter."})
keywordHandler:addKeyword({"name"}, StdModule.say, {npcHandler = npcHandler, text = "I am Rashid, son of the desert."})
keywordHandler:addKeyword({"offers"}, StdModule.say, {npcHandler = npcHandler, text = "Of course, old friend. You can also browse only armor, legs, shields, helmets, boots, weapons, enchanted weapons, jewelry or miscellaneous stuff."})
keywordHandler:addKeyword({"ab'dendriel"}, StdModule.say, {npcHandler = npcHandler, text = "Elves... I don't really trust them. All this talk about nature and flowers and treehugging... I'm sure there's some wicked scheme behind all this."})
keywordHandler:addKeyword({"desert"}, StdModule.say, {npcHandler = npcHandler, text = "My beloved hometown! Ah, the sweet scent of the desert sands, the perfect shape of the pyramids... stunningly beautiful."})
keywordHandler:addKeyword({"carlin"}, StdModule.say, {npcHandler = npcHandler, text = "I have to go to Carlin once in a while, since the queen wishes to see my exclusive wares in regular intervals."})
keywordHandler:addKeyword({"cormaya"}, StdModule.say, {npcHandler = npcHandler, text = "Cormaya? Not a good place to make business, it's way too far and small."})
keywordHandler:addKeyword({"darashia"}, StdModule.say, {npcHandler = npcHandler, text = "It's not the real thing, but almost as good. The merchants there claim ridiculous prices, which is fine for my own business."})
keywordHandler:addKeyword({"edron"}, StdModule.say, {npcHandler = npcHandler, text = "Ah yes, Edron! Such a lovely and quiet island! I usually make some nice business there."})
keywordHandler:addKeyword({"fibula"}, StdModule.say, {npcHandler = npcHandler, text = "Too few customers there, it's not worth the trip."})
keywordHandler:addKeyword({"greenshore"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"kazordoon"}, StdModule.say, {npcHandler = npcHandler, text = "I don't like being underground much. I also tend to get lost in these labyrinthine dwarven tunnels, so I rather avoid them."})
keywordHandler:addKeyword({"liberty bay"}, StdModule.say, {npcHandler = npcHandler, text = "When you avoid the slums, it's a really pretty city. Almost as pretty as the governor's daughter."})
keywordHandler:addKeyword({"northport"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"port hope"}, StdModule.say, {npcHandler = npcHandler, text = "I like the settlement itself, but I don't set my foot into the jungle. Have you seen the size of these centipedes??"})
keywordHandler:addKeyword({"senja"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"svargrond"}, StdModule.say, {npcHandler = npcHandler, text = "I wish it was a little bit warmer there, but with a good mug of barbarian mead in your tummy everything gets a lot cosier."})
keywordHandler:addKeyword({"thais"}, StdModule.say, {npcHandler = npcHandler, text = "I feel uncomfortable and rather unsafe in Thais, so I don't really travel there."})
keywordHandler:addKeyword({"vega"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"venore"}, StdModule.say, {npcHandler = npcHandler, text = "Although it's the flourishing trade centre of Tibia, I don't like going there. Too much competition for my taste."})
keywordHandler:addKeyword({"time"}, StdModule.say, {npcHandler = npcHandler, text = "It's almost time to journey on."})
keywordHandler:addKeyword({"king"}, StdModule.say, {npcHandler = npcHandler, text = "Kings, queens, emperors and kaliphs... everyone claims to be different and unique, but actually it's the same thing everywhere."})

npcHandler:setMessage(MESSAGE_GREET, "Ah, a customer! Be greeted, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell, |PLAYERNAME|, may the winds guide your way.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Come back soon!")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Take all the time you need to decide what you want!")

local function onTradeRequest(cid)
    return true
end

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

 

Link para o post
Compartilhar em outros sites
Em 20/06/2020 em 21:50, luanluciano93 disse:

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 function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local player = Player(cid)
    if(msgcontains(msg, "mission")) then
        if(os.date("%A") == "Monday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission01) < 1) then
                npcHandler:say("Well, you could attempt the mission to become a recognised trader, but it requires a lot of travelling. Are you willing to try?", cid)
                npcHandler.topic[cid] = 1
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission01) == 1) then
                npcHandler:say("Have you managed to obtain a rare deer trophy for my customer?", cid)
                npcHandler.topic[cid] = 3
            end
        elseif(os.date("%A") == "Tuesday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission01) == 2 and player:getStorageValue(Storage.TravellingTrader.Mission02) < 1 ) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 4
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission02) == 4) then
                npcHandler:say("Did you bring me the package?", cid)
                npcHandler.topic[cid] = 6
            end
        elseif(os.date("%A") == "Wednesday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission02) == 5 and player:getStorageValue(Storage.TravellingTrader.Mission03) < 1 ) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 7
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission03) == 2) then
                npcHandler:say("Have you brought the cheese?", cid)
                npcHandler.topic[cid] = 9
            end
        elseif(os.date("%A") == "Thursday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission03) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission04) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 10
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission04) == 2) then
                npcHandler:say("Have you brought the vase?", cid)
                npcHandler.topic[cid] = 12
            end
        elseif(os.date("%A") == "Friday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission04) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission05) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 13
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission05) == 2) then
                npcHandler:say("Have you brought a cheap but good crimson sword?", cid)
                npcHandler.topic[cid] = 15
            end
        elseif(os.date("%A") == "Saturday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission05) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission06) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 16
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission06) == 1) then
                npcHandler:say("Have you brought me a gold fish??", cid)
                npcHandler.topic[cid] = 18
            end
        elseif(os.date("%A") == "Sunday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission06) == 2 and player:getStorageValue(Storage.TravellingTrader.Mission07) ~= 1) then
                npcHandler:say("Ah, right. <ahem> I hereby declare you - one of my recognised traders! Feel free to offer me your wares!", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission07, 1)
                player:addAchievement('Recognised Trader')
                npcHandler.topic[cid] = 0
            end
        end
    elseif(msgcontains(msg, "yes")) then
        if(npcHandler.topic[cid] == 1) then
            npcHandler:say({
                "Very good! I need talented people who are able to handle my wares with care, find good offers and the like, so I'm going to test you. ...",
                "First, I'd like to see if you can dig up rare wares. Something like a ... mastermind shield! ...",
                "Haha, just kidding, fooled you there, didn't I? Always control your nerves, that's quite important during bargaining. ...",
                "Okay, all I want from you is one of these rare deer trophies. I have a customer here in Svargrond who ordered one, so I'd like you to deliver it tome while I'm in Svargrond. ...",
                "Everything clear and understood?"
            }, cid)

            npcHandler.topic[cid] = 2
        elseif(npcHandler.topic[cid] == 2) then
            npcHandler:say("Fine. Then get a hold of that deer trophy and bring it to me while I'm in Svargrond. Just ask me about your mission.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission01, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 3) then
            if player:removeItem(7397, 1) then
                npcHandler:say("Well done! I'll take that from you. <snags it> Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission01, 2)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 4) then
            npcHandler:say({
                "Alright, that's good to hear. From you as my trader and deliveryman, I expect more than finding rare items. ...",
                "You also need to be able to transport heavy wares, weaklings won't get far here. I have ordered a special package from Edron. ...",
                "Pick it up from Willard and bring it back to me while I'm in Liberty Bay. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 5
        elseif(npcHandler.topic[cid] == 5) then
            npcHandler:say("Fine. Then off you go, just ask Willard about the 'package for Rashid'.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission02, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 6) then
            if player:removeItem(7503, 1) then
                npcHandler:say("Great. Just place it over there - yes, thanks, that's it. Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission02, 5)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 7) then
            npcHandler:say({
                "Well, that's good to hear. From you as my trader and deliveryman, I expect more than carrying heavy packages. ...",
                "You also need to be fast and deliver wares in time. I have ordered a very special cheese wheel made from Darashian milk. ...",
                "Unfortunately, the high temperature in the desert makes it rot really fast, so it must not stay in the sun for too long. ...",
                "I'm also afraid that you might not be able to use ships because of the smell of the cheese. ...",
                "Please get the cheese from Miraia and bring it to me while I'm in Port Hope. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 8
        elseif(npcHandler.topic[cid] == ? then
            npcHandler:say("Okay, then please find Miraia in Darashia and ask her about the {'scarab cheese'}.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission03, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 9) then
            if player:removeItem(8112, 1) then
                npcHandler:say("Mmmhh, the lovely odeur of scarab cheese! I really can't understand why most people can't stand it. Thanks, well done! ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission03, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 10) then
            npcHandler:say({
                "Well, that's good to hear. From you as my trader and deliveryman, I expect more than bringing stinky cheese. ...",
                "I wonder if you are able to deliver goods so fragile they almost break when looked at. ...",
                "I have ordered a special elven vase from Briasol in Ab'Dendriel. Get it from him and don't even touch it, just bring it to me while I'm in Ankrahmun. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 11
        elseif(npcHandler.topic[cid] == 11) then
            npcHandler:say("Okay, then please find {Briasol} in {Ab'Dendriel} and ask for a {'fine vase'}.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission04, 1)
            player:addMoney(1000)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 12) then
            if player:removeItem(7582, 1) then
                npcHandler:say("I'm surprised that you managed to bring this vase without a single crack. That was what I needed to know, thank you. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission04, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 13) then
            npcHandler:say({
                "Fine! There's one more skill that I need to test and which is cruicial for a successful trader. ...",
                "Of course you must be able to haggle, else you won't survive long in this business. To make things as hard as possible for you, I have the perfect trade partner for you. ...",
                "Dwarves are said to be the most stubborn of all traders. Travel to {Kazordoon} and try to get the smith {Uzgod} to sell a {crimson sword} to you. ...",
                "Of course, it has to be cheap. Don't come back with anything more expensive than 400 gold. ...",
                "And the quality must not suffer, of course! Everything clear and understood?",
                "Dwarves are said to be the most stubborn of all traders. Travel to Kazordoon and try to get the smith Uzgod to sell a crimson sword to you. ..."
            }, cid)
            npcHandler.topic[cid] = 14
        elseif(npcHandler.topic[cid] == 14) then
            npcHandler:say("Okay, I'm curious how you will do with {Uzgod}. Good luck!", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission05, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 15) then
            if player:removeItem(7385, 1) then
                npcHandler:say("Ha! You are clever indeed, well done! I'll take this from you. Come see me tomorrow, I think we two might get into business after all.", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission05, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 16) then
            npcHandler:say({
                "My friend, it seems you have already learnt a lot about the art of trading. I think you are more than worthy to become a recognised trader. ...",
                "There is just one little favour that I would ask from you... something personal, actually, forgive my boldness. ...",
                "I have always dreamed to have a small pet, one that I could take with me and which wouldn't cause problems. ...",
                "Could you - just maybe - bring me a small goldfish in a bowl? I know that you would be able to get one, wouldn't you?"
            }, cid)
            npcHandler.topic[cid] = 17
        elseif(npcHandler.topic[cid] == 17) then
            npcHandler:say("Thanks so much! I'll be waiting eagerly for your return then.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission06, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 18) then
            if player:removeItem(5929, 1) then
                npcHandler:say("Thank you!! Ah, this makes my day! I'll take the rest of the day off to get to know this little guy. Come see me tomorrow, if you like.", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission06, 2)
                npcHandler.topic[cid] = 0
            end
        end
    end
    return true
end

keywordHandler:addKeyword({"job"}, StdModule.say, {npcHandler = npcHandler, text = "I am a travelling trader. I don't buy everything, though. And not from everyone, for that matter."})
keywordHandler:addKeyword({"name"}, StdModule.say, {npcHandler = npcHandler, text = "I am Rashid, son of the desert."})
keywordHandler:addKeyword({"offers"}, StdModule.say, {npcHandler = npcHandler, text = "Of course, old friend. You can also browse only armor, legs, shields, helmets, boots, weapons, enchanted weapons, jewelry or miscellaneous stuff."})
keywordHandler:addKeyword({"ab'dendriel"}, StdModule.say, {npcHandler = npcHandler, text = "Elves... I don't really trust them. All this talk about nature and flowers and treehugging... I'm sure there's some wicked scheme behind all this."})
keywordHandler:addKeyword({"desert"}, StdModule.say, {npcHandler = npcHandler, text = "My beloved hometown! Ah, the sweet scent of the desert sands, the perfect shape of the pyramids... stunningly beautiful."})
keywordHandler:addKeyword({"carlin"}, StdModule.say, {npcHandler = npcHandler, text = "I have to go to Carlin once in a while, since the queen wishes to see my exclusive wares in regular intervals."})
keywordHandler:addKeyword({"cormaya"}, StdModule.say, {npcHandler = npcHandler, text = "Cormaya? Not a good place to make business, it's way too far and small."})
keywordHandler:addKeyword({"darashia"}, StdModule.say, {npcHandler = npcHandler, text = "It's not the real thing, but almost as good. The merchants there claim ridiculous prices, which is fine for my own business."})
keywordHandler:addKeyword({"edron"}, StdModule.say, {npcHandler = npcHandler, text = "Ah yes, Edron! Such a lovely and quiet island! I usually make some nice business there."})
keywordHandler:addKeyword({"fibula"}, StdModule.say, {npcHandler = npcHandler, text = "Too few customers there, it's not worth the trip."})
keywordHandler:addKeyword({"greenshore"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"kazordoon"}, StdModule.say, {npcHandler = npcHandler, text = "I don't like being underground much. I also tend to get lost in these labyrinthine dwarven tunnels, so I rather avoid them."})
keywordHandler:addKeyword({"liberty bay"}, StdModule.say, {npcHandler = npcHandler, text = "When you avoid the slums, it's a really pretty city. Almost as pretty as the governor's daughter."})
keywordHandler:addKeyword({"northport"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"port hope"}, StdModule.say, {npcHandler = npcHandler, text = "I like the settlement itself, but I don't set my foot into the jungle. Have you seen the size of these centipedes??"})
keywordHandler:addKeyword({"senja"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"svargrond"}, StdModule.say, {npcHandler = npcHandler, text = "I wish it was a little bit warmer there, but with a good mug of barbarian mead in your tummy everything gets a lot cosier."})
keywordHandler:addKeyword({"thais"}, StdModule.say, {npcHandler = npcHandler, text = "I feel uncomfortable and rather unsafe in Thais, so I don't really travel there."})
keywordHandler:addKeyword({"vega"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"venore"}, StdModule.say, {npcHandler = npcHandler, text = "Although it's the flourishing trade centre of Tibia, I don't like going there. Too much competition for my taste."})
keywordHandler:addKeyword({"time"}, StdModule.say, {npcHandler = npcHandler, text = "It's almost time to journey on."})
keywordHandler:addKeyword({"king"}, StdModule.say, {npcHandler = npcHandler, text = "Kings, queens, emperors and kaliphs... everyone claims to be different and unique, but actually it's the same thing everywhere."})

npcHandler:setMessage(MESSAGE_GREET, "Ah, a customer! Be greeted, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell, |PLAYERNAME|, may the winds guide your way.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Come back soon!")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Take all the time you need to decide what you want!")

local function onTradeRequest(cid)
    return true
end

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

 

Brother obrigado pelo código, mas dessa vez o NPC some do mapa.

Link para o post
Compartilhar em outros sites
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 function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local player = Player(cid)
    if(msgcontains(msg, "mission")) then
        if(os.date("%A") == "Monday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission01) < 1) then
                npcHandler:say("Well, you could attempt the mission to become a recognised trader, but it requires a lot of travelling. Are you willing to try?", cid)
                npcHandler.topic[cid] = 1
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission01) == 1) then
                npcHandler:say("Have you managed to obtain a rare deer trophy for my customer?", cid)
                npcHandler.topic[cid] = 3
            end
        elseif(os.date("%A") == "Tuesday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission01) == 2 and player:getStorageValue(Storage.TravellingTrader.Mission02) < 1 ) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 4
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission02) == 4) then
                npcHandler:say("Did you bring me the package?", cid)
                npcHandler.topic[cid] = 6
            end
        elseif(os.date("%A") == "Wednesday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission02) == 5 and player:getStorageValue(Storage.TravellingTrader.Mission03) < 1 ) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 7
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission03) == 2) then
                npcHandler:say("Have you brought the cheese?", cid)
                npcHandler.topic[cid] = 9
            end
        elseif(os.date("%A") == "Thursday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission03) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission04) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 10
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission04) == 2) then
                npcHandler:say("Have you brought the vase?", cid)
                npcHandler.topic[cid] = 12
            end
        elseif(os.date("%A") == "Friday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission04) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission05) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 13
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission05) == 2) then
                npcHandler:say("Have you brought a cheap but good crimson sword?", cid)
                npcHandler.topic[cid] = 15
            end
        elseif(os.date("%A") == "Saturday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission05) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission06) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 16
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission06) == 1) then
                npcHandler:say("Have you brought me a gold fish??", cid)
                npcHandler.topic[cid] = 18
            end
        elseif(os.date("%A") == "Sunday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission06) == 2 and player:getStorageValue(Storage.TravellingTrader.Mission07) ~= 1) then
                npcHandler:say("Ah, right. <ahem> I hereby declare you - one of my recognised traders! Feel free to offer me your wares!", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission07, 1)
                player:addAchievement('Recognised Trader')
                npcHandler.topic[cid] = 0
            end
        end
    elseif(msgcontains(msg, "yes")) then
        if(npcHandler.topic[cid] == 1) then
            npcHandler:say({
                "Very good! I need talented people who are able to handle my wares with care, find good offers and the like, so I'm going to test you. ...",
                "First, I'd like to see if you can dig up rare wares. Something like a ... mastermind shield! ...",
                "Haha, just kidding, fooled you there, didn't I? Always control your nerves, that's quite important during bargaining. ...",
                "Okay, all I want from you is one of these rare deer trophies. I have a customer here in Svargrond who ordered one, so I'd like you to deliver it tome while I'm in Svargrond. ...",
                "Everything clear and understood?"
            }, cid)

            npcHandler.topic[cid] = 2
        elseif(npcHandler.topic[cid] == 2) then
            npcHandler:say("Fine. Then get a hold of that deer trophy and bring it to me while I'm in Svargrond. Just ask me about your mission.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission01, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 3) then
            if player:removeItem(7397, 1) then
                npcHandler:say("Well done! I'll take that from you. <snags it> Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission01, 2)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 4) then
            npcHandler:say({
                "Alright, that's good to hear. From you as my trader and deliveryman, I expect more than finding rare items. ...",
                "You also need to be able to transport heavy wares, weaklings won't get far here. I have ordered a special package from Edron. ...",
                "Pick it up from Willard and bring it back to me while I'm in Liberty Bay. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 5
        elseif(npcHandler.topic[cid] == 5) then
            npcHandler:say("Fine. Then off you go, just ask Willard about the 'package for Rashid'.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission02, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 6) then
            if player:removeItem(7503, 1) then
                npcHandler:say("Great. Just place it over there - yes, thanks, that's it. Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission02, 5)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 7) then
            npcHandler:say({
                "Well, that's good to hear. From you as my trader and deliveryman, I expect more than carrying heavy packages. ...",
                "You also need to be fast and deliver wares in time. I have ordered a very special cheese wheel made from Darashian milk. ...",
                "Unfortunately, the high temperature in the desert makes it rot really fast, so it must not stay in the sun for too long. ...",
                "I'm also afraid that you might not be able to use ships because of the smell of the cheese. ...",
                "Please get the cheese from Miraia and bring it to me while I'm in Port Hope. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 8
        elseif(npcHandler.topic[cid] == ? then
            npcHandler:say("Okay, then please find Miraia in Darashia and ask her about the {'scarab cheese'}.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission03, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 9) then
            if player:removeItem(8112, 1) then
                npcHandler:say("Mmmhh, the lovely odeur of scarab cheese! I really can't understand why most people can't stand it. Thanks, well done! ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission03, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 10) then
            npcHandler:say({
                "Well, that's good to hear. From you as my trader and deliveryman, I expect more than bringing stinky cheese. ...",
                "I wonder if you are able to deliver goods so fragile they almost break when looked at. ...",
                "I have ordered a special elven vase from Briasol in Ab'Dendriel. Get it from him and don't even touch it, just bring it to me while I'm in Ankrahmun. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 11
        elseif(npcHandler.topic[cid] == 11) then
            npcHandler:say("Okay, then please find {Briasol} in {Ab'Dendriel} and ask for a {'fine vase'}.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission04, 1)
            player:addMoney(1000)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 12) then
            if player:removeItem(7582, 1) then
                npcHandler:say("I'm surprised that you managed to bring this vase without a single crack. That was what I needed to know, thank you. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission04, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 13) then
            npcHandler:say({
                "Fine! There's one more skill that I need to test and which is cruicial for a successful trader. ...",
                "Of course you must be able to haggle, else you won't survive long in this business. To make things as hard as possible for you, I have the perfect trade partner for you. ...",
                "Dwarves are said to be the most stubborn of all traders. Travel to {Kazordoon} and try to get the smith {Uzgod} to sell a {crimson sword} to you. ...",
                "Of course, it has to be cheap. Don't come back with anything more expensive than 400 gold. ...",
                "And the quality must not suffer, of course! Everything clear and understood?",
                "Dwarves are said to be the most stubborn of all traders. Travel to Kazordoon and try to get the smith Uzgod to sell a crimson sword to you. ..."
            }, cid)
            npcHandler.topic[cid] = 14
        elseif(npcHandler.topic[cid] == 14) then
            npcHandler:say("Okay, I'm curious how you will do with {Uzgod}. Good luck!", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission05, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 15) then
            if player:removeItem(7385, 1) then
                npcHandler:say("Ha! You are clever indeed, well done! I'll take this from you. Come see me tomorrow, I think we two might get into business after all.", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission05, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 16) then
            npcHandler:say({
                "My friend, it seems you have already learnt a lot about the art of trading. I think you are more than worthy to become a recognised trader. ...",
                "There is just one little favour that I would ask from you... something personal, actually, forgive my boldness. ...",
                "I have always dreamed to have a small pet, one that I could take with me and which wouldn't cause problems. ...",
                "Could you - just maybe - bring me a small goldfish in a bowl? I know that you would be able to get one, wouldn't you?"
            }, cid)
            npcHandler.topic[cid] = 17
        elseif(npcHandler.topic[cid] == 17) then
            npcHandler:say("Thanks so much! I'll be waiting eagerly for your return then.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission06, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 18) then
            if player:removeItem(5929, 1) then
                npcHandler:say("Thank you!! Ah, this makes my day! I'll take the rest of the day off to get to know this little guy. Come see me tomorrow, if you like.", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission06, 2)
                npcHandler.topic[cid] = 0
            end
        end
    end
    return true
end

keywordHandler:addKeyword({"job"}, StdModule.say, {npcHandler = npcHandler, text = "I am a travelling trader. I don't buy everything, though. And not from everyone, for that matter."})
keywordHandler:addKeyword({"name"}, StdModule.say, {npcHandler = npcHandler, text = "I am Rashid, son of the desert."})
keywordHandler:addKeyword({"offers"}, StdModule.say, {npcHandler = npcHandler, text = "Of course, old friend. You can also browse only armor, legs, shields, helmets, boots, weapons, enchanted weapons, jewelry or miscellaneous stuff."})
keywordHandler:addKeyword({"ab'dendriel"}, StdModule.say, {npcHandler = npcHandler, text = "Elves... I don't really trust them. All this talk about nature and flowers and treehugging... I'm sure there's some wicked scheme behind all this."})
keywordHandler:addKeyword({"desert"}, StdModule.say, {npcHandler = npcHandler, text = "My beloved hometown! Ah, the sweet scent of the desert sands, the perfect shape of the pyramids... stunningly beautiful."})
keywordHandler:addKeyword({"carlin"}, StdModule.say, {npcHandler = npcHandler, text = "I have to go to Carlin once in a while, since the queen wishes to see my exclusive wares in regular intervals."})
keywordHandler:addKeyword({"cormaya"}, StdModule.say, {npcHandler = npcHandler, text = "Cormaya? Not a good place to make business, it's way too far and small."})
keywordHandler:addKeyword({"darashia"}, StdModule.say, {npcHandler = npcHandler, text = "It's not the real thing, but almost as good. The merchants there claim ridiculous prices, which is fine for my own business."})
keywordHandler:addKeyword({"edron"}, StdModule.say, {npcHandler = npcHandler, text = "Ah yes, Edron! Such a lovely and quiet island! I usually make some nice business there."})
keywordHandler:addKeyword({"fibula"}, StdModule.say, {npcHandler = npcHandler, text = "Too few customers there, it's not worth the trip."})
keywordHandler:addKeyword({"greenshore"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"kazordoon"}, StdModule.say, {npcHandler = npcHandler, text = "I don't like being underground much. I also tend to get lost in these labyrinthine dwarven tunnels, so I rather avoid them."})
keywordHandler:addKeyword({"liberty bay"}, StdModule.say, {npcHandler = npcHandler, text = "When you avoid the slums, it's a really pretty city. Almost as pretty as the governor's daughter."})
keywordHandler:addKeyword({"northport"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"port hope"}, StdModule.say, {npcHandler = npcHandler, text = "I like the settlement itself, but I don't set my foot into the jungle. Have you seen the size of these centipedes??"})
keywordHandler:addKeyword({"senja"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"svargrond"}, StdModule.say, {npcHandler = npcHandler, text = "I wish it was a little bit warmer there, but with a good mug of barbarian mead in your tummy everything gets a lot cosier."})
keywordHandler:addKeyword({"thais"}, StdModule.say, {npcHandler = npcHandler, text = "I feel uncomfortable and rather unsafe in Thais, so I don't really travel there."})
keywordHandler:addKeyword({"vega"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"venore"}, StdModule.say, {npcHandler = npcHandler, text = "Although it's the flourishing trade centre of Tibia, I don't like going there. Too much competition for my taste."})
keywordHandler:addKeyword({"time"}, StdModule.say, {npcHandler = npcHandler, text = "It's almost time to journey on."})
keywordHandler:addKeyword({"king"}, StdModule.say, {npcHandler = npcHandler, text = "Kings, queens, emperors and kaliphs... everyone claims to be different and unique, but actually it's the same thing everywhere."})

npcHandler:setMessage(MESSAGE_GREET, "Ah, a customer! Be greeted, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell, |PLAYERNAME|, may the winds guide your way.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Come back soon!")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Take all the time you need to decide what you want!")

local function onTradeRequest(cid)
    if Player(cid):getStorageValue(Storage.TravellingTrader.Mission07) ~= 5 then
        npcHandler:say('Sorry, but you do not belong to my exclusive customers. I have to make sure that I can trust in the quality of your wares.', cid)
        return false
    end

    return true
end

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

 

Link para o post
Compartilhar em outros sites
1 hora atrás, luanluciano93 disse:

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 function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local player = Player(cid)
    if(msgcontains(msg, "mission")) then
        if(os.date("%A") == "Monday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission01) < 1) then
                npcHandler:say("Well, you could attempt the mission to become a recognised trader, but it requires a lot of travelling. Are you willing to try?", cid)
                npcHandler.topic[cid] = 1
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission01) == 1) then
                npcHandler:say("Have you managed to obtain a rare deer trophy for my customer?", cid)
                npcHandler.topic[cid] = 3
            end
        elseif(os.date("%A") == "Tuesday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission01) == 2 and player:getStorageValue(Storage.TravellingTrader.Mission02) < 1 ) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 4
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission02) == 4) then
                npcHandler:say("Did you bring me the package?", cid)
                npcHandler.topic[cid] = 6
            end
        elseif(os.date("%A") == "Wednesday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission02) == 5 and player:getStorageValue(Storage.TravellingTrader.Mission03) < 1 ) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 7
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission03) == 2) then
                npcHandler:say("Have you brought the cheese?", cid)
                npcHandler.topic[cid] = 9
            end
        elseif(os.date("%A") == "Thursday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission03) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission04) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 10
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission04) == 2) then
                npcHandler:say("Have you brought the vase?", cid)
                npcHandler.topic[cid] = 12
            end
        elseif(os.date("%A") == "Friday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission04) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission05) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 13
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission05) == 2) then
                npcHandler:say("Have you brought a cheap but good crimson sword?", cid)
                npcHandler.topic[cid] = 15
            end
        elseif(os.date("%A") == "Saturday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission05) == 3 and player:getStorageValue(Storage.TravellingTrader.Mission06) < 1) then
                npcHandler:say("So, my friend, are you willing to proceed to the next mission to become a recognised trader?", cid)
                npcHandler.topic[cid] = 16
            elseif(player:getStorageValue(Storage.TravellingTrader.Mission06) == 1) then
                npcHandler:say("Have you brought me a gold fish??", cid)
                npcHandler.topic[cid] = 18
            end
        elseif(os.date("%A") == "Sunday") then
            if(player:getStorageValue(Storage.TravellingTrader.Mission06) == 2 and player:getStorageValue(Storage.TravellingTrader.Mission07) ~= 1) then
                npcHandler:say("Ah, right. <ahem> I hereby declare you - one of my recognised traders! Feel free to offer me your wares!", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission07, 1)
                player:addAchievement('Recognised Trader')
                npcHandler.topic[cid] = 0
            end
        end
    elseif(msgcontains(msg, "yes")) then
        if(npcHandler.topic[cid] == 1) then
            npcHandler:say({
                "Very good! I need talented people who are able to handle my wares with care, find good offers and the like, so I'm going to test you. ...",
                "First, I'd like to see if you can dig up rare wares. Something like a ... mastermind shield! ...",
                "Haha, just kidding, fooled you there, didn't I? Always control your nerves, that's quite important during bargaining. ...",
                "Okay, all I want from you is one of these rare deer trophies. I have a customer here in Svargrond who ordered one, so I'd like you to deliver it tome while I'm in Svargrond. ...",
                "Everything clear and understood?"
            }, cid)

            npcHandler.topic[cid] = 2
        elseif(npcHandler.topic[cid] == 2) then
            npcHandler:say("Fine. Then get a hold of that deer trophy and bring it to me while I'm in Svargrond. Just ask me about your mission.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission01, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 3) then
            if player:removeItem(7397, 1) then
                npcHandler:say("Well done! I'll take that from you. <snags it> Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission01, 2)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 4) then
            npcHandler:say({
                "Alright, that's good to hear. From you as my trader and deliveryman, I expect more than finding rare items. ...",
                "You also need to be able to transport heavy wares, weaklings won't get far here. I have ordered a special package from Edron. ...",
                "Pick it up from Willard and bring it back to me while I'm in Liberty Bay. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 5
        elseif(npcHandler.topic[cid] == 5) then
            npcHandler:say("Fine. Then off you go, just ask Willard about the 'package for Rashid'.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission02, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 6) then
            if player:removeItem(7503, 1) then
                npcHandler:say("Great. Just place it over there - yes, thanks, that's it. Come see me another day, I'll be busy for a while now. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission02, 5)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 7) then
            npcHandler:say({
                "Well, that's good to hear. From you as my trader and deliveryman, I expect more than carrying heavy packages. ...",
                "You also need to be fast and deliver wares in time. I have ordered a very special cheese wheel made from Darashian milk. ...",
                "Unfortunately, the high temperature in the desert makes it rot really fast, so it must not stay in the sun for too long. ...",
                "I'm also afraid that you might not be able to use ships because of the smell of the cheese. ...",
                "Please get the cheese from Miraia and bring it to me while I'm in Port Hope. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 8
        elseif(npcHandler.topic[cid] == ? then
            npcHandler:say("Okay, then please find Miraia in Darashia and ask her about the {'scarab cheese'}.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission03, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 9) then
            if player:removeItem(8112, 1) then
                npcHandler:say("Mmmhh, the lovely odeur of scarab cheese! I really can't understand why most people can't stand it. Thanks, well done! ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission03, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 10) then
            npcHandler:say({
                "Well, that's good to hear. From you as my trader and deliveryman, I expect more than bringing stinky cheese. ...",
                "I wonder if you are able to deliver goods so fragile they almost break when looked at. ...",
                "I have ordered a special elven vase from Briasol in Ab'Dendriel. Get it from him and don't even touch it, just bring it to me while I'm in Ankrahmun. Everything clear and understood?"
            }, cid)
            npcHandler.topic[cid] = 11
        elseif(npcHandler.topic[cid] == 11) then
            npcHandler:say("Okay, then please find {Briasol} in {Ab'Dendriel} and ask for a {'fine vase'}.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission04, 1)
            player:addMoney(1000)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 12) then
            if player:removeItem(7582, 1) then
                npcHandler:say("I'm surprised that you managed to bring this vase without a single crack. That was what I needed to know, thank you. ", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission04, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 13) then
            npcHandler:say({
                "Fine! There's one more skill that I need to test and which is cruicial for a successful trader. ...",
                "Of course you must be able to haggle, else you won't survive long in this business. To make things as hard as possible for you, I have the perfect trade partner for you. ...",
                "Dwarves are said to be the most stubborn of all traders. Travel to {Kazordoon} and try to get the smith {Uzgod} to sell a {crimson sword} to you. ...",
                "Of course, it has to be cheap. Don't come back with anything more expensive than 400 gold. ...",
                "And the quality must not suffer, of course! Everything clear and understood?",
                "Dwarves are said to be the most stubborn of all traders. Travel to Kazordoon and try to get the smith Uzgod to sell a crimson sword to you. ..."
            }, cid)
            npcHandler.topic[cid] = 14
        elseif(npcHandler.topic[cid] == 14) then
            npcHandler:say("Okay, I'm curious how you will do with {Uzgod}. Good luck!", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission05, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 15) then
            if player:removeItem(7385, 1) then
                npcHandler:say("Ha! You are clever indeed, well done! I'll take this from you. Come see me tomorrow, I think we two might get into business after all.", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission05, 3)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 16) then
            npcHandler:say({
                "My friend, it seems you have already learnt a lot about the art of trading. I think you are more than worthy to become a recognised trader. ...",
                "There is just one little favour that I would ask from you... something personal, actually, forgive my boldness. ...",
                "I have always dreamed to have a small pet, one that I could take with me and which wouldn't cause problems. ...",
                "Could you - just maybe - bring me a small goldfish in a bowl? I know that you would be able to get one, wouldn't you?"
            }, cid)
            npcHandler.topic[cid] = 17
        elseif(npcHandler.topic[cid] == 17) then
            npcHandler:say("Thanks so much! I'll be waiting eagerly for your return then.", cid)
            player:setStorageValue(Storage.TravellingTrader.Mission06, 1)
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 18) then
            if player:removeItem(5929, 1) then
                npcHandler:say("Thank you!! Ah, this makes my day! I'll take the rest of the day off to get to know this little guy. Come see me tomorrow, if you like.", cid)
                player:setStorageValue(Storage.TravellingTrader.Mission06, 2)
                npcHandler.topic[cid] = 0
            end
        end
    end
    return true
end

keywordHandler:addKeyword({"job"}, StdModule.say, {npcHandler = npcHandler, text = "I am a travelling trader. I don't buy everything, though. And not from everyone, for that matter."})
keywordHandler:addKeyword({"name"}, StdModule.say, {npcHandler = npcHandler, text = "I am Rashid, son of the desert."})
keywordHandler:addKeyword({"offers"}, StdModule.say, {npcHandler = npcHandler, text = "Of course, old friend. You can also browse only armor, legs, shields, helmets, boots, weapons, enchanted weapons, jewelry or miscellaneous stuff."})
keywordHandler:addKeyword({"ab'dendriel"}, StdModule.say, {npcHandler = npcHandler, text = "Elves... I don't really trust them. All this talk about nature and flowers and treehugging... I'm sure there's some wicked scheme behind all this."})
keywordHandler:addKeyword({"desert"}, StdModule.say, {npcHandler = npcHandler, text = "My beloved hometown! Ah, the sweet scent of the desert sands, the perfect shape of the pyramids... stunningly beautiful."})
keywordHandler:addKeyword({"carlin"}, StdModule.say, {npcHandler = npcHandler, text = "I have to go to Carlin once in a while, since the queen wishes to see my exclusive wares in regular intervals."})
keywordHandler:addKeyword({"cormaya"}, StdModule.say, {npcHandler = npcHandler, text = "Cormaya? Not a good place to make business, it's way too far and small."})
keywordHandler:addKeyword({"darashia"}, StdModule.say, {npcHandler = npcHandler, text = "It's not the real thing, but almost as good. The merchants there claim ridiculous prices, which is fine for my own business."})
keywordHandler:addKeyword({"edron"}, StdModule.say, {npcHandler = npcHandler, text = "Ah yes, Edron! Such a lovely and quiet island! I usually make some nice business there."})
keywordHandler:addKeyword({"fibula"}, StdModule.say, {npcHandler = npcHandler, text = "Too few customers there, it's not worth the trip."})
keywordHandler:addKeyword({"greenshore"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"kazordoon"}, StdModule.say, {npcHandler = npcHandler, text = "I don't like being underground much. I also tend to get lost in these labyrinthine dwarven tunnels, so I rather avoid them."})
keywordHandler:addKeyword({"liberty bay"}, StdModule.say, {npcHandler = npcHandler, text = "When you avoid the slums, it's a really pretty city. Almost as pretty as the governor's daughter."})
keywordHandler:addKeyword({"northport"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"port hope"}, StdModule.say, {npcHandler = npcHandler, text = "I like the settlement itself, but I don't set my foot into the jungle. Have you seen the size of these centipedes??"})
keywordHandler:addKeyword({"senja"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"svargrond"}, StdModule.say, {npcHandler = npcHandler, text = "I wish it was a little bit warmer there, but with a good mug of barbarian mead in your tummy everything gets a lot cosier."})
keywordHandler:addKeyword({"thais"}, StdModule.say, {npcHandler = npcHandler, text = "I feel uncomfortable and rather unsafe in Thais, so I don't really travel there."})
keywordHandler:addKeyword({"vega"}, StdModule.say, {npcHandler = npcHandler, text = "Um... I don't think so."})
keywordHandler:addKeyword({"venore"}, StdModule.say, {npcHandler = npcHandler, text = "Although it's the flourishing trade centre of Tibia, I don't like going there. Too much competition for my taste."})
keywordHandler:addKeyword({"time"}, StdModule.say, {npcHandler = npcHandler, text = "It's almost time to journey on."})
keywordHandler:addKeyword({"king"}, StdModule.say, {npcHandler = npcHandler, text = "Kings, queens, emperors and kaliphs... everyone claims to be different and unique, but actually it's the same thing everywhere."})

npcHandler:setMessage(MESSAGE_GREET, "Ah, a customer! Be greeted, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell, |PLAYERNAME|, may the winds guide your way.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Come back soon!")
npcHandler:setMessage(MESSAGE_SENDTRADE, "Take all the time you need to decide what you want!")

local function onTradeRequest(cid)
    if Player(cid):getStorageValue(Storage.TravellingTrader.Mission07) ~= 5 then
        npcHandler:say('Sorry, but you do not belong to my exclusive customers. I have to make sure that I can trust in the quality of your wares.', cid)
        return false
    end

    return true
end

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

 

Brother ele continua desaparecido do mapa.

Vi que esse npc tem 3 arquivos,

1 com os itens que ele comercializa.

2 esse código que te mandei ai em cima

3 com o código abaixo

 

function onStartup()

   --RASHID
   local days =
   {
      [1] = {x = 32328, y = 31782, z = 6}, --Sunday // Domingo
      [2] = {x = 32207, y = 31155, z = 7}, --Monday // Lunes
      [3] = {x = 32300, y = 32837, z = 7}, --Tuesday // Martes
      [4] = {x = 32577, y = 32753, z = 7}, --Wednesday // Miercoles
      [5] = {x = 33066, y = 32879, z = 6}, --Thursday // Jueves
      [6] = {x = 33235, y = 32483, z = 7}, --Friday // Viernes
      [7] = {x = 33166, y = 31810, z = 6} --Saturday // Sabado
   }

   local day = os.date("*t").wday
   if days[day] then
      doCreateNpc("Rashid", days[day])
   else
      print("[!] -> Cannot create Rashid. Day: " .. day .. ".")
   end
   return true
end
 

Link para o post
Compartilhar em outros sites

Isso que você mandou não interfere nele e não tem lógico ele sumir apena pelo que eu mudei, você deve ter feito algo errado. Aparece algum erro na inicialização do servidor?

Link para o post
Compartilhar em outros sites
6 horas atrás, luanluciano93 disse:

Isso que você mandou não interfere nele e não tem lógico ele sumir apena pelo que eu mudei, você deve ter feito algo errado. Aparece algum erro na inicialização do servidor?

So copiei o código que você mandou e colei, funcionou com os djins, somente o rashid que da esse erro.

[Warning - NpcScript::NpcScript] Can not load script: Rashid.lua
data/npc/scripts/Rashid.lua:119: ')' expected near 'then'

Link para o post
Compartilhar em outros sites
20 horas atrás, Leonardo Oppai disse:

So copiei o código que você mandou e colei, funcionou com os djins, somente o rashid que da esse erro.

[Warning - NpcScript::NpcScript] Can not load script: Rashid.lua
data/npc/scripts/Rashid.lua:119: ')' expected near 'then'

Na linha 119, como você não postou em código, apareceu um emotion, por isso esta dando erro. Olha o anterior e tentar ver o que tinha no lugar.

Link para o post
Compartilhar em outros sites
Em 25/06/2020 em 19:54, luanluciano93 disse:

Na linha 119, como você não postou em código, apareceu um emotion, por isso esta dando erro. Olha o anterior e tentar ver o que tinha no lugar.

Não sei pq foi em emoticon mas a linha 119 está assim.

elseif(npcHandler.topic[cid] == 8 ) then.

 

Editado por Leonardo Oppai (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por cloudrun2023
      CloudRun - Sua Melhor Escolha para Hospedagem de OTServer!
      Você está procurando a solução definitiva para hospedar seu OTServer com desempenho imbatível e segurança inigualável? Não procure mais! Apresentamos a CloudRun, sua parceira confiável em serviços de hospedagem na nuvem.
       
      Recursos Exclusivos - Proteção DDoS Avançada:
      Mantenha seu OTServer online e seguro com nossa robusta proteção DDoS, garantindo uma experiência de jogo ininterrupta para seus jogadores.
       
      Servidores Ryzen 7 Poderosos: Desfrute do poder de processamento superior dos servidores Ryzen 7 para garantir um desempenho excepcional do seu OTServer. Velocidade e estabilidade garantidas!
       
      Armazenamento NVMe de Alta Velocidade:
      Reduza o tempo de carregamento do jogo com nosso armazenamento NVMe ultrarrápido. Seus jogadores vão adorar a rapidez com que podem explorar o mundo do seu OTServer.
       
      Uplink de até 1GB:
      Oferecemos uma conexão de alta velocidade com até 1GB de largura de banda, garantindo uma experiência de jogo suave e livre de lag para todos os seus jogadores, mesmo nos momentos de pico.
       
      Suporte 24 Horas:
      Estamos sempre aqui para você! Nossa equipe de suporte está disponível 24 horas por dia, 7 dias por semana, para resolver qualquer problema ou responder a qualquer pergunta que você possa ter. Sua satisfação é a nossa prioridade.
       
      Fácil e Rápido de Começar:
      Configurar seu OTServer na CloudRun é simples e rápido. Concentre-se no desenvolvimento do seu jogo enquanto cuidamos da hospedagem.
       
      Entre em Contato Agora!
      Website: https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
      Email: [email protected]
      Telefone: (47) 99902-5147

      Não comprometa a qualidade da hospedagem do seu OTServer. Escolha a CloudRun e ofereça aos seus jogadores a melhor experiência de jogo possível. Visite nosso site hoje mesmo para conhecer nossos planos e começar!
       
      https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
       
      CloudRun - Onde a Velocidade Encontra a Confiabilidade!
       

    • Por FeeTads
      SALVE rapaziada do TK, esses dias vim pensando em novos scripts pro meu OT, e em um deles eu precisava que determinada area não contasse frag pro player que matasse outros, PORÉM eu precisava que os players que morressem nessa area ainda assim tivessem as penalidades da sua morte, procurei por ai, achei alguns scripts que apenas tiravam o SKULL e não realmente o FRAG do player.

      **script atualizado 22/10/2023** - melhorado e otimizado, levei o script pra puxar as infos por .lua / creatureScripts

      vou disponibilizar o code aqui, e o que fazer pra determinada area não contar frag.

      SOURCE OTX 2 / TFS 0.x, Funciona em TFS 1.x mudando as tags e ajeitando as sintaxes.

      vá em creatureevent.cpp

      procure por:
      else if(type == "preparedeath") _type = CREATURE_EVENT_PREPAREDEATH;
      Adiciona abaixo:
      else if(type == "nocountfrag") _type = CREATURE_EVENT_NOCOUNTFRAG;

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath";  
      Adicione abaixo: 
      case CREATURE_EVENT_NOCOUNTFRAG: return "noCountFragArea";

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList";
      Adicione abaixo:
      case CREATURE_EVENT_NOCOUNTFRAG: return "cid, target";

      agora no mesmo arquivo, vá até o final do arquivo e adicione essa função:
      uint32_t CreatureEvent::executeNoCountFragArea(Creature* creature, Creature* target) { //noCountFragArea(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::ostringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; if(m_scriptData) scriptstream << *m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::ostringstream desc; desc << creature->getName(); env->setEvent(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::noCountFragArea] Call stack overflow." << std::endl; return 0; } }

      agora vá em creatureevent.h

      procure por:
      CREATURE_EVENT_PREPAREDEATH
      adicione abaixo:
      CREATURE_EVENT_NOCOUNTFRAG

      procure por:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList);
      Adicione abaixo:
      uint32_t executeNoCountFragArea(Creature* creature, Creature* target);

      agora vá em player.cpp

      procure por:
      bool Player::onKilledCreature(Creature* target, DeathEntry& entry)
      abaixo de:
      War_t enemy; if(targetPlayer->getEnemy(this, enemy)) { if(entry.isLast()) IOGuild::getInstance()->updateWar(enemy); entry.setWar(enemy); }
      Adicione o seguinte código:
      if (targetPlayer){ CreatureEventList killEvents = getCreatureEvents(CREATURE_EVENT_NOCOUNTFRAG); for (const auto &event : killEvents) { if (!event->executeNoCountFragArea(this, target)) { return true; } } }

      //

      Feito isso, tudo completo na sua source, agora é necessário adicionar o creaturescript dentro do servidor

      vá até creaturescripts/scripts
      crie um arquivo chamado, "noCountFragInArea.lua"
      e dentro dele cole o código:
       
      --[[ script feito por feetads / TibiaKing ]]-- --[[ discord: feetads / FeeTads#0246 ]]-- -- Add positions here for which you do not want to count frags local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, -- from = area superior esquerda / to = area inferior direita (formando um quadrado) } local onlyKillerInArea = false -- only killer need to be in area? function noCountFragArea(cid, target) if not isCreature(cid) or not isCreature(target) then return true end local posKiller = getPlayerPosition(cid) local posTarget = getPlayerPosition(target) for i = 1, #areas do local area = areas[i] if isInArea(posKiller, area.from, area.to) then if onlyKillerInArea then return false elseif isInArea(posTarget, area.from, area.to) then return false end end end return true end
      agora em creaturescripts.xml
      <event type="nocountfrag" name="fragarea" event="script" value="noCountFragInArea.lua"/>
      agora em creaturescripts/scripts/login.lua
       procure por OU semelhante a esse:
      registerCreatureEvent(cid, "AdvanceSave")
      e abaixo adicione:
      registerCreatureEvent(cid, "fragarea")

      //


      Agora tudo certo, quando quiser adiciona uma area que não pega frag, vá até o script e apenas coloque a area, igual o demonstrado no script

      Exemplo:
      local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, [2] = {from = {x = 1000, y = 1000, z = 7}, to = {x = 1100, y = 1100, z = 7}}, }
      assim somente colocando a area no script e abrindo o server ou dando /reload, já funcionará a area como não pegar frag.
      Esse sistema pode ser bom pra areas de pvp ativo, onde você ainda quer que o player que morrer perca os atributos, como se fosse uma morte normal, porém não conta frag pra quem matar.
      Bom pra sistemas tipo castle 48h (guild war), onde há diversas mortes e risco de pegar red, atrapalhando a war.

      Façam bom proveito dos scripts, e deixem os créditos no script rsrs

      **Eu fiz as alterações e o simples código por isso vim disponibilizar, créditos meus**
    • Por Muvuka
      Abri canal a força creaturescript acho que funcione no creaturescript cria script creaturescript
       
      <channel id="9" name="HELP" logged="yes"/>
      <channel id="12" name="Report Bugs" logged="yes"/>
      <channel id="13" name="Loot" logged="yes"/>
      <channel id="14" name="Report Character Rules Tibia Rules" logged="yes"/>
      <channel id="15" name="Death Channel"/>
      <channel id="6548" name="DexSoft" level="1"/>
      <channel id="7" name="Reports" logged="yes"/>
       
      antes de 
              if(lastLogin > 0) then adicione isso:
                      doPlayerOpenChannel(cid, CHANNEL_HELP) doPlayerOpenChannel(cid, 1,  2, 3) = 1,2 ,3 Channels, entendeu? NÃO FUNCIONA EU QUERO UM MEIO DE ABRI SEM USA A SOURCE
       
      EU NÃO CONSEGUI ABRI EU NÃO TENHO SOURCE
       
       
    • Por bolachapancao
      Rapaziada seguinte preciso de um script que ao utilizar uma alavanca para até 4 jogadores.
      Os jogadores serão teleportados para hunt durante uma hora e depois de uma hora os jogadores serão teleportados de volta para o templo.
       
      Observação: caso o jogador morra ou saia da hunt o evento hunt é cancelado.

      Estou a base canary
      GitHub - opentibiabr/canary: Canary Server 13.x for OpenTibia community.
       
    • Por RAJADAO
      .Qual servidor ou website você utiliza como base? 
      Sabrehaven 8.0
      Qual o motivo deste tópico? 
      Ajuda com novos efeitos
       
      Olá amigos, gostaria de ajuda para introduzir os seguintes efeitos no meu servidor (usando o Sabrehaven 8.0 como base), adicionei algumas runas novas (avalanche, icicle, míssil sagrado, stoneshower & Thunderstorm) e alguns novos feitiços (exevo mas san, exori san, exori tera, exori frigo, exevo gran mas frigo, exevo gran mas tera, exevo tera hur, exevo frigo hur) mas nenhum dos efeitos dessas magias parece existir no servidor, alguém tem um link para um tutorial ou algo assim para que eu possa fazer isso funcionar?
      Desculpe pelo mau inglês, sou brasileiro.

      Obrigado!


      AVALANCHE RUNE id:3161 \/
      (COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

      STONESHOWER RUNE id:3175 \/
      (COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_STONES)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

      THUNDERSTORM RUNE id:3202 \/
      (COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_E NERGYHIT)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

      ICICLE RUNE id:3158 \/
      COMBAT_ICEDAMAGE
      CONST_ME_ICEAREA
      CONST_ANI_ICE

      SANTO MÍSSIL RUNA id:3182 \/
      (COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

      CONST_ME_PLANTATTACK (exevo gran mas tera)
      CONST_ME_ICETORNADO (exevo gran mas frigo)
      CONST_ME_SMALLPLANTS (exevo tera hur)
      CONST_ME_ICEAREA (exevo frigo hur)
      CONST_ME_ICEATTACK (exori frigo)
      CONST_ME_CARNIPHILA (exori tera)

      EXORI SAN \/
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
      CONST_ME_HOLYDAM IDADE

      EXEVO MAS SAN \/
      CONST_ME_HOLYAREA
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo