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

Lua Help NPC vocation! 0.4 8.7 or 8.6

Rafaelizidoro

New Member
Joined
Jan 5, 2013
Messages
9
Reaction score
0
Hello Everybody,

I'm creating a NPC from Island of Destiny, but my knowledge is small.

I want create a Knight Hykrion from Island of destiny.

Your transcript is: Hi, yes, knighthood, yes, yes.

I need help to fix this script:

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)                npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid)            npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)            npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink()                    npcHandler:eek:nThink() end

function creatureSayCallback(cid, type, msg)
    if (msgcontains(msg, "yes") or msgcontains(msg, "YES"))  then
    npcHandler:say("Yes, that's the attitude you need as a knight - strong-willed and determined! I can either you {knighthood} immediately or give you more information about us. What's your wish?", cid)
elseif Topic[cid] == 1 then
        if msgcontains(msg, 'information') or msgcontains(msg, "INFORMATION") then
            npcHandler:say("MESSAGE TO INFORMATION!", cid)
            Topic[cid] = nil
        elseif msgcontains(msg, "no") then
            npcHandler:say("Well, I won't talk you into it. Maybe you would like to hear what {Narai}, {Estrella} and {Yandur} have to say about the other vocations. Ask me about {Information} anytime.", cid)
            Topic[cid] = nil
        end
        if msgcontains(msg, 'knighthood') or msgcontains(msg, "KNIGHTHOOD") then
            npcHandler:say("Are you sure that you can fulfill the duties of a knight and that you have all needed information?", cid)
            Topic[cid] = 2
        elseif msgcontains(msg, "no") then
            npcHandler:say("Well, I won't talk you into it. Maybe you would like to hear what {Narai}, {Estrella} and {Yandur} have to say about the other vocations. Ask me about {Information} anytime.", cid)
            Topic[cid] = nil
        end
elseif Topic[cid] == 2 then
    if msgcontains(msg, 'yes') or msgcontains(msg, "YES") then
            npcHandler:say("Be aware that this decision is final! Step in front of me and annouce it proudly: DO YOU WANT TO BE A KNIGHT?", cid)
            talk_state = 1
            else
            npcHandler:say('MENSAGEM QUE INFORMA O PLAYER QUE JÁ TEM LV!', cid)
            talk_state = 0
            end
            Topic[cid] = 3
        elseif msgcontains(msg, "no") then
            npcHandler:say("Well, I won't talk you into it. Maybe you would like to hear what {Narai}, {Estrella} and {Yandur} have to say about the other vocations. Ask me about {Information} anytime.", cid)
            npcHandler:releaseFocus(cid)
            Topic[cid] = nil
        end
elseif Topic[cid] == 3 then
    if msgcontains(msg, 'yes') or msgcontains(msg, "YES") then
            if getCreatureStorage(cid, 43211) == 1 == FALSE then
            npcHandler:say("SO BE IT! Stand strong and prud, knight "..getCreatureName(cid).."! Learn the words of your first spell: 'UTEVO LUX' and shine! You may cast it by saying the magic words 'UTEVO LUX' while you have 20 mana or more. ...", cid)
            doPlayerSetVocation(cid, 4)
                        setPlayerStorageValue(cid, 43211,1)
                        doSendMagicEffect(getCreaturePosition(cid), 14)
            else
            npcHandler:say('SE APARECER ESSA MENSAGEM, MANTER.', cid)
            end
        elseif msgcontains(msg, "no") then
            npcHandler:say("Well, I won't talk you into it. Maybe you would like to hear what {Narai}, {Estrella} and {Yandur} have to say about the other vocations. Ask me about {Information} anytime.", cid)
            npcHandler:releaseFocus(cid)
            Topic[cid] = nil
        end
    return true
end

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