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)
if(not npcHandler:isFocused(cid)) then
return false
end
local cost = 10
local lvl = 20
if msgcontains(msg, 'epic promotion') then
if getPlayerItemCount(cid, 2160) >= cost then
if getPlayerLevel(cid) >= lvl then
if getPlayerPromotionLevel(cid) == 1 then
selfSay('Do you want to be promoted to epic ?')
talk_state = 1
else
selfSay('You must be promoted.')
end
else
selfSay('You must have level ".. lvl .." or higher')
end
else
selfSay('You have to pay ".. cost .." crystal coins.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid, 2160) >= cost then
if doPlayerRemoveItem(cid, 2160, cost) == TRUE then
selfSay('You are now promoted to epic.')
end
else
selfSay('You don\'t have money.')
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
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)
if(not npcHandler:isFocused(cid)) then
return false
end
config = {
lvl = 20
}
if msgcontains(msg, 'epic promotion') then
if getPlayerItemCount(cid, 5920) >= 30 and getPlayerItemCount(cid, 5879) >= 50 and getPlayerItemCount(cid, 5893) >= 10 then
if getPlayerLevel(cid) >= lvl then
if getPlayerPromotionLevel(cid) == 1 then
selfSay('Do you want to be promoted to epic ?')
talk_state = 1
else
selfSay('You must be promoted.')
end
else
selfSay('You must have level ".. config.lvl .." or higher')
end
else
selfSay('I need 30 green dragon scales, 50 giant spider silks and 10 perfect behemoth fangs to promote you.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid, 5920) >= 30 and getPlayerItemCount(cid, 5879) >= 50 and getPlayerItemCount(cid, 5893) >= 10 then
if doPlayerRemoveItem(cid, 5920, 30) == TRUE and doPlayerRemoveItem(cid, 5879, 50) == TRUE and doPlayerRemoveItem(cid, 5893, 10) == TRUE then
selfSay('You are now promoted to epic.')
end
else
selfSay('You don\'t have money.')
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Proe" script="data/npc/scripts/promotion.lua" walkinterval="1" floorchange="0">
<health now="100" max="100"/>
<look type="133" head="20" body="39" legs="45" feet="7" addons="0"/>
</npc>
[30/04/2010 17:17:26] [Error - LuaScriptInterface::loadFile] data/npc/scripts/promotion.lua:16: unexpected symbol near 'local'
[30/04/2010 17:17:26] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/promotion.lua
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)
if(not npcHandler:isFocused(cid)) then
return false
end
config = {
lvl = 20
}
if msgcontains(msg, 'epic promotion') then
if getPlayerItemCount(cid, 5920) >= 30 and getPlayerItemCount(cid, 5879) >= 50 and getPlayerItemCount(cid, 5893) >= 10 then
if getPlayerLevel(cid) >= lvl then
if getPlayerPromotionLevel(cid) == 1 then
selfSay('Do you want to be promoted to epic ?')
talk_state = 1
else
selfSay('You must be promoted.')
end
else
selfSay('You must have level ".. config.lvl .." or higher')
end
else
selfSay('I need 30 green dragon scales, 50 giant spider silks and 10 perfect behemoth fangs to promote you.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid, 5920) >= 30 and getPlayerItemCount(cid, 5879) >= 50 and getPlayerItemCount(cid, 5893) >= 10 then
if doPlayerRemoveItem(cid, 5920, 30) == TRUE and doPlayerRemoveItem(cid, 5879, 50) == TRUE and doPlayerRemoveItem(cid, 5893, 10) == TRUE then
selfSay('You are now promoted to epic.')
end
else
selfSay('You don\'t have money.')
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
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)
if(not npcHandler:isFocused(cid)) then
return false
end
local lvl = 20
if msgcontains(msg, 'epic promotion') then
if getPlayerItemCount(cid, 5920) >= 30 and getPlayerItemCount(cid, 5879) >= 50 and getPlayerItemCount(cid, 5893) >= 10 then
if getPlayerLevel(cid) >= lvl then
if getPlayerPromotionLevel(cid) == 1 then
selfSay('Do you want to be promoted to epic ?')
talk_state = 1
else
selfSay('You must be promoted.')
end
else
selfSay('You must have level 20 or higher')
end
else
selfSay('I need 30 green dragon scales, 50 giant spider silks and 10 perfect behemoth fangs to promote you.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid, 5920) >= 30 and getPlayerItemCount(cid, 5879) >= 50 and getPlayerItemCount(cid, 5893) >= 10 then
if doPlayerRemoveItem(cid, 5920, 30) == TRUE and doPlayerRemoveItem(cid, 5879, 50) == TRUE and doPlayerRemoveItem(cid, 5893, 10) == TRUE then
selfSay('You are now promoted to epic.')
end
else
selfSay('You don\'t have money.')
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.')
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())