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

NPC Story teller

Unknown Soldier

Mapping a map
Joined
Oct 30, 2010
Messages
307
Solutions
11
Reaction score
688
Hi!

Since I am currently working on RPG server, I need story teller NPC. Spent few hours for now, didn;t find anything that would work :/

Best looking thread was this so far, but it doesn't work aswell, or I am doing something wrong, maybe you can guide me thgough this? For me many NPC scripts looks very messy, and I am not able to deal with all of them, so I am asking for your help, what do I do to crate story telling NPC? I have TFS 9.6 (0.2.14 - I guess).
 
Your npc could look like this:
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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    [COLOR="#FF0000"]if msgcontains(msg, 'enter') then
        selfSay('Bla bla', cid)
        talkState[talkUser] = 1
    elseif ((msgcontains(msg, 'yes')) and talkState[talkUser] == 1) then
	selfSay('BLABLA?', cid)
	talkState[talkUser] = 2
    end[/COLOR]


    return TRUE    
end



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

Just edit the red part as you want it.
 
Back
Top