• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved 0.3.6 Crying Damson NPC Problem

Kapi-Ziom

New Member
Joined
Mar 15, 2008
Messages
21
Reaction score
2
Location
Poland
How to solve this problem? Npc say yellow and blue in the same moment.
Thx for u help:)
7cbQhc.jpg
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Eryn" nameDescription="Eryn, the rune vendor" script="runes.lua" walkinterval="2000" floorchange="0" skull="green">
    <health now="100" max="100"/>
    <look type="130" head="39" body="122" legs="125" feet="57" addons="0"/>
</npc>

I think that i found error:

Code:
   -- Greets a new player.
    function NpcHandler:greet(cid)
        if(cid ~= 0) then
            local callback = self:getCallback(CALLBACK_GREET)
            if(callback == nil or callback(cid)) then
                if(self:processModuleCallback(CALLBACK_GREET, cid)) then
                    local msg = self:getMessage(MESSAGE_GREET)
                    local parseInfo = { [TAG_PLAYERNAME] = getCreatureName(cid) }
                    msg = self:parseMessage(msg, parseInfo)

                    self:say(msg)
                    self:addFocus(cid)
                    self:say(msg, cid)
                end
            end
        end
    end

When i remove
Code:
self:say(msg)
it working good.
 
Last edited:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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 shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook')
shopModule:addBuyableItem({'magic lightwand'}, 2163, 400, 'magic lightwand')
--removed trade items because to long

local items = {[1] = 2190, [2] = 2182, [5] = 2190, [6] = 2182}
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    if(msgcontains(msg, 'first rod') or msgcontains(msg, 'first wand')) then
        if(isSorcerer(cid) or isDruid(cid)) then
            if(getPlayerStorageValue(cid, 30002) <= 0) then
                selfSay('So you ask me for a {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '} to begin your advanture?', cid)
                talkState[talkUser] = 1
            else
                selfSay('What? I have already gave you one {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '}!', cid)
            end
        else
            selfSay('Sorry, you aren\'t a druid either a sorcerer.', cid)
        end
    elseif(msgcontains(msg, 'yes')) then
        if(talkState[talkUser] == 1) then
            doPlayerAddItem(cid, items[getPlayerVocation(cid)], 1)
            selfSay('Here you are young adept, take care yourself.', cid)
            setPlayerStorageValue(cid, 30002, 1)
        end
        talkState[talkUser] = 0
    elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
        selfSay('Ok then.', cid)
        talkState[talkUser] = 0
    end

    return true
end

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