• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 1.2 Npc

undead mage

Active Member
Joined
Mar 25, 2012
Messages
364
Solutions
2
Reaction score
47
Location
Amsterdam
So I tryd this script that when you say the word "join" to the npc that the npc will say "I grant you acces to the warzones!" and set your storage to (87816, 1). But nothing is happening when im saying "join" to the npc. Also how can I make words that the npc says dark blue? So ppl know that that's a word that the npc responds to? @Xeraphus

Code:
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

npcHandler:addModule(FocusModule:new())

local function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local player = Player(cid)
        if(msgcontains(msg, "join")) then
            npcHandler:say("I grant you acces to the warzones!", cid)
            player:setStorageValue(87816, 1)
            npcHandler.topic[cid] = 0
        end
    return true
end
 
Code:
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
at the end of the file

i think you use {} in the xml for keywords
for example if you wanted a blue "cheese" keyword you'd put {cheese}
 
Code:
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
at the end of the file

i think you use {} in the xml for keywords
for example if you wanted a blue "cheese" keyword you'd put {cheese}
Thanks for the fast reply! The keyword worked and now the npc is responding but I don't believe that the player is getting the storage because I can't find it in my database
 
Thanks for the fast reply! The keyword worked and now the npc is responding but I don't believe that the player is getting the storage because I can't find it in my database
no reason the storage value shouldnt be being set
if you actually want to check put player:setStorage~ in print()
if it prints true in your console then it gave the player the storage
 
Back
Top