• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ Bless work incorrect TFS 1.2

olekpro

Member
Joined
Nov 1, 2014
Messages
121
Reaction score
6
Hello.
Config.lua
(i added it manualy)
blessings = true
blessingOnlyPremium = true
blessingReductionBase = 99
blessingReductionDecrement = 99
eachBlessReduction = 99
talkactions/scripts/bless.lua
Lua:
function onSay(cid, words, param)
local bless = {1, 2, 3, 4, 5}
local cost = 50000 -- Cost in gp.
local maxlevel = 50000
local lvl = getPlayerLevel(cid)
local new_cost = (lvl * cost) / 500
local target = getPlayerGUID(cid)
if isPremium(cid) == false then
doPlayerSendCancel(cid, "You need to be premium at first")
return true
end
for i = 1, table.maxn(bless) do
                if(getPlayerBlessing(cid, bless[i])) then
                        doPlayerSendCancel(cid, "You have already have been blessed.")
                        return TRUE
                end
        end
if (getPlayerLevel(cid) >= maxlevel) then
if(doPlayerRemoveMoney(cid, new_cost) == TRUE) then
for i = 1, table.maxn(bless) do
doPlayerAddBlessing(cid, bless[i])
doPlayerSendTextMessage(cid,19,"You have successfully all Bless , now do not need aol.")
end
else
doPlayerSendTextMessage(cid,19,"You need to have "..new_cost.."gp to buy Blesss.")
end
elseif(getPlayerLevel(cid) < maxlevel) then
if(doPlayerRemoveMoney(cid, cost) == TRUE) then
for i = 1, table.maxn(bless) do
doPlayerAddBless(cid, bless[i])
end
doPlayerSendTextMessage(cid,19,"You have successfully been blessed.")

If player get level for example 1400, after dead he lose 4-6 levels, how to repair it? Should lose max 1 level in my opinion is it possible?
else
doPlayerSendTextMessage(cid,19,"You need to have "..cost.."gp to buy Blesss.")
end
end
return FALSE
end
 
Thats because you are using a script thats not compatible with TFS 1.2

Try this one:
Lua:
local bless = {1, 2, 3, 4, 5}
local cost = 50000 -- Cost in gp.

function onSay(player, words, param)
    if not player:isPremium() then
        player:sendCancelMessage("You need to have a premium account.")
        return true
    end
    for i = 1, table.maxn(bless) do
        if player:hasBlessing(bless[i]) then
            return player:sendCancelMessage("You already have all blessings.")
        end
    end

    if player:removeMoney(cost) then
        for i = 1, table.maxn(bless) do
            player:addBlessing(bless[i])
        end
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You have bought all blessings.")
        player:say("You have bought all blessings.",  TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    else
        player:sendCancelMessage("You don't have enough money.")
    end
    return true
end

Not tested though.
 
Thats because you are using a script thats not compatible with TFS 1.2

Try this one:
Lua:
local bless = {1, 2, 3, 4, 5}
local cost = 50000 -- Cost in gp.

function onSay(player, words, param)
    if not player:isPremium() then
        player:sendCancelMessage("You need to have a premium account.")
        return true
    end
    for i = 1, table.maxn(bless) do
        if player:hasBlessing(bless[i]) then
            return player:sendCancelMessage("You already have all blessings.")
        end
    end

    if player:removeMoney(cost) then
        for i = 1, table.maxn(bless) do
            player:addBlessing(bless[i])
        end
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You have bought all blessings.")
        player:say("You have bought all blessings.",  TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    else
        player:sendCancelMessage("You don't have enough money.")
    end
    return true
end

Not tested though.
not work, talkaction !bless don'tt work with it, 0 erros
Post automatically merged:

blessingOnlyPremium = false
blessingReductionBase = 30 => 0
blessingReductionDecreament = 5 => 0
eachBlessReduction = 8 =

still lose 4 levels at 840 level.
 
not work, talkaction !bless don'tt work with it, 0 erros
Post automatically merged:

blessingOnlyPremium = false
blessingReductionBase = 30 => 0
blessingReductionDecreament = 5 => 0
eachBlessReduction = 8 =

still lose 4 levels at 840 level.
You register command !bless? o_O
 
<talkaction words="!bless" script="bless.lua"/>


bless.Lua:

Lua:
function getCost(level)
    if level <= 30 then
        return 2000*5
    elseif level >= 120 then
        return 10000*5
    else
        return ((level - 20) * 200 * 5)
    end
end

function onSay(cid, words, param)
    local p = Player(cid)
    local cost = getCost(getPlayerLevel(cid))
    if(not(isPlayerPzLocked(cid))) then
        if(p:hasBlessing(1) and p:hasBlessing(2) and p:hasBlessing(3) and p:hasBlessing(4) and p:hasBlessing(5) and p:hasBlessing(6)) then
            p:sendCancelMessage("You have already been blessed by the gods.")
            return false
        end
        if(p:removeMoney(cost)) then
            for b = 1,6 do
                p:addBlessing(b)
            end
            p:getPosition():sendMagicEffect(39)
            p:sendTextMessage(19, "You have been blessed by the gods!")
        else
            p:sendCancelMessage("You need "..cost.." gold coins to buy all blessings.")
        end
    else
        p:sendCancelMessage("You can't buy bless, when you are in a battle.")
    end
return false
end

config.lua:
deathLosePercent = -1 (i tried 10 same effect)

blessing = true
blessingOnlyPremium = false
blessingReductionBase = 30
blessingReductionDecreament = 5
eachBlessReduction = 5
(i added it manualy to config)
 
Code:
function onSay(player, words, param)
local cost = (1000 + ((player:getLevel() * player:getLevel()) / 10)

        if(player:hasBlessing(1) and player:hasBlessing(2) and player:hasBlessing(3) and player:hasBlessing(4) and player:hasBlessing(5) and player:hasBlessing(6)) then
            player:sendCancelMessage("You have already been blessed by the gods.")
            return false
        end
        else (player:removeMoney(cost)) then
            for bless = 1,6 do
                player:addBlessing(bless)
            player:getPosition():sendMagicEffect(39)
            player:sendTextMessage(19, "You have been blessed by the gods!")
            end
        else
            player:sendCancelMessage("You need "..cost.." gold coins to buy all blessings.")
        end
return false
    end
Code:
deathLosePercent = 10

blessing = true
blessingOnlyPremium = false
blessingReductionBase = 30
blessingReductionDecreament = 5
eachBlessReduction = 2
 
Can not load script: scripts/bless.lua
data/talkactions/scripts/bless.lua:8: 'end' expected (to close 'function' at line 1) near 'else'
Post automatically merged:

i tried with my bless.lua script. still losing 5levels.
 
Last edited:
Just tested this on TFS 1.3 and totally works fine.
data/talkactions/scripts/bless.lua
Lua:
local bless = {1, 2, 3, 4, 5}
local cost = 50000 -- Cost in gp.

function onSay(player, words, param)
    for i = 1, table.maxn(bless) do
        if player:hasBlessing(bless[i]) then
            return player:sendTextMessage(MESSAGE_INFO_DESCR, "You already have all blessings.")
        end
    end

    if player:removeMoney(cost) then
        for i = 1, table.maxn(bless) do
            player:addBlessing(bless[i])
        end
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You have bought all blessings.")
        player:say("You have bought all blessings.",  TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You don't have enough money.")
    end
    return true
end

data/talkactions/talkactions.xml
XML:
<talkaction words="!bless" script="bless.lua" />
 
Just tested this on TFS 1.3 and totally works fine.
data/talkactions/scripts/bless.lua
Lua:
local bless = {1, 2, 3, 4, 5}
local cost = 50000 -- Cost in gp.

function onSay(player, words, param)
    for i = 1, table.maxn(bless) do
        if player:hasBlessing(bless[i]) then
            return player:sendTextMessage(MESSAGE_INFO_DESCR, "You already have all blessings.")
        end
    end

    if player:removeMoney(cost) then
        for i = 1, table.maxn(bless) do
            player:addBlessing(bless[i])
        end
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You have bought all blessings.")
        player:say("You have bought all blessings.",  TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW)
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You don't have enough money.")
    end
    return true
end

data/talkactions/talkactions.xml
XML:
<talkaction words="!bless" script="bless.lua" />
still losing 5 levels...


-- Deaths
-- NOTE: Leave deathLosePercent as -1 if you want to use the default
-- death penalty formula. For the old formula, set it to 10. For
-- no skill/experience loss, set it to 0.
deathLosePercent = 10


blessing = true
blessingOnlyPremium = false
blessingReductionBase = 30
blessingReductionDecreament = 5
eachBlessReduction = 2
Post automatically merged:

still losing 5 levels...


-- Deaths
-- NOTE: Leave deathLosePercent as -1 if you want to use the default
-- death penalty formula. For the old formula, set it to 10. For
-- no skill/experience loss, set it to 0.
deathLosePercent = 10


blessing = true
blessingOnlyPremium = false
blessingReductionBase = 30
blessingReductionDecreament = 5
eachBlessReduction = 2

TFS 1.2 Tibia 10.98 :(
 
blessing = true
blessingOnlyPremium = false
blessingReductionBase = 0
blessingReductionDecreament = 0
eachBlessReduction = 0
still lose 5 levels
Post automatically merged:

Maybe bless system isn't include into any players.cpp? I added it manualy into config.lua
This Bless* aren't in config.lua before.
 
Lua:
-- Combat settings
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"
worldType = "pvp-enforced"
hotkeyAimbotEnabled = true
protectionLevel = 90
killsToRedSkull = 20
killsToBlackSkull = 40
pzLocked = 5000
removeChargesFromRunes = false
timeToDecreaseFrags = 24 * 60 * 60 * 1000
whiteSkullTime = 3 * 7 * 1000
stairJumpExhaustion = 2000
experienceByKillingPlayers = true
expFromPlayersLevelRange = 300

-- Connection Config
-- NOTE: maxPlayers set to 0 means no limit
ip = "x"
bindOnlyGlobalAddress = false
loginProtocolPort = 7171
gameProtocolPort = 7172
statusProtocolPort = 7171
maxPlayers = 10
motd = "Welcome to The Forgotten Server!"
onePlayerOnlinePerAccount = true
allowClones = false
serverName = "x"
statusTimeout = 5000
replaceKickOnLogin = true
maxPacketsPerSecond = 150
classicAttackSpeed = true

-- Deaths
-- NOTE: Leave deathLosePercent as -1 if you want to use the default
-- death penalty formula. For the old formula, set it to 10. For
-- no skill/experience loss, set it to 0.
deathLosePercent = 10

-- Houses
-- NOTE: set housePriceEachSQM to -1 to disable the ingame buy house functionality
housePriceEachSQM = 1000
houseRentPeriod = "never"

-- Item Usage
timeBetweenActions = 200
timeBetweenExActions = 1000

-- Map
-- NOTE: set mapName WITHOUT .otbm at the end
mapName = "x"
mapAuthor = "x"

-- Market
marketOfferDuration = 30 * 24 * 60 * 60
premiumToCreateMarketOffer = true
checkExpiredMarketOffersEachMinutes = 60
maxMarketOffersAtATimePerPlayer = 100

-- MySQL
mysqlHost = "x"
mysqlUser = "x"
mysqlPass = "x"
mysqlDatabase = "x"
mysqlPort = "x"
mysqlSock = "x"
passwordType = "x"

-- Misc.
allowChangeOutfit = true
freePremium = false
kickIdlePlayerAfterMinutes = 180
maxMessageBuffer = 4
emoteSpells = true
classicEquipmentSlots = true

-- Rates
-- NOTE: rateExp is not used if you have enabled stages in data/XML/stages.xml
rateSkill = 50
rateLoot = 2
rateMagic = 3
rateSpawn = 25

-- Monsters
deSpawnRange = 2
deSpawnRadius = 50

-- Stamina
staminaSystem = true

blessing = true
blessingOnlyPremium = false
blessingReductionBase = 0
blessingReductionDecreament = 0
eachBlessReduction = 0

-- Scripts
warnUnsafeScripts = true
convertUnsafeScripts = true

-- Startup
-- NOTE: defaultPriority only works on Windows and sets process
-- priority, valid values are: "normal", "above-normal", "high"
defaultPriority = "high"
startupDatabaseOptimization = false

-- Status server information
ownerName = ""
ownerEmail = ""
url = "x"
location = "x"
my config.lua
Post automatically merged:

That's my sources. I downloaded it 2 weeks ago.
Post automatically merged:

When i'm buying bless that's work corret. Take money, i got message, i don't lose my items after dead...
 
Last edited:
Back
Top