Hello,
this script is pretty much complete, it works well except for not saying the specified message for the 'You have completed the task already!' response but the other responses work, thank you for taking a look at this.
TFS 0.4 for 8.6
This is the simple boss quest NPC i wrote this morning:
this script is pretty much complete, it works well except for not saying the specified message for the 'You have completed the task already!' response but the other responses work, thank you for taking a look at this.
TFS 0.4 for 8.6
This is the simple boss quest NPC i wrote this morning:
Lua:
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:setMessage(MESSAGE_GREET, "Hello there, |PLAYERNAME| I am having problems with the local inhabitants, I can kill the weaklings but I need you to take down the big ones. If You kill all 3 {bosses}, I will {reward} you with experience and treasure!")
function reward(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerStorageValue(cid, 10002) == 1 and getPlayerStorageValue(cid, 10003) == 1 and getPlayerStorageValue(cid, 10004) == 1 then
npcHandler:say('Thank you for youre troubles, here is your reward.', cid)
doPlayerAddItem(cid, 2159, 1)
doPlayerAddLevel(cid, 3)
setPlayerStorageValue(cid, 10002, 2)
setPlayerStorageValue(cid, 10003, 2)
setPlayerStorageValue(cid, 10004, 2)
else if getPlayerStorageValue(cid, 10002) == 2 and getPlayerStorageValue(cid, 10003) == 2 and getPlayerStorageValue(cid, 10004) == 2 then
npchandler:say('You have completed the task already!', cid)
else if getPlayerStorageValue(cid, 10002) < 1 or getPlayerStorageValue(cid, 10003) < 1 or getPlayerStorageValue(cid, 10004) < 1 then
npcHandler:say('You have not killed all 3 bosses yet.', cid)
end
end
end
end
keywordHandler:addKeyword({'bosses'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you kill Bovinus, Occuni and Frog King I will {reward} you for youre effort."})
local node1 = keywordHandler:addKeyword({'reward'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Have you killed all 3 bosses?'})
node1:addChildKeyword({'yes'}, reward, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok then.', reset = true})
npcHandler:addModule(FocusModule:new())
Last edited: