Funçao Avançada
Necessita NPC Jiddo system
NPC's Bless Created 100% By Me:
Aqui em casa naum funciono perfeitamente pq eu axo q a funçao getPlayerBlessing esta com problemas.
Mas porque esta com problemas?
bom, o comando getPlayerBlessing verifica se o player ja tem uma determinada bless para depois ele vende ou não para o comprador, e no caso quando vc vai compra ele fala direto que vc ja tem sem vc ter comprado alguma vez, mas quando eu mostrei pro xidaozu ele disse que estava ótimo, portando isto talvez deverá algum problema nesta função.
Enfim, peço se este problema acontece com vcs, que retire a função:
if getPlayerBlessing(cid,1) == 0 then do script
nos outros npc's para vc n ter duvida a funçoes saum as msm so q elas mudam de acordo com a bless, ali no caso esta (cid,1), pois ele ira verifica se vc tem a bless 1. Mas voltando a parte de retira a funçao, depois q vc retira-la retire tbm:
else
selfSay('Sorry, you already have this blessing.')
end
NPC 1
----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- ----------------------------------- Npc of Bless ---------------------------------- ---------------------------- Credits 100% by Arcavier ----------------------------- ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- 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, 'bless') then selfSay('I sell the \"Spiritual Shielding\" Blessing.') ------------------------------------------------ bless ------------------------------------------------ elseif msgcontains(msg, 'Spiritual Shielding') or msgcontains(msg, 'spiritual shielding') then if isPremium(cid) then selfSay('Do you want to buy the Spiritual Shielding Blessing for 20k?') talk_state = 1 else selfSay('Sorry, you need a premium account to get bless.') talk_state = 0 end ------------------------------------------------ confirm yes ------------------------------------------------ elseif msgcontains(msg, 'yes') and talk_state == 1 then talk_state = 0 if getPlayerBlessing(cid,1) == 0 then if doPlayerRemoveMoney(cid,20000) == 1 then selfSay('Now the gods blessed you.') doPlayerAddBlessing(cid,1) else selfSay('Sorry, you dont have enough money.') end else selfSay('Sorry, you already have this blessing.') end ------------------------------------------------ confirm no ------------------------------------------------ elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 2) then selfSay('Ok then.') talk_state = 0 end -- 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. return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
NPC 2
----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- ----------------------------------- Npc of Bless ---------------------------------- ---------------------------- Credits 100% by Arcavier ----------------------------- ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- 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, 'bless') then selfSay('I sell the \"Spark of the Phoenix\" blessing.') ------------------------------------------------ bless ------------------------------------------------ elseif msgcontains(msg, 'Spark of the Phoenix') or msgcontains(msg, 'spark of the phoenix') then if isPremium(cid) then selfSay('Do you want to buy the Spark of the Phoenix Blessing for 20k?') talk_state = 1 else selfSay('Sorry, you need a premium account to get bless.') talk_state = 0 end ------------------------------------------------ confirm yes ------------------------------------------------ elseif msgcontains(msg, 'yes') and talk_state == 1 then talk_state = 0 if getPlayerBlessing(cid,2) == 0 then if doPlayerRemoveMoney(cid,20000) == 1 then selfSay('Now the gods blessed you.') doPlayerAddBlessing(cid,2) else selfSay('Sorry, you dont have enough money.') end else selfSay('Sorry, you already have this blessing.') end ------------------------------------------------ confirm no ------------------------------------------------ elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 2) then selfSay('Ok then.') talk_state = 0 end -- 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. return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
NPC 3
----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- ----------------------------------- Npc of Bless ---------------------------------- ---------------------------- Credits 100% by Arcavier ----------------------------- ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- 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, 'bless') then selfSay('I sell the \"Embrace of Tibia\" Blessing.') ------------------------------------------------ bless ------------------------------------------------ elseif msgcontains(msg, 'Embrace of Tibia') or msgcontains(msg, 'embrace of tibia') then if isPremium(cid) then selfSay('Do you want to buy the Embrace of Tibia Blessing for 20k?') talk_state = 1 else selfSay('Sorry, you need a premium account to get bless.') talk_state = 0 end ------------------------------------------------ confirm yes ------------------------------------------------ elseif msgcontains(msg, 'yes') and talk_state == 1 then talk_state = 0 if getPlayerBlessing(cid,3) == 0 then if doPlayerRemoveMoney(cid,20000) == 1 then selfSay('Now the gods blessed you.') doPlayerAddBlessing(cid,3) else selfSay('Sorry, you dont have enough money.') end else selfSay('Sorry, you already have this blessing.') end ------------------------------------------------ confirm no ------------------------------------------------ elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 2) then selfSay('Ok then.') talk_state = 0 end -- 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. return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
NPC 4
----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- ----------------------------------- Npc of Bless ---------------------------------- ---------------------------- Credits 100% by Arcavier ----------------------------- ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- 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, 'bless') then selfSay('I sell the \"Fire of the Suns\" Blessing.') ------------------------------------------------ bless ------------------------------------------------ elseif msgcontains(msg, 'Fire of the Suns') or msgcontains(msg, 'fire of the suns') then if isPremium(cid) then selfSay('Do you want to buy the Fire of the Suns Blessing for 20k?') talk_state = 1 else selfSay('Sorry, you need a premium account to get bless.') talk_state = 0 end ------------------------------------------------ confirm yes ------------------------------------------------ elseif msgcontains(msg, 'yes') and talk_state == 1 then talk_state = 0 if getPlayerBlessing(cid,4) == 0 then if doPlayerRemoveMoney(cid,20000) == 1 then selfSay('Now the gods blessed you.') doPlayerAddBlessing(cid,4) else selfSay('Sorry, you dont have enough money.') end else selfSay('Sorry, you already have this blessing.') end ------------------------------------------------ confirm no ------------------------------------------------ elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 2) then selfSay('Ok then.') talk_state = 0 end -- 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. return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
NPC 5
----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- ----------------------------------- Npc of Bless ---------------------------------- ---------------------------- Credits 100% by Arcavier ----------------------------- ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- 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, 'bless') then selfSay('I sell the \"Wisdom of Solitude\" Blessing.') ------------------------------------------------ bless ------------------------------------------------ elseif msgcontains(msg, 'Wisdom of Solitude') or msgcontains(msg, 'wisdom of solitude') then if isPremium(cid) then selfSay('Do you want to buy the Wisdom of Solitude Blessing for 20k?') talk_state = 1 else selfSay('Sorry, you need a premium account to get bless.') talk_state = 0 end ------------------------------------------------ confirm yes ------------------------------------------------ elseif msgcontains(msg, 'yes') and talk_state == 1 then talk_state = 0 if getPlayerBlessing(cid,5) == 0 then if doPlayerRemoveMoney(cid,20000) == 1 then selfSay('Now the gods blessed you.') doPlayerAddBlessing(cid,5) else selfSay('Sorry, you dont have enough money.') end else selfSay('Sorry, you already have this blessing.') end ------------------------------------------------ confirm no ------------------------------------------------ elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 2) then selfSay('Ok then.') talk_state = 0 end -- 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. return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())