• 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!

Lua How to stay bless+ prevent items loss?

CipsoftStinks

www.relicaria.com
Joined
Oct 1, 2016
Messages
947
Solutions
3
Reaction score
137
Location
Argentina
Hello

my ot server distrution is otx 2 7.72 (i know it doesnt come with twist of fate in sources)
but i tried adding it editing player.cpp appart from this file i have to edit others?
someone guide me pls
I use a mod that give me the five blessings and im protected against lvl/skill loss
but i need to avoid lose my items too(backpack mostly always drop)
it's possible that i have something wrong , configured?
there is a way that someone can edit the mod that im using?

my bless mod:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="bless-system" version="1.0" author="slawkens" contact="[email protected]" enabled="yes">
        <description><![CDATA[
                This modification adds two new commands: !bless and !blesscheck.
                Also, action script is included (it uses unique id 32001 - can be used with items).
        ]]></description>
        <config name="bless-system-config"><![CDATA[
                blessSystem = {}
                blessSystem.config = {
                        baseCost = 2000,
                        levelCost = 200,
                        startLevel = 8,
                        endLevel = 120
                }
                blessSystem.needPremium = getBooleanFromString(getConfigValue('blessingsOnlyPremium'))
        ]]></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_HOLYDAMAGE)
                        return true
                end
        ]]></lib>
        <talkaction words="!blesscheck;!blesstest" event="script"><![CDATA[
                domodlib('bless-system-config')
                local blessNames = {"Wisdom of solitude", "Embrace of tibia", "Fire of the suns", "Spiritual Shielding", "Spark of the phoenix"}
                function onSay(cid, words, param)
                        local str = ""
                        local b = 0
                        for i = 1, 5 do
                                if(getPlayerBlessing(cid, i)) then
                                        if(b ~= 0) then
                                                str = str .. ", "
                                        end
                                        str = str .. blessNames[i]
                                        b = b + 1
                                end
                        end
                        if(b > 0) then
                                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have " .. str .. " blessing" .. (b > 0 and "s" or "") .. ". (Total: " .. b .. ")")
                        else
                                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have any blessings.")
                        end
                        return TRUE
                end
        ]]></talkaction>
        <talkaction words="!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>
        <action uniqueid="32001" event="script"><![CDATA[
                domodlib('bless-system-config')
                domodlib('bless-system-lib')
                function onUse(cid, item, fromPosition, itemEx, toPosition)
                        blessSystem.buyAllBlessings(cid)
                        return true
                end
        ]]></action>
</mod>

Here is my config lua:
Lua:
blessings = true
blessingOnlyPremium = false
blessingReductionBase = 30
blessingReductionDecrement = 5
eachBlessReduction = 8
useFairfightReduction = true
pvpBlessingThreshold = 40
fairFightTimeRange = 60

my vocations.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<vocations>
    <vocation id="0" clientId="0" name="None" description="none" needpremium="0" gaincap="10" gainhp="5" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="4.0" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="0" attackable="no" droploot="no">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="0.5" club="0.5" sword="0.5" axe="0.5" distance="0.5" shielding="0.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="1" clientId="3" name="Sorcerer" description="a sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="8" gainhpamount="2" gainmanaticks="1" gainmanaamount="4" manamultiplier="1.1" attackspeed="2000" soulmax="100" gainsoulticks="30" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="0.8" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="2" clientId="4" name="Druid" description="a druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="8" gainhpamount="2" gainmanaticks="1" gainmanaamount="4" manamultiplier="1.1" attackspeed="2000" soulmax="100" gainsoulticks="30" fromvoc="2">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="3" clientId="2" name="Paladin" description="a paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="4" gainhpamount="2" gainmanaticks="2" gainmanaamount="3" manamultiplier="1.4" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="3">
        <formula meleeDamage="1.0" distDamage="1.3" wandDamage="1.0" magDamage="0.8" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.2" club="1.4" sword="1.4" axe="1.4" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="4" clientId="1" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="2" gainmanaticks="2" gainmanaamount="3" manamultiplier="3.0" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="4">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="5" clientId="3" name="Master Sorcerer" description="a master sorcerer" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="6" gainhpamount="3" gainmanaticks="1" gainmanaamount="8" manamultiplier="1.1" attackspeed="2000" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="30">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="6" clientId="4" name="Elder Druid" description="an elder druid" needpremium="1" gaincap="10" gainhp="5" gainmana="30" gainhpticks="6" gainhpamount="3" gainmanaticks="1" gainmanaamount="8" manamultiplier="1.1" attackspeed="2000" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="30">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="7" clientId="2" name="Royal Paladin" description="a royal paladin" needpremium="1" gaincap="20" gainhp="10" gainmana="15" gainhpticks="2" gainhpamount="3" gainmanaticks="1" gainmanaamount="6" manamultiplier="1.4" attackspeed="2000" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="30">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.2" club="1.4" sword="1.4" axe="1.4" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
    <vocation id="8" clientId="1" name="Elite Knight" description="an elite knight" needpremium="1" gaincap="25" gainhp="15" gainmana="5" gainhpticks="1" gainhpamount="5" gainmanaticks="1" gainmanaamount="2" manamultiplier="3.0" attackspeed="2000" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30">
        <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
        <skill fist="1.0" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
    </vocation>
</vocations>
 
Last edited:
Are you sure it's the script that is executed with those talkaction words?
The script adds 5 blessings (since you didn't follow the rules and specify your TFS version I have no ide if you got twisted fate or not) but that dosn't matter.
It's either a bug in your TFS (I think there was one in the older 0.2 / 0.3 that happend randomly, no ide if someone has found the bug).

Add a print to the script to see if it's even executed, if it is then it's something in your source related to the death function in your Player class.
 
Hello @WibbenZ

YES my distro is otx 2 based on tfs 0.3.7
im using 7.72 i know my distribution doesnt come with twist of fate o bless preventiion drop items
so i edited player.cpp and took bless system froma version that supposed to be with the feature that im looking for twist of fate bless or something similar but maybe i added it wrong? appart of player.cpp to add twist of fate bless i have to edit other source file?


pd: edited first post ..

and im pretty sure that this is the scrip simce is the only one in my mods and have nothing related to blessings in talkactions
regards thanks for your reply
 
Hello @WibbenZ

YES my distro is otx 2 based on tfs 0.3.7
im using 7.72 i know my distribution doesnt come with twist of fate o bless preventiion drop items
so i edited player.cpp and took bless system froma version that supposed to be with the feature that im looking for twist of fate bless or something similar but maybe i added it wrong? appart of player.cpp to add twist of fate bless i have to edit other source file?


pd: edited first post ..

and im pretty sure that this is the scrip simce is the only one in my mods and have nothing related to blessings in talkactions
regards thanks for your reply

Well try to revert those changes first to see if that fixes it, or even better did it work before you did that change?
If it did you found the problem, just revert it and check the code / post the code to get help here.

Well a mod is multiple scripts bundled in one script, in this case 2 talkactions script and 1 action script.
So check data/talkactions/talkactions.xml if you got anything there.
Or do as I said and add a print("test") to the mod file.
 
the pvp bless was not working im trying to add it
19:55 You already have all blessings.
19:55 You have Wisdom of solitude, Embrace of tibia, Fire of the suns, Spiritual Shielding, Spark of the phoenix blessings. (Total: 5)

like i said i edited player.cpp i have to edit something more?
im pretty sure that my script is working i place it in mod is the only script related to bless there are not others in talkactions
just the main one in mods
 
Back
Top