- Joined
- Aug 19, 2007
- Messages
- 4,940
- Solutions
- 11
- Reaction score
- 354
Since someone needed it, I'll put it here too.
It is set to take from player 100 iron ores for promotion you can simply change it by changing doPlayerTakeItem(cid, ID, COUNT) and add more by adding after the first one and doPlayerTakeItem(cid, ID, COUNT) == 0.
It will allow to buy promotion for premium players above lvl 20 or equal to it.
Here it is:
It is set to take from player 100 iron ores for promotion you can simply change it by changing doPlayerTakeItem(cid, ID, COUNT) and add more by adding after the first one and doPlayerTakeItem(cid, ID, COUNT) == 0.
It will allow to buy promotion for premium players above lvl 20 or equal to it.
Here it is:
PHP:
--------------------------------------------------------------------------------------------
---------------------------------- Advanced Promotion NPC ----------------------------------
---------------------------------- Script made by Sinner -----------------------------------
--------------------------------------------------------------------------------------------
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, '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 buy promotion for 100 iron ores?')
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, 'yes') and talk_state == 1 and voc == 1 then
if doPlayerTakeItem(cid, 5880, 100) == 0 then
selfSay('You are now promoted to Master Sorcerer!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
doPlayerSetVocation(cid, 5)
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 == 1 and voc == 2 then
if doPlayerTakeItem(cid, 5880, 100) == 0 then
selfSay('You are now promoted to Elder Druid!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
doPlayerSetVocation(cid, 6)
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 == 1 and voc == 3 then
if doPlayerTakeItem(cid, 5880, 100) == 0 then
selfSay('You are now promoted to Royal Paladin!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
doPlayerSetVocation(cid, 7)
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 == 1 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())