Sean Larson
New Member
--------------------------------------------------------------------------------------------
-----------------------------------Advanced Promotion NPC ---------------------------------
-------------------------------- 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 Ninja or Warrior?')
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, 'Warrior') and talk_state == 1 and voc == 4 then
if getPlayerItemCount(cid,5878) >= 25 and getPlayerItemCount(cid,5883) >= 10 then
selfSay('Did you bring me 25 minotaur leather and 10 ape fur?')
talk_state = 2
else
selfSay('I need 25 minotaur leather and 10 ape fur to prove your worthy. Come back when you have them.')
talk_state = 0
end
elseif msgcontains(msg, 'Ninja') and talk_state == 1 and voc == 4 then
if getPlayerItemCount(cid,5896) >= 20 and getPlayerItemCount(cid,5897) >= 20 and getPlayerItemCount(cid,5902) >= 20 then
selfSay('Did you bring me 20 wolf paws, 20 bear paws and 20 honeycomb?')
talk_state = 3
else
selfSay('I need 20 wolf paws, 20 bear paws and 20 honeycomb, to prove your worthy. Come back when you have them.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 and voc == 4 then
if doPlayerTakeItem(cid,5878,25) == 0 and doPlayerTakeItem(cid,5883,10) == 0 then
selfSay('You are worthy of being called a Warrior!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
doPlayerSetVocation(cid, 12)
setPlayerStorageValue(cid, 12345, 1)
else
selfSay('Bring me 25 minotaur leather and 10 ape fur to get promoted.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 and voc == 4 then
if doPlayerTakeItem(cid,5897,20) == 0 and doPlayerTakeItem(cid,5902,20) == 0 and doPlayerTakeItem(cid,5896,20) == 0 then
selfSay('You have learned the way of the Ninja!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
doPlayerSetVocation(cid, 8)
setPlayerStorageValue(cid, 12345, 1)
else
selfSay('Bring me 20 honeycomb 20 wolf paws and 20 bear paws to be 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())
and king sean
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Sean" script="data/npc/scripts/knight promotion.lua" autowalk="0" floorchange="0">
<health now="100" max="100"/>
<look type="266" head="20" body="39" legs="45" feet="7"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME| are you ready to get your promotion?"/>
</parameters>
</npc>
now as im sure you have noticed it is only for 1 vocations which is knights, i have 3 others for the other vocations but i figure now that you guys have a good template you can make those your own
-----------------------------------Advanced Promotion NPC ---------------------------------
-------------------------------- 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

function onCreatureDisappear(cid) npcHandler

function onCreatureSay(cid, type, msg) npcHandler

function onThink() npcHandler

-- 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 Ninja or Warrior?')
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, 'Warrior') and talk_state == 1 and voc == 4 then
if getPlayerItemCount(cid,5878) >= 25 and getPlayerItemCount(cid,5883) >= 10 then
selfSay('Did you bring me 25 minotaur leather and 10 ape fur?')
talk_state = 2
else
selfSay('I need 25 minotaur leather and 10 ape fur to prove your worthy. Come back when you have them.')
talk_state = 0
end
elseif msgcontains(msg, 'Ninja') and talk_state == 1 and voc == 4 then
if getPlayerItemCount(cid,5896) >= 20 and getPlayerItemCount(cid,5897) >= 20 and getPlayerItemCount(cid,5902) >= 20 then
selfSay('Did you bring me 20 wolf paws, 20 bear paws and 20 honeycomb?')
talk_state = 3
else
selfSay('I need 20 wolf paws, 20 bear paws and 20 honeycomb, to prove your worthy. Come back when you have them.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 and voc == 4 then
if doPlayerTakeItem(cid,5878,25) == 0 and doPlayerTakeItem(cid,5883,10) == 0 then
selfSay('You are worthy of being called a Warrior!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
doPlayerSetVocation(cid, 12)
setPlayerStorageValue(cid, 12345, 1)
else
selfSay('Bring me 25 minotaur leather and 10 ape fur to get promoted.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 and voc == 4 then
if doPlayerTakeItem(cid,5897,20) == 0 and doPlayerTakeItem(cid,5902,20) == 0 and doPlayerTakeItem(cid,5896,20) == 0 then
selfSay('You have learned the way of the Ninja!')
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_GREEN)
doPlayerSetVocation(cid, 8)
setPlayerStorageValue(cid, 12345, 1)
else
selfSay('Bring me 20 honeycomb 20 wolf paws and 20 bear paws to be 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())
and king sean
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Sean" script="data/npc/scripts/knight promotion.lua" autowalk="0" floorchange="0">
<health now="100" max="100"/>
<look type="266" head="20" body="39" legs="45" feet="7"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME| are you ready to get your promotion?"/>
</parameters>
</npc>
now as im sure you have noticed it is only for 1 vocations which is knights, i have 3 others for the other vocations but i figure now that you guys have a good template you can make those your own
Last edited: