Fermantor
Active Member
I got a very strange error here. I was scripting my npc's in german, so I used the letters ö,ä & ü. Everything worked perfect until one npc. This npc don't say this letters, instead of them he text's "ö" for ö for example. How is it possible, that the one script works fine, while an other one don't.
Here are my two scripts:
Working NPC
Not working NPC
Here are my two scripts:
Working NPC
LUA:
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, 'job') then
npcHandler:say("Ich bin der Druide dieses Waldes, und hüte die Natur vor dem Bösen. Ich kaufe Tierprodukte, frag einfach nach einem {trade}. zusätzlich gebe ich auch noch {tasks}.", cid)
elseif msgcontains(msg, 'task') then
npcHandler:say("Ich habe zwei verschiedene Tasks anzubieten. Einmal {Wolves} und einmal {Bears}.", cid)
talkState[talkUser] = 1
elseif msgcontains(msg, 'bear') or msgcontains(msg, 'bears') then
if talkState[talkUser] == 1 then
npcHandler:say("Bears ja? Es gibt einen kleinen Berg, nord-westlich von hier. Du musst 75 von ihnen töten. Interesse?", cid)
talkState[talkUser] = 2
end
elseif msgcontains(msg, 'wolf') or msgcontains(msg, 'wolves') then
if talkState[talkUser] == 1 then
npcHandler:say('Wölfe, lästige kleine Biester. Jage 100 von ihnen und besiege ihren Boss, okay?', cid)
talkState[talkUser] = 3
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Not working NPC
LUA:
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, 'task') then
if getPlayerLevel(cid) >= 60 then
if getPlayerStorageValue(cid, 20101) >= 4010 then
npcHandler:say("Wahnsinn, du hast es echt geschaft. Ich habe ehrlich gesagt nicht damit gerechnet. Hier ist deine Belohnung. Nun gehe ins untere Verlies und töte Necropharus.", cid)
setPlayerStorageValue(cid, 20101, 1)
doPlayerAddExp(cid, 40000, true, true)
elseif getPlayerStorageValue(cid, 20101) >= 10 then
npcHandler:say("Deine Task ist es 4000 Necromancer und Priestess zu töten. Im Moment hast du " .. getPlayerStorageValue(cid, 20101)-10 .. "/4000 getötet. Oder willst du die task {abbrechen}?", cid)
elseif getPlayerStorageValue(cid, 20101) == 1 then
npcHandler:say("Deine Aufgabe ist es Necropharus zu töten. Der Eingang zu seinen Hallen ist im Verlies unter mir. Oder willst du die task {abbrechen}?", cid)
elseif getPlayerStorageValue(cid, 20101) == 2 then
npcHandler:say("Du hast es tatsächlich geschafft Necropharus zu töten. Ich bin wahrhaft beeindruckt. Komme jederzeit wieder, wenn du die Task erneut starten willst.", cid)
setPlayerStorageValue(cid, 20101, 3)
npcHandler:releaseFocus(cid)
else
npcHandler:say("Ich habe eine task für dich. Töte 4000 Necromancer und Priestess. Wärst du bereit dies für mich zu tun?", cid)
talkState[talkUser] = 2
end
else
npcHandler:say("Ich habe eine task, aber du scheinst noch zu schwach zu sein. Kommt später wieder, wenn du stärker bist.", cid)
npcHandler:releaseFocus(cid)
end
elseif msgcontains(msg, 'ja') then
if getPlayerLevel(cid) >= 60 then
if talkState[talkUser] == 2 then
if getPlayerStorageValue(cid, 20101) == -1 or getPlayerStorageValue(cid, 20101) == 3 then
setPlayerStorageValue(cid, 20101, 10)
npcHandler:say("Sehr gut, dann gehe los und töte sie alle. Komm wieder und berichte mir, wenn du fertig bist, oder deine task {abbrechen} willst.", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
elseif talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, 20101) ~= -1 and getPlayerStorageValue(cid, 20101) ~= 3 then
setPlayerStorageValue(cid, 20101, -1)
npcHandler:say("Nun gut, so sei es. Du kannst jederzeit wieder kommen und die Task erneut starten.", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
end
end
elseif msgcontains(msg, 'abbrechen') then
if getPlayerStorageValue(cid, 20101) ~= -1 and getPlayerStorageValue(cid, 20101) ~= 3 then
npcHandler:say("Bist du sicher, dass du deine Task an dieser Stelle abbrechen willst?", cid)
talkState[talkUser] = 1
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())