Thaian Citizen
Hexenjäger
Now I think these issues are quite easy to fix, yet I can't figure it out myself...
I am using crying damson version of TFS 0.3.6 -8.60 server that was posted by Printer~
The first (My own oracle npc, I know its not an optimum script but I try to do as much as I can by myself from scratch, the problem is, whenever I talk to him he also does the last else action and tells me "I can't understand you. Could you speak clearly?!" he does say this in addition to the right keyword respond, the npc code:
Another problem I have is when i make shop npcs I regularly work with the default.lua and write the npc in xml.. but if you use the default responds of the npc or replacements of the default keywords the npc will always say it in default chat instead of npc chat, I know that you need cid at last parameter in your lua script for the npc to say that sentence in npc chat but i dont know what exactly to replace in the modules/npchandler or whatever lua
would be nice if someone can help with these
and sry for my weak formulation, im kinda exhausted..
I am using crying damson version of TFS 0.3.6 -8.60 server that was posted by Printer~
The first (My own oracle npc, I know its not an optimum script but I try to do as much as I can by myself from scratch, the problem is, whenever I talk to him he also does the last else action and tells me "I can't understand you. Could you speak clearly?!" he does say this in addition to the right keyword respond, the npc code:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local destiny = { vocation = {}, city = {} }
local towns = {
["celestial village"] = { id = 2, x=9651, y=10270, z=6 }
}
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 |PLAYERNAME|. Are you prepared to face your destiny?')
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 msg == "yes" then
if (getPlayerLevel(cid) < 8) then
selfSay("You are not ready if you are below level 8!", cid)
npcHandler:releaseFocus(cid)
else
if (not getPlayerVocation(cid) == 0) then
selfSay("You already have a vocation!", cid)
npcHandler:releaseFocus(cid)
else
selfSay("Then tell me your occupation.. Do you want to be a {knight}, {paladin}, {sorcerer} or {druid}?!", cid)
talkState[talkUser] = 1
end
end
elseif msg == "no" then
selfSay("Well don't waste my time then..", cid)
npcHandler:releaseFocus(cid)
end
if msg == "knight" and talkState[talkUser] == 1 then
selfSay("So you want to be a {knight}, are you sure?", cid)
destiny.vocation = "knight"
talkState[talkUser] = 2
elseif msg == "paladin" and talkState[talkUser] == 1 then
selfSay("So you want to be a {paladin}, are you sure?", cid)
destiny.vocation = "paladin"
talkState[talkUser] = 2
elseif msg == "sorcerer" and talkState[talkUser] == 1 then
selfSay("So you want to be a {sorcerer}, are you sure?", cid)
destiny.vocation = "sorcerer"
talkState[talkUser] = 2
elseif msg == "druid" and talkState[talkUser] == 1 then
selfSay("So you want to be a {druid}, are you sure?", cid)
destiny.vocation = "druid"
talkState[talkUser] = 2
end
if msg == "yes" and talkState[talkUser] == 2 then
selfSay("Ok, you will become a "..destiny.vocation.."..", cid)
if isPremium(cid) then
selfSay("Where do you want me to bring you? {Celestial Village}, ......", cid, true)
else
selfSay("Where do you want me to bring you? Example, ......", cid, true)
end
talkState[talkUser] = 3
elseif msg == "no" and talkState[talkUser] == 2 then
selfSay("Then think about it and come back when you are sure..", cid)
destiny.vocation = {}
talkState[talkUser] = {}
end
if msg == "celestial village" and talkState[talkUser] == 3 then
if isPremium(cid) then
selfSay("Celestial Village, huh?! Is that where you want to go?", cid)
destiny.city = "Celestial Village"
else
selfSay("I am not allowed to bring you there if you don't have premium access..", cid)
destiny.vocation = {}
talkState[talkUser] = {}
npcHandler:releaseFocus(cid)
end
talkState[talkUser] = 4
end
if msg == "yes" and talkState[talkUser] == 4 then
selfSay("Arrr, let's sail!", cid)
if destiny.vocation == 'sorcerer' then
doPlayerSetVocation(cid, 1)
elseif destiny.vocation == 'druid' then
doPlayerSetVocation(cid, 2)
elseif destiny.vocation == 'paladin' then
doPlayerSetVocation(cid, 3)
else
doPlayerSetVocation(cid, 4)
end
local toGo = towns[destiny.city:lower()]
doPlayerSetTown(cid, toGo.id)
local destination = { x = toGo.x, y = toGo.y, z = toGo.z }
local tmp = getCreaturePosition(cid)
doTeleportThing(cid, destination)
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(destination, CONST_ME_TELEPORT)
destiny.vocation = {}
destiny.city = {}
talkState[talkUser] = {}
npcHandler:releaseFocus(cid)
elseif msg == "no" and talkState[talkUser] == 4 then
selfSay("GOD DAMN! CAN YOU FINALLY DECIDE WHAT YOU WANT?!", cid)
destiny.vocation = {}
destiny.city = {}
talkState[talkUser] = {}
npcHandler:releaseFocus(cid)
else
selfSay("I can't understand you. Could you speak clearly?!", cid)
destiny.vocation = {}
destiny.city = {}
talkState[talkUser] = {}
npcHandler:releaseFocus(cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Another problem I have is when i make shop npcs I regularly work with the default.lua and write the npc in xml.. but if you use the default responds of the npc or replacements of the default keywords the npc will always say it in default chat instead of npc chat, I know that you need cid at last parameter in your lua script for the npc to say that sentence in npc chat but i dont know what exactly to replace in the modules/npchandler or whatever lua
would be nice if someone can help with these
and sry for my weak formulation, im kinda exhausted..