• 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 TFS 0.4 Quest NPC Help

TomBartezz

Member
Joined
May 29, 2016
Messages
159
Reaction score
17
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
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
local goldenNuggetID = 2160
local storageValue = 10102
local goldenHelmetID = 2471
local name = getPlayerName(cid)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid      
                        -----------------------------------------
        if msgcontains(msg, 'frozen helmet') then
        if getPlayerItemCount(cid, goldenNuggetID) >= 20 then
        if getPlayerStorageValue(cid, storageValue) == -1 then
        setPlayerStorageValue(cid, storageValue, 1)
    selfSay('Do you have 20 crystal coins to exchange?', cid)
    talkState[talkUser] = 1
        else
    selfSay('You already made this quest', cid)
    talkState[talkUser] = 0
    end
    else
    selfSay('You don\'t have 20 crystal coins!', cid)
    talkState[talkUser] = 0
    end
        elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        doPlayerRemoveItem(cid, goldenNuggetID, 20)
        doPlayerAddItem(cid, goldenHelmetID, 1)
    selfSay('Thank you ' .. name ..'', cid)
    elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
        talkState[talkUser] = 0
        selfSay('Ok then.', cid)
    end
    -----------------------------------------
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Hello, I would like some help adding more lines to this script, where a player says hi>starter set>frozen helmet or frozen armor or frozen boots or frozen legs or frozen shield (does what the ifmsgcontains does but each items has its own storageid) and another line where a player says hi>mid set>lava helm or lava armor or lava boots or lava legs or lava shield (does what the ifmsgcontains does but each items has its own storageid)

For example:
Player: Hi
NPC: Hello player, would you like to do the {start set} or the {mid set}?
Player:start set
NPC: Would you like to do the {frozen helmet},{frozen armor},{frozen shield},{frozen boots}, or {frozen legs} quest?
Player:frozen legs
NPC: +1 to storageid for legs and request the items as shown in the script and player cannot do the quest again
 
Back
Top