potinho
Advanced OT User
Hello everyone, everything good?
I have a bless system on my server that works normally (by talkaction). I would like to put in an improved system of blessing, where the original would stay and put another one, which would lower the death penalties. It's possible? Could you help me create it? If possible I would like to place it on an NPC.
My original bless MOD:
I have a bless system on my server that works normally (by talkaction). I would like to put in an improved system of blessing, where the original would stay and put another one, which would lower the death penalties. It's possible? Could you help me create it? If possible I would like to place it on an NPC.
My original bless MOD:
XML:
<config name="bless-system-config"><![CDATA[
blessSystem = {}
blessSystem.needPremium = getBooleanFromString(getConfigValue('blessingsOnlyPremium'))
blessSystem.config = {
baseCost = 2000,
levelCost = 200,
startLevel = 30,
endLevel = 120
}
]]></config>
<lib name="bless-system-lib"><![CDATA[
domodlib('bless-system-config')
function blessSystem.buyAllBlessings(cid)
local price = blessSystem.config.baseCost
if(getPlayerLevel(cid) > blessSystem.config.startLevel) then
price = (price + ((math.min(blessSystem.config.endLevel, getPlayerLevel(cid)) - blessSystem.config.startLevel) * blessSystem.config.levelCost))
end
price = price * 5 * 1.2
if(blessSystem.needPremium and not isPremium(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need a premium account to use blessings.")
return false
end
for i = 1, 5 do
if(getPlayerBlessing(cid, i)) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already have all blessings.")
return false
end
end
if(not doPlayerRemoveMoney(cid, price)) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have enough money for blessings. (You need " .. price .. " gp's)")
return false
end
for i = 1, 5 do
doPlayerAddBlessing(cid, i)
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have been blessed by the gods!")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_BIGCLOUDS)
return true
end
]]></lib>
<talkaction words="!blesscheck;!blesstest" event="script"><![CDATA[
domodlib('bless-system-config')
local BLESSINGS = {"Wisdom of Solitude", "Spark of the Phoenix", "Fire of the Suns", "Spiritual Shielding", "Embrace of Tibia"}
function onSay(cid, words, param)
local result = ""
for i = 1, (table.maxn(BLESSINGS) - 1) do
result = (getPlayerBlessing(cid, i) and result .. (result:len() > 0 and ", " or "") .. BLESSINGS[i] or result)
end
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, result:len() > 0 and "Currently you have the following blessings: " .. result .. "." or "You do not have any blessing.")
end
]]></talkaction>
<talkaction words="!bless;/bless" event="script"><![CDATA[
domodlib('bless-system-config')
domodlib('bless-system-lib')
function onSay(cid, words, param, channel)
blessSystem.buyAllBlessings(cid)
return true
end
]]></talkaction>