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

Problem lua - Quest kill monster

Exactly

New Member
Joined
Jul 14, 2014
Messages
117
Reaction score
4
Hello,
I have problem on Quest i need kill 20 monster but when i kill this monster and need finish quest get information that I did not kill.

This Quest:

Lua:
if(msgcontains(msg, 'zadanie 2')) then
selfSay('W swiatyni niedaleko, pojawili sie oblakani wyznawcy, zabij ich 20 i wroc do mnie ({zabilem ich}). ', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'zabilem ich') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,160) < 1) then
selfSay('Wykonaj moje poprzednie polecenia...', cid)
else
if (getPlayerStorageValue(cid,161) > 0) then
selfSay('Wykonales juz ta misje.', cid)
else
if (getPlayerStorageValue(cid,35097) > 19) then
setPlayerStorageValue(cid,161,1)
doPlayerAddExperience(cid,150000)
doPlayerAddItem(cid, 2492, 1)
selfSay('Bardzo ci dziekuje. (otrzymales 150000pkt doswiadczenia)', cid)
else
selfSay('Wciaz ich nie zabiles.', cid)
end
end
end
return true
end

Whole Script:

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local item1 = 9019
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, 'pomoc')) then
selfSay('Mam dla ciebie kilka zadan, za wykonanie ich czeka cie nagroda. (zadanie 1, zadanie 2, zadanie 3.)', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'zadanie 1')) then
selfSay('Gdzies w podziemiach tej fortecy zalegly sie weze, chce abys zabil ich krola i przyniosl mi {vampire doll}.', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'vampire doll') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,160) > 0) then
selfSay('Wykonales juz to zadanie.', cid)
else
if(doPlayerRemoveItem(cid, item1, 1) == TRUE) then
setPlayerStorageValue(cid,160,1)
doPlayerAddExperience(cid,50000)
selfSay('Bardzo ci dziekuje za tego liscia. (otrzymales 50000pkt doswiadczenia)', cid)
else
selfSay('Przynies mi {vampire doll}...', cid)
end
end
return true
end
----------------------------------------------------------
if(msgcontains(msg, 'zadanie 2')) then
selfSay('W swiatyni niedaleko, pojawili sie oblakani wyznawcy, zabij ich 20 i wroc do mnie ({zabilem ich}). ', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'zabilem ich') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,160) < 1) then
selfSay('Wykonaj moje poprzednie polecenia...', cid)
else
if (getPlayerStorageValue(cid,161) > 0) then
selfSay('Wykonales juz ta misje.', cid)
else
if (getPlayerStorageValue(cid,35097) > 19) then
setPlayerStorageValue(cid,161,1)
doPlayerAddExperience(cid,150000)
doPlayerAddItem(cid, 2492, 1)
selfSay('Bardzo ci dziekuje. (otrzymales 150000pkt doswiadczenia)', cid)
else
selfSay('Wciaz ich nie zabiles.', cid)
end
end
end
return true
end
----------------------------------------------------------
if(msgcontains(msg, 'zadanie 3')) then
selfSay('Zabij {10 archaniolow}... ', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, '10 archaniolow') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,161) < 1) then
selfSay('Wykonaj moje poprzednie polecenia...', cid)
else
if (getPlayerStorageValue(cid,162) > 0) then
selfSay('Wykonales juz wszystkie misje.', cid)
else
if (getPlayerStorageValue(cid,35095) > 9) then
setPlayerStorageValue(cid,162,1)
doPlayerAddExperience(cid,500000)
doPlayerAddItem(cid, 11414, 1)
selfSay('Bardzo dobrze sie spisales, oto twoja nagroda, jak obiecalem. (otrzymales 500000pkt doswiadczenia i crazy hat)', cid)
else
selfSay('Czyzbys nie umial ich znalezc?', cid)
end
end
end
return true
end
---------------------------------------------------------
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Thanks for help i rep++ for help
 
You need a way to set those storage values so that the npc can check if the player completed the task. Normally scripts like these use something like an onKill script so that it can update the storage value per kill per creature. Do you have an onKill script?
 
Back
Top