if msgcontains(msg,'spells') then
if getPlayerVocation == 1 or getPlayerVocation == 5 then
selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.')
elseif getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.')
elseif getPlayerVocation == 3 or getPlayerVocation == 7 then
selfSay('I can teach you spells for level 9, 12 and 23.')
elseif getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you spells for level 9, 12, 14, 15, 30 and 35.')
end
if msgcontains(msg,'9') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 or getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, magic rope.')
elseif msgcontains(msg,'12') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you, levitate and energy strike.')
elseif msgcontains(msg,'13') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you, terra strike.')
elseif msgcontains(msg,'14') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you, haste and flame strike.')
elseif msgcontains(msg,'15') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you, ice strike.')
elseif msgcontains(msg,'16') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you, death strike.')
elseif msgcontains(msg,'12') then
if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, levitate.')
elseif msgcontains(msg,'14') then
if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, haste.')
elseif msgcontains(msg,'23') then
if getPlayerVocation == 3 or getPlayerVocation == 7 then
selfSay('I can teach you, ethereal spear.')
elseif msgcontains(msg,'15') then
if getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, whirlwind throw.')
elseif msgcontains(msg,'30') then
if getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, wound cleansing.')
elseif msgcontains(msg,'35') then
if getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, berserk.')
end
end
I have a question.
Will a script added like this work?
Code:if msgcontains(msg,'spells') then if getPlayerVocation == 1 or getPlayerVocation == 5 then selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.') elseif getPlayerVocation == 2 or getPlayerVocation == 6 then selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.') elseif getPlayerVocation == 3 or getPlayerVocation == 7 then selfSay('I can teach you spells for level 9, 12 and 23.') elseif getPlayerVocation == 4 or getPlayerVocation == 8 then selfSay('I can teach you spells for level 9, 12, 14, 15, 30 and 35.') end if msgcontains(msg,'9') then if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 or getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then selfSay('I can teach you, magic rope.') elseif msgcontains(msg,'12') then if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then selfSay('I can teach you, levitate and energy strike.') elseif msgcontains(msg,'13') then if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then selfSay('I can teach you, terra strike.') elseif msgcontains(msg,'14') then if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then selfSay('I can teach you, haste and flame strike.') elseif msgcontains(msg,'15') then if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then selfSay('I can teach you, ice strike.') elseif msgcontains(msg,'16') then if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then selfSay('I can teach you, death strike.') elseif msgcontains(msg,'12') then if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then selfSay('I can teach you, levitate.') elseif msgcontains(msg,'14') then if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then selfSay('I can teach you, haste.') elseif msgcontains(msg,'23') then if getPlayerVocation == 3 or getPlayerVocation == 7 then selfSay('I can teach you, ethereal spear.') elseif msgcontains(msg,'15') then if getPlayerVocation == 4 or getPlayerVocation == 8 then selfSay('I can teach you, whirlwind throw.') elseif msgcontains(msg,'30') then if getPlayerVocation == 4 or getPlayerVocation == 8 then selfSay('I can teach you, wound cleansing.') elseif msgcontains(msg,'35') then if getPlayerVocation == 4 or getPlayerVocation == 8 then selfSay('I can teach you, berserk.') end end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg,'spells') then
if getPlayerVocation == 1 or getPlayerVocation == 5 then
selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.')
elseif getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you spells for level 9, 12, 13, 14, 15 and 16.')
elseif getPlayerVocation == 3 or getPlayerVocation == 7 then
selfSay('I can teach you spells for level 9, 12 and 23.')
elseif getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you spells for level 9, 12, 14, 15, 30 and 35.')
end
elseif msgcontains(msg,'9') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 or getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, magic rope.')
end
elseif msgcontains(msg,'12') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you, levitate and energy strike.')
end
elseif msgcontains(msg,'13') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you, terra strike.')
end
elseif msgcontains(msg,'14') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you, haste and flame strike.')
end
elseif msgcontains(msg,'15') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you, ice strike.')
end
elseif msgcontains(msg,'16') then
if getPlayerVocation == 1 or getPlayerVocation == 5 or getPlayerVocation == 2 or getPlayerVocation == 6 then
selfSay('I can teach you, death strike.')
end
elseif msgcontains(msg,'12') then
if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, levitate.')
end
elseif msgcontains(msg,'14') then
if getPlayerVocation == 3 or getPlayerVocation == 7 or getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, haste.')
end
elseif msgcontains(msg,'23') then
if getPlayerVocation == 3 or getPlayerVocation == 7 then
selfSay('I can teach you, ethereal spear.')
end
elseif msgcontains(msg,'15') then
if getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, whirlwind throw.')
elseif msgcontains(msg,'30') then
if getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, wound cleansing.')
end
elseif msgcontains(msg,'35') then
if getPlayerVocation == 4 or getPlayerVocation == 8 then
selfSay('I can teach you, berserk.')
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())