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

Status
Not open for further replies.

Collz

Pandas Go RAWR!!!
Joined
Oct 10, 2008
Messages
2,091
Reaction score
57
Location
New York
So what i basically need is an npc that can do all of this in the example below... Also i am using TFS 0.3.4

Player: Hi
Npc: Hello |PLAYERNAME|, I really need your help.
Player: Help.
Npc: My brother went to the Troll Island to do some research. It has been 2 weeks and he has not returned. I am worried deeply. Can you go to Troll Island and find him for me.
Player: Troll Island
Npc: Go east from here and you will find Sarlom, talk to him and he can take you to troll island.
Player: Bye
Npc: Hurry my friend, my brothers faith lays in your hands.

Returning
----------
Player: Hi
Npc: Please tell me about my brother, is he hurt?
Player: hurt
Npc: He didnt make it! Did you find anything on him?
Player: Wedding Ring
Npc: Thank you kind friend. Take this for all your hard work....

The npc gives you 150 GP and 200 exp.
The Wedding ring id is 2121.
 
I tried to make it myself and it didnt work.
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


    if msgcontains(msg, 'quest') then
	if getPlayerStorageValue(cid, 30120) == -1 then
		npcHandler:say('Hello |PLAYERNAME|, I really need your {help}', cid)
		talkState[talkUser] = 1
        end
        
    elseif talkState[talkUser] == 1 then
        if msgcontains(msg, 'help') then
                npcHandler:say('My brother went to the {Troll Island} to do some research. It has been one weeks and he has not returned. I am worried deeply. Can you go to Troll Island and find him.', cid)
        end

    elseif talkState[talkUser] == 1 then
        if msgcontains(msg, 'Troll') then
		npcHandler:say('Go directly east of here and you will find Sarlom. He is my cousin and he can take you to Troll Island. Also bring me his wedding ring back so that I could know if you found him.', cid)
                setPlayerStorageValue(cid,30120,1)
        end

    elseif talkState[talkUser] == 2 then
        if msgcontains(msg, 'Wedding') then
                npcHandler:say('Did you bring me back his wedding ring?', cid)
	            if doPlayerRemoveItem(cid,2121,1) == TRUE then
                setPlayerStorageValue(cid,30121,2)
                setPlayerStorageValue(cid,60035,1)
                doPlayerAddItem(cid,2148,150)
		    doPlayerAddExp(cid,200)
                talkState[talkUser] = 3
                else
                npcHandler:say('Please bring me his wedding ring so I know that you found him.', cid)
            end
            end
            end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Can somebody edit it.
Here is the error im getting
Code:
[06/09/2009 21:28:41] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/fau.lua
[06/09/2009 21:28:41] data/npc/scripts/fau.lua:1: unexpected symbol near 'ÿ'
 
Status
Not open for further replies.
Back
Top Bottom