someone can help me for add verification for buy all bless,
something that only add ones that are missing
TFS 1.2
BUMP
something that only add ones that are missing
TFS 1.2
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local player = Player(cid)
local cost = (2000 + ((math.min(130, player:getLevel(cid)) - 30) * 200))
--
if msgcontains(msg, "all") then
--if player:getBlessings() == 4 then
npcHandler:say("Would you like to receive that protection for a sacrifice of "..cost.." gold, child?", cid)
npcHandler.topic[cid] = 11
elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 11 then
if(player:removeMoney(cost)) then
for b = 1,6 do
player:addBlessing(b, 1)
npcHandler:say(19, "You have been blessed by the gods!", cid)
player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
end
else
selfSay("You need "..cost.." gold coins to buy all blessings.", cid)
end
--else
selfSay("You have already been blessed by the gods.", cid)
-- end
end
--
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
BUMP
Last edited by a moderator: