--------------------------------------------------------------------------------------------
---------------------------- Advanced Promotion NPC for fokuleh ----------------------------
-------------------------------- Script made by Sean Larson --------------------------------
--------------------------------------------------------------------------------------------
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler

nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler

nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler

nCreatureSay(cid, type, msg) end
function onThink() npcHandler

nThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg, 'promotion') then
if isPremium(cid) == TRUE then
if getPlayerLevel(cid) >= 20 then
voc = getPlayerVocation(cid)
prom = getPlayerStorageValue(cid, 12345)
if prom == -1 then
selfSay('Do you want to promote to ELite knight or crappy knight?')
talk_state = 1
else
selfSay('You are already promoted.')
talk_state = 0
end
else
selfSay('Only characters of level 20 can become promoted.')
talk_state = 0
end
else
selfSay('Only premium account players can become promoted.')
talk_state = 0
end
elseif msgcontains(msg, 'crappy knight') and talk_state == 1 and voc == 4 then
selfSay('You are Sure you want to be a crappy knight!')
talk_state = 2
end
elseif msgcontains(msg, 'Elite knight') and talk_state == 1 and voc == 4 then
selfSay('You are Sure you want to be an Elite knight!')
talk_state = 3
end
elseif msgcontains(msg, 'yes') and talk_state == 2 and voc == 4 then
if doPlayerTakeItem(cid, 5880, 100) == 0 then
selfSay('You are now promoted to Crappy knight!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
doPlayerSetVocation(cid, 9)
setPlayerStorageValue(cid, 12345, 1)
else
selfSay('Bring me 100 iron ores to get promoted.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 and voc == 4 then
if doPlayerTakeItem(cid, 5880, 100) == 0 then
selfSay('You are now promoted to Elite Knight!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
doPlayerSetVocation(cid, 8)
setPlayerStorageValue(cid, 12345, 1)
else
selfSay('Bring me 100 iron ores to get promoted.')
talk_state = 0
end
elseif msgcontains(msg, 'no') and talk_state == 1 then
selfSay('Maybe another time.')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Something like this should work, I have not tested it but in theory it would work just fine, please note this is set up for a quest promotion guy not a payment guy. Also note it is only for knights, you will have to add on to it for the other vocations i was just using it as an exaple.
Credits: I can not take all credit for this, I modified someone elses quest promo scipt and made it into a multi selections script but i cant remember his name so sorry =\
You will also need to make a new vocations if you notice i used vocations 8 and 9 in the example 9=crappy knight