royalpala
Well-Known Member
- Joined
- Dec 31, 2019
- Messages
- 85
- Solutions
- 1
- Reaction score
- 68
Good evening, people
I am working on a Quest NPC and had some problems while testing into my OTserver Im not a pro but i did my best and I dont know whats wrong with this
npc is responding various texts when I say "reborn" ,"reborn knight" "reborn paladin" "reborn druid" "reborn sorcerer".
when you say "Quest" or "brooch" and then "yes" he is not responding
this script has been hours and hours of worktime and i would like it to get to work
this NPC has a Task for level 200 and another Quest
also I dont know if the storage values are ok..
TFS 0.4 for 8.6
theres no error messages on console
sorry if the script is too long
I am working on a Quest NPC and had some problems while testing into my OTserver Im not a pro but i did my best and I dont know whats wrong with this
npc is responding various texts when I say "reborn" ,"reborn knight" "reborn paladin" "reborn druid" "reborn sorcerer".
when you say "Quest" or "brooch" and then "yes" he is not responding
this script has been hours and hours of worktime and i would like it to get to work
this NPC has a Task for level 200 and another Quest
also I dont know if the storage values are ok..
TFS 0.4 for 8.6
theres no error messages on console
sorry if the script is too long
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, 'reborn knight') or msgcontains(msg, 'rebirth knight')) then
selfSay('Are you sure you want to Reset your vocation to start this Task?', cid)
talkState[talkUser] = 2
if(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if(getPlayerVocation(cid) == 8 and getPlayerLevel(cid) == 200) then
doPlayerSetVocation(cid, 0)
doPlayerSetStorageValue(cid, 6010, 1)
selfSay('While this task is open you have access to the spell EXORI NON, Your vocation has been removed, now you need to reach level 250, come back to me when you are done!', cid)
elseif (getPlayerVocation(cid) == 8 and getPlayerLevel(cid) > 200) then
selfSay('Seems like you are too strong already for this task! you need to be level 200!', cid)
elseif (getPlayerVocation(cid) == 8 and getPlayerLevel(cid) < 200) then
selfSay('Seems like you are too weak for this task! you need to be level 200!', cid)
elseif getPlayerVocation(cid) ~= 8 then
selfSay('Sorry, you need to be an Elite knight with level 200 to start this task', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
end
---------------------------
if(msgcontains(msg, 'reborn paladin') or msgcontains(msg, 'rebirth paladin')) then
selfSay('Are you sure you want to Reset your vocation to start this Task?', cid)
talkState[talkUser] = 3
if(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then
if(getPlayerVocation(cid) == 7 and getPlayerLevel(cid) == 200) then
doPlayerSetVocation(cid, 0)
doPlayerSetStorageValue(cid, 6011, 1)
selfSay('While this task is open you have access to the spell EXORI NON, Your vocation has been removed, now you need to reach level 250, come back to me when you are done!', cid)
elseif (getPlayerVocation(cid) == 7 and getPlayerLevel(cid) > 200) then
selfSay('Seems like you are too strong already for this task! you need to be level 200!', cid)
elseif (getPlayerVocation(cid) == 7 and getPlayerLevel(cid) < 200) then
selfSay('Seems like you are too weak for this task! you need to be level 200!', cid)
elseif getPlayerVocation(cid) ~= 7 then
selfSay('Sorry, you need to be a Royal Paladin with level 200 to start this task', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
end
---------------------------
if(msgcontains(msg, 'reborn druid') or msgcontains(msg, 'rebirth druid')) then
selfSay('Are you sure you want to Reset your vocation to start this Task?', cid)
talkState[talkUser] = 4
if(msgcontains(msg, 'yes') and talkState[talkUser] == 4) then
if(getPlayerVocation(cid) == 6 and getPlayerLevel(cid) == 200) then
doPlayerSetVocation(cid, 0)
doPlayerAddItem(cid, 12648 ,1)
doPlayerSetStorageValue(cid, 6012, 1)
selfSay('While this task is open you have access to the spell EXORI NON, Your vocation has been removed, now you need to reach level 250, come back to me when you are done!', cid)
elseif (getPlayerVocation(cid) == 6 and getPlayerLevel(cid) > 200) then
selfSay('Seems like you are too strong already for this task! you need to be level 200!', cid)
elseif (getPlayerVocation(cid) == 6 and getPlayerLevel(cid) < 200) then
selfSay('Seems like you are too weak for this task! you need to be level 200!', cid)
elseif getPlayerVocation(cid) ~= 6 then
selfSay('Sorry, you need an Elder Druid with level 200 to start this task', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
end
---------------------------
if(msgcontains(msg, 'reborn sorcerer') or msgcontains(msg, 'rebirth sorcerer')) then
selfSay('Are you sure you want to Reset your vocation to start this Task?', cid)
talkState[talkUser] = 5
if(msgcontains(msg, 'yes') and talkState[talkUser] == 5) then
if(getPlayerVocation(cid) == 5 and getPlayerLevel(cid) == 200) then
doPlayerSetVocation(cid, 0)
doPlayerAddItem(cid, 12648, 1)
doPlayerSetStorageValue(cid, 6013, 1)
selfSay('While this task is open you have access to the spell EXORI NON, Your vocation has been removed, now you need to reach level 250, come back to me when you are done!', cid)
talkState[talkUser] = 0
elseif (getPlayerVocation(cid) == 5 and getPlayerLevel(cid) > 200) then
selfSay('Seems like you are too strong already for this task! you need to be level 200!', cid)
talkState[talkUser] = 0
elseif (getPlayerVocation(cid) == 5 and getPlayerLevel(cid) < 200) then
selfSay('Seems like you are too weak for this task! you need to be level 200!', cid)
talkState[talkUser] = 0
elseif getPlayerVocation(cid) ~= 5 then
selfSay('Sorry, you need to be a Master Sorcerer with level 200 to start this task', cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
end
---------------------------
if (msgcontains(msg, 'reborn') or msgcontains(msg, 'task') and getPlayerVocation(cid) == 0 and getPlayerLevel(cid) > 200 and getPlayerLevel(cid) < 250) then
selfSay('you need to reach level 250 to end this Task, come back when you are stronger!', cid)
end
---------------------------
if (msgcontains(msg, 'reborn') or msgcontains(msg, 'task') and getPlayerVocation(cid) == 0 and getPlayerLevel(cid) >= 250 and getPlayerStorageValue(cid,6010) == 1 or getPlayerStorageValue(cid,6011) == 1 or getPlayerStorageValue(cid,6012) == 1 or getPlayerStorageValue(cid,6013) == 1) then
selfSay('Looks like you completed the task, are you ready to Reborn?', cid)
talkState[talkUser] = 6
if(msgcontains(msg, 'yes') and talkState[talkUser] == 6 and getPlayerStorageValue(cid,6010) == 1) then
doPlayerSetVocation(cid, 8)
doPlayerAddSkill(cid,1,20)
doPlayerAddSkill(cid,2,20)
doPlayerAddSkill(cid,3,20)
doPlayerAddSkill(cid,5,20)
doPlayerSetStorageValue(cid, 6014, 1)
selfSay('you completed the Task! you are an Elite Knight again and recieved bonus points on your skills', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6 and getPlayerStorageValue(cid,6011) == 1) then
doPlayerSetVocation(cid, 7)
doPlayerAddSkill(cid,4,20)
doPlayerAddSkill(cid,5,15)
doPlayerSetStorageValue(cid, 6014, 1)
selfSay('you completed the Task! you are a Royal Paladin again and recieved bonus points on your skills', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6 and getPlayerStorageValue(cid,6012) == 1) then
doPlayerSetVocation(cid, 6)
doPlayerAddSkill(cid,SKILL__MAGLEVEL,15)
doPlayerAddSkill(cid,5,5)
doPlayerSetStorageValue(cid, 6014, 1)
selfSay('you completed the Task! you are an Elder Druid again and recieved bonus points on your skills', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 6 and getPlayerStorageValue(cid,6013) == 1) then
doPlayerSetVocation(cid, 5)
doPlayerAddSkill(cid,SKILL__MAGLEVEL,15)
doPlayerAddSkill(cid,5,5)
doPlayerSetStorageValue(cid, 6014, 1)
selfSay('you completed the Task! you are a Master Sorcerer again and recieved bonus points on your skills', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
end
--------------------------------------
if (msgcontains(msg, 'reborn') or msgcontains(msg, 'task') or msgcontains(msg, 'rebirth') and getPlayerStorageValue(cid,6014) == 1) then
selfSay('You already completed this Task! Leave something for the Noobs!', cid)
end
--------------------------------------
if msgcontains(msg, 'quest') then
selfSay('Only promoted vocations are allowed on this quest, also, this quest is for level 150, ARE YOU READY?', cid)
talkState[talkUser] = 7
if(msgcontains(msg, 'yes') and talkState[talkUser] == 7 and getPlayerVocation(cid) >= 5 and getPlayerLevel(cid) >= 150) then
doPlayerSetStorageValue(cid, 6015, 1)
selfSay('Some time ago I lost a valuable item of mine, If you can return it to me I will compensate you!, pssst! This is a little secret, but some statues serve as teleports, take a look at the Angel Statue at the top of the temple', cid)
talkState[talkUser] = 0
elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 7 and getPlayerLevel(cid) >= 150 and getPlayerVocation(cid) < 5) then
selfSay('You need to be promoted to start this quest', cid)
talkState[talkUser] = 0
elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 7 and getPlayerLevel(cid) < 150 and getPlayerVocation(cid) >= 5) then
selfSay('You need level 150 for this quest', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
end
--------------------------------------
if msgcontains(msg, 'brooch') then
selfSay('Oh, do you found my lost brooch?', cid)
talkState[talkUser] = 8
if(msgcontains(msg, 'yes') and talkState[talkUser] == 8 and getPlayerStorageValue(cid,6016) == 1 and getPlayerItemCount(cid, 10140) >= 1)then
if (getPlayerSex(cid) == 0 and getPlayerStorageValue(cid,6017) == -1) then
doPlayerRemoveItem(cid, 10140, 1)
doPlayerAddOutfit(cid, 370, 1)
doPlayerAddOutfit(cid, 376, 1)
doPlayerAddOutfit(cid, 377, 1)
doPlayerAddOutfit(cid, 378, 1)
doPlayerAddOutfit(cid, 379, 1)
doPlayerAddOutfit(cid, 380, 1)
doPlayerAddOutfit(cid, 382, 1)
doPlayerSetStorageValue(cid, 6017, 1)
selfSay('thank you so much, to compensate your good will I will gift you some fabulous outfits, check your outfit window!', cid)
talkState[talkUser] = 0
elseif (getPlayerSex(cid) == 1 and getPlayerStorageValue(cid,6018) == -1) then
doPlayerRemoveItem(cid, 10140, 1)
doPlayerAddOutfit(cid, 371, 1)
doPlayerAddOutfit(cid, 372, 1)
doPlayerAddOutfit(cid, 373, 1)
doPlayerAddOutfit(cid, 374, 1)
doPlayerAddOutfit(cid, 375, 1)
doPlayerAddOutfit(cid, 381, 1)
doPlayerSetStorageValue(cid, 6018, 1)
selfSay('thank you so much, to compensate your good will I will gift you some fabulous outfits, check your outfit window!', cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 8 and getPlayerStorageValue(cid,6016) == 1 and getPlayerItemCount(cid, 10140) < 1)then
selfSay('looks like you completed the quest, but you need to bring me the brooch since I have a gift for you!', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 8 and getPlayerStorageValue(cid,6016) == -1 and getPlayerItemCount(cid, 10140) >= 1)then
selfSay('looks like you didnt completed the quest, ask me for the quest and I will give you the information!', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 8 and getPlayerStorageValue(cid, 6017) == 1 and getPlayerSex(cid) == 0) then
selfSay('My lady, you already gave me my lost brooch, do you remember, right?', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 8 and getPlayerStorageValue(cid, 6018) == 1 and getPlayerSex(cid) == 1) then
selfSay('My man, you already gave me my lost brooch, do you remember, right?', cid)
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
end
--------------------------------------
--------------------------------------
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Attachments
-
RebornTask.lua12.3 KB · Views: 0 · VirusTotal