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

C++ Healing Mana/Health appear very separate

Carlitos Flow

Developer (lvl*1)
Joined
Mar 2, 2011
Messages
156
Solutions
4
Reaction score
10
Good day, where i can fix this problem? Im using TFS 0.3.6
Kind regards, and thanks.
ffbnma.png


My Game.cpp
Code:
bool Game::combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target, int32_t healthChange,
    MagicEffect_t hitEffect/* = MAGIC_EFFECT_UNKNOWN*/, TextColor_t hitColor/* = TEXTCOLOR_UNKNOWN*/, bool force/* = false*/)
{
    const Position& targetPos = target->getPosition();
    if(healthChange > 0)
    {
        if(!force && target->getHealth() <= 0)
            return false;

        bool deny = false;
        CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);
        for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it)
        {
            if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_HEALTHGAIN, combatType, healthChange))
                deny = true;
        }

        if(deny)
            return false;

        target->gainHealth(attacker, healthChange);
        if(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE) && !target->isGhost() &&
            (g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE_MONSTER) || !target->getMonster()))
        {
            char buffer[20];
            sprintf(buffer, "%d", healthChange);

            const SpectatorVec& list = getSpectators(targetPos);
            if(combatType != COMBAT_HEALING)
                addMagicEffect(list, targetPos, MAGIC_EFFECT_WRAPS_BLUE);

            addAnimatedText(list, targetPos, g_config.getNumber(ConfigManager::HEALTH_HEALING_COLOR), buffer);
        }
    }
    else
    {
        const SpectatorVec& list = getSpectators(targetPos);
        if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR)
        {
            addMagicEffect(list, targetPos, MAGIC_EFFECT_POFF);
            return true;
        }

        int32_t damage = -healthChange;
        if(damage != 0)
        {
            if(target->hasCondition(CONDITION_MANASHIELD) && combatType != COMBAT_UNDEFINEDDAMAGE)
            {
                int32_t manaDamage = std::min(target->getMana(), damage);
                damage = std::max((int32_t)0, damage - manaDamage);
                if(manaDamage != 0)
                {
                    bool deny = false;
                    CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);
                    for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it)
                    {
                        if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANALOSS, combatType, manaDamage))
                            deny = true;
                    }

                    if(deny)
                        return false;

                    target->drainMana(attacker, combatType, manaDamage);
                    char buffer[20];
                    sprintf(buffer, "%d", manaDamage);

                    addMagicEffect(list, targetPos, MAGIC_EFFECT_LOSE_ENERGY);
                    addAnimatedText(list, targetPos, TEXTCOLOR_BLUE, buffer);
                }
            }

            damage = std::min(target->getHealth(), damage);
            if(damage > 0)
            {
                bool deny = false;
                CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);
                for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it)
                {
                    if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_HEALTHLOSS, combatType, damage))
                        deny = true;
                }

                if(deny)
                    return false;

                target->drainHealth(attacker, combatType, damage);
                addCreatureHealth(list, target);

                TextColor_t textColor = TEXTCOLOR_NONE;
                MagicEffect_t magicEffect = MAGIC_EFFECT_NONE;
                switch(combatType)
                {
                    case COMBAT_PHYSICALDAMAGE:
                    {
                        Item* splash = NULL;
                        switch(target->getRace())
                        {
                            case RACE_VENOM:
                                textColor = TEXTCOLOR_LIGHTGREEN;
                                magicEffect = MAGIC_EFFECT_POISON;
                                splash = Item::CreateItem(ITEM_SMALLSPLASH, FLUID_GREEN);
                                break;

                            case RACE_BLOOD:
                                textColor = TEXTCOLOR_RED;
                                magicEffect = MAGIC_EFFECT_DRAW_BLOOD;
                                splash = Item::CreateItem(ITEM_SMALLSPLASH, FLUID_BLOOD);
                                break;

                            case RACE_UNDEAD:
                                textColor = TEXTCOLOR_GREY;
                                magicEffect = MAGIC_EFFECT_HIT_AREA;
                                break;

                            case RACE_FIRE:
                                textColor = TEXTCOLOR_ORANGE;
                                magicEffect = MAGIC_EFFECT_DRAW_BLOOD;
                                break;

                            case RACE_ENERGY:
                                textColor = TEXTCOLOR_PURPLE;
                                magicEffect = MAGIC_EFFECT_PURPLEENERGY;
                                break;

                            default:
                                break;
                        }

                        if(splash)
                        {
                            internalAddItem(NULL, target->getTile(), splash, INDEX_WHEREEVER, FLAG_NOLIMIT);
                            startDecay(splash);
                        }
                        break;
                    }

                    case COMBAT_ENERGYDAMAGE:
                    {
                        textColor = TEXTCOLOR_PURPLE;
                        magicEffect = MAGIC_EFFECT_ENERGY_DAMAGE;
                        break;
                    }

                    case COMBAT_EARTHDAMAGE:
                    {
                        textColor = TEXTCOLOR_LIGHTGREEN;
                        magicEffect = MAGIC_EFFECT_POISON_RINGS;
                        break;
                    }

                    case COMBAT_DROWNDAMAGE:
                    {
                        textColor = TEXTCOLOR_LIGHTBLUE;
                        magicEffect = MAGIC_EFFECT_LOSE_ENERGY;
                        break;
                    }

                    case COMBAT_FIREDAMAGE:
                    {
                        textColor = TEXTCOLOR_ORANGE;
                        magicEffect = MAGIC_EFFECT_HITBY_FIRE;
                        break;
                    }

                    case COMBAT_ICEDAMAGE:
                    {
                        textColor = TEXTCOLOR_TEAL;
                        magicEffect = MAGIC_EFFECT_ICEATTACK;
                        break;
                    }

                    case COMBAT_HOLYDAMAGE:
                    {
                        textColor = TEXTCOLOR_YELLOW;
                        magicEffect = MAGIC_EFFECT_HOLYDAMAGE;
                        break;
                    }

                    case COMBAT_DEATHDAMAGE:
                    {
                        textColor = TEXTCOLOR_DARKRED;
                        magicEffect = MAGIC_EFFECT_SMALLCLOUDS;
                        break;
                    }

                    case COMBAT_LIFEDRAIN:
                    {
                        textColor = TEXTCOLOR_RED;
                        magicEffect = MAGIC_EFFECT_WRAPS_RED;
                        break;
                    }

                    default:
                        break;
                }

                if(hitEffect != MAGIC_EFFECT_UNKNOWN)
                    magicEffect = hitEffect;

                if(hitColor != TEXTCOLOR_UNKNOWN)
                    textColor = hitColor;

                if(textColor < TEXTCOLOR_NONE && magicEffect < MAGIC_EFFECT_NONE)
                {
                    char buffer[20];
                    sprintf(buffer, "%d", damage);

                    addMagicEffect(list, targetPos, magicEffect);
                    addAnimatedText(list, targetPos, textColor, buffer);
                }
            }
        }
    }

    return true;
}

bool Game::combatChangeMana(Creature* attacker, Creature* target, int32_t manaChange)
{
    const Position& targetPos = target->getPosition();
    if(manaChange > 0)
    {
        bool deny = false;
        CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);
        for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it)
        {
            if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANAGAIN, COMBAT_HEALING, manaChange))
                deny = true;
        }

        if(deny)
            return false;

        target->changeMana(manaChange);
        if(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE) && !target->isGhost() &&
            (g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE_MONSTER) || !target->getMonster()))
        {
            char buffer[20];
            sprintf(buffer, "%d", manaChange);

            const SpectatorVec& list = getSpectators(targetPos);
            addAnimatedText(list, targetPos, g_config.getNumber(ConfigManager::MANA_HEALING_COLOR), buffer);
        }
    }
    else
    {
        const SpectatorVec& list = getSpectators(targetPos);
        if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR)
        {
            addMagicEffect(list, targetPos, MAGIC_EFFECT_POFF);
            return false;
        }

        int32_t manaLoss = std::min(target->getMana(), -manaChange);
        BlockType_t blockType = target->blockHit(attacker, COMBAT_MANADRAIN, manaLoss);
        if(blockType != BLOCK_NONE)
        {
            addMagicEffect(list, targetPos, MAGIC_EFFECT_POFF);
            return false;
        }

        if(manaLoss > 0)
        {
            bool deny = false;
            CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);
            for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it)
            {
                if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANALOSS, COMBAT_UNDEFINEDDAMAGE, manaChange))
                    deny = true;
            }

            if(deny)
                return false;

            target->drainMana(attacker, COMBAT_MANADRAIN, manaLoss);
            char buffer[20];
            sprintf(buffer, "%d", manaLoss);

            addAnimatedText(list, targetPos, TEXTCOLOR_BLUE, buffer);
        }
    }

    return true;
}

void Game::addCreatureHealth(const Creature* target)
{
    const SpectatorVec& list = getSpectators(target->getPosition());
    addCreatureHealth(list, target);
}

void Game::addCreatureHealth(const SpectatorVec& list, const Creature* target)
{
    Player* player = NULL;
    for(SpectatorVec::const_iterator it = list.begin(); it != list.end(); ++it)
    {
        if((player = (*it)->getPlayer()))
            player->sendCreatureHealth(target);
    }
}
 
Last edited:
Check potions.lua / your mana rune scripts to see if you got any animated texts there.
Otherwise you might be able to disable them via your config.lua (if you are running 0.3 or that may only be on 0.4)
 
Check potions.lua / your mana rune scripts to see if you got any animated texts there.
Otherwise you might be able to disable them via your config.lua (if you are running 0.3 or that may only be on 0.4)
Well, on my potions.lua I have doCreatureAddHealth and doPlayerAddMana, and yes I know than I can able and disable but I really need it show how many u heal mana and health, Also I have a rune than heal mana and health and it show the same bug , it could be edited with sources c++?
 
Last edited:
Well, on my potions.lua I have doCreatureAddHealth and doPlayerAddMana, and yes I know than I can able and disable but I really need it show how many u heal mana and health, Also I have a rune than heal mana and health and it show the same bug , it could be edited with sources c++?

So you wanna remove the Aaah? or the colors or what?
 
So you wanna remove the Aaah? or the colors or what?
I wanna edit the animated text the numbers of the mana and health, look on the pic where appear very separate, its look like a bug, i want at least the numbers appear on the same place or one under the other
 
I'm no expert, but I'm pretty sure that's a client-side issue. Idk what client you're using, but judging by the sprites it's higher than 8.0, which is when what you are looking for changed, specifically this part:
i want at least the numbers appear on the same place or one under the other
Correct me if I'm wrong, but from my knowledge this can only be done in later versions (past 8.0) by using OTClient.
 
I'm no expert, but I'm pretty sure that's a client-side issue. Idk what client you're using, but judging by the sprites it's higher than 8.0, which is when what you are looking for changed, specifically this part:

Correct me if I'm wrong, but from my knowledge this can only be done in later versions (past 8.0) by using OTClient.
I'm no expert, but I'm pretty sure that's a client-side issue. Idk what client you're using, but judging by the sprites it's higher than 8.0, which is when what you are looking for changed, specifically this part:

Correct me if I'm wrong, but from my knowledge this can only be done in later versions (past 8.0) by using OTClient.
Yes, that's right. 8.60 TFS 0.3.6, so i can't solve it?
 
Unless you know how to edit the original Tibia client, I'm afraid not. I ran into the same issue, I like the old-school style of damage/healing numbers stacking vertically so I was forced to build everything around an older Tibia client (again, I could use OTClient but I'm not very good at it/haven't taken the time to learn it so I did not go that route).

I messed around with game.cpp forever before I finally realized it couldn't be fixed :/
 
you could remove the animated text in sources so it never shows when you're healing, and when you do want to show it you can combine the health/mana values (assuming they're stored in variables beforehand) and send animated text that's just the sum of those two healing variables
 
you could remove the animated text in sources so it never shows when you're healing, and when you do want to show it you can combine the health/mana values (assuming they're stored in variables beforehand) and send animated text that's just the sum of those two healing variables
How? removing this from game.cpp:
bool Game::combatChangeHealth

Code:
addAnimatedText(list, targetPos, g_config.getNumber(ConfigManager::HEALTH_HEALING_COLOR), buffer);

This from bool Game::combatChangeMana
Code:
addAnimatedText(list, targetPos, TEXTCOLOR_DARKPURPLE, buffer);

This from configmanager.cpp:
Code:
m_confNumber[HEALTH_HEALING_COLOR] = getGlobalNumber("healthHealingColor", TEXTCOLOR_GREEN);
m_confNumber[MANA_HEALING_COLOR] = getGlobalNumber("manaHealingColor", TEXTCOLOR_DARKPURPLE);

This from configmanager.h:
Code:
HEALTH_HEALING_COLOR,
MANA_HEALING_COLOR,

This from Config.lua
Code:
healthHealingColor = TEXTCOLOR_GREEN
         manaHealingColor = TEXTCOLOR_DARKPURPLE

And here how? this is the part of my Rune.lua
Code:
doSendMagicEffect(topos, ani)
      doPlayerAddMana(item2.uid, math.random(minMana, maxMana))
    doCreatureAddHealth(item2.uid, math.random(minHealth, maxHealth))
    if infinite == false then
        if item.type > 1 then
            doChangeTypeItem(item.uid,item.type-1)
        else
            doRemoveItem(item.uid,1)
        end
    end
end
 
oh wait there's an option to disable it in config.lua
showHealingDamage = true
set that to false
show me the full rune script so i can fix it for you
 
oh wait there's an option to disable it in config.lua
showHealingDamage = true
set that to false
show me the full rune script so i can fix it for you
Here you go:
Code:
function onUse(cid, item, frompos, item2, topos)
    --Config
    local reqml = 2         --Magic Level required to use it
    local reqlvl = 200       --Character Level required to use it
    local potExhaust = false    -- causes exhaust like potions (false creates seperate exhaust for mana rune)
    --Maximum amount of mana to be added
    local minMana = ((getPlayerLevel(cid) * 0.5 + getPlayerMagLevel(cid) * 2) * 0.55) + 15
    local maxMana = ((getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 0.95) + 20

    local ani = 14          --Animation to be sent to player when used (these can be found in your global.lua; search for CONST_ME_)
    --If you don't want it to give health, set both to 0
    local minHealth = ((getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 2) * 0.55) + 15     --Minimum amount of health to be added
    local maxHealth = ((getPlayerLevel(cid) * 4 + getPlayerMagLevel(cid) * 1) * 0.95) + 20      --Maximum amount of health to be added
   
        if getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == 6536 and getPlayerStorageValue(cid, 50781) == 1 then
        minHealth = minHealth * 1.5     --Minimum amount of health to be added
        maxHealth = maxHealth * 1.5   --Maximum amount of health to be added
     end
   
   
   
    --If you're not using potion exhaust (potExhaust = false) edit the following the way you'd like
    local storeValue = 50995       --The storage value that will be used for exhaust if you have potexhaust to false
    local exhaustTime = 1       --Exhaust in seconds
    local infinite = true      --Will it cause rune to lose charges
    local canUseInPz = true    --If true, mana rune may be used in PZ, otherwise, it will not work.

    local player_say = "Ahhh..."                            --What player says after successfully using the mana rune
    local error_ml = "You don't have the required magic level to use that rune."    --What the cancel says when ml is too low
    local error_lvl = "You don't have the required level to use that rune."   --What the cancel says when level is too low
    local error_notPlayer = "You can only use this rune on players."        --What the cancel says when you try to use it on something not a player
    local error_exhaust = "You are exhausted."                  --What the cancel says when you are exhausted
    local error_pz = "You may not use this in Protected Zones." --What the cancel says when you are in PZ and canUseInPz is false
 

    ---------------------------START Check for Errors--------------------------------
    --If doesn't allow use in PZ, send poof and cancel message
    if canUseInPz == false  and getTilePzInfo(getPlayerPosition(cid)) == 1 then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_pz)
        return 0
    end
    --If not high enough level, send poof and cancel message
    if getPlayerLevel(cid) < reqlvl then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_lvl)
        return 0
    end
    --if character is not knight, sejnd poof and cancel message
        if((not(getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 or getPlayerVocation(cid) == 12 or getPlayerVocation(cid) == 16) or getPlayerLevel(cid) < 200) and getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == FALSE) then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_lvl)
        return 0
    end

    --If ml is too low, send poof and cancel message
    if getPlayerMagLevel(cid) < reqml then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_ml)
        return 0
    end

    --If it's not a player, send poof and cancel message
    if isPlayer(item2.uid) == FALSE then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_notPlayer)
        return 0
    end

    --Check if exhausted
    if potExhaust == false then --If not using Potion Exhaust
        if exhaust(cid, storeValue, exhaustTime) == 0 then
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, error_exhaust)
            return 0
        end
    else --If you are using potion exhaust
        if hasCondition(cid, CONDITION_EXHAUSTED) == 1 then
            doPlayerSendCancel(cid, error_exhaust)
            return 0
        end
    end

    ---------------------------END Check for Errors--------------------------------

    doSendMagicEffect(topos, ani)
      doPlayerAddMana(item2.uid, math.random(minMana, maxMana))
    doCreatureAddHealth(item2.uid, math.random(minHealth, maxHealth))
    if infinite == false then
        if item.type > 1 then
            doChangeTypeItem(item.uid,item.type-1)
        else
            doRemoveItem(item.uid,1)
        end
    end
end


function exhaust(cid, storeValue, exhaustTime)
    local newExhaust = os.time()
    local oldExhaust = getPlayerStorageValue(cid, storeValue)
    if (oldExhaust == nil or oldExhaust < 0) then
        oldExhaust = 0
    end
    if (exhaustTime == nil or exhaustTime < 0) then
        exhaustTime = 1
    end
    diffTime = os.difftime(newExhaust, oldExhaust)
    if (diffTime >= exhaustTime) then
        setPlayerStorageValue(cid, storeValue, newExhaust)
        return 1
    else
        return 0
    end
end
 
Lua:
    --If you're not using potion exhaust (potExhaust = false) edit the following the way you'd like
local storeValue = 50995       --The storage value that will be used for exhaust if you have potexhaust to false
local exhaustTime = 1       --Exhaust in seconds
local infinite = true      --Will it cause rune to lose charges
local canUseInPz = true    --If true, mana rune may be used in PZ, otherwise, it will not work.

local player_say = "Ahhh..."                            --What player says after successfully using the mana rune
local error_ml = "You don't have the required magic level to use that rune."    --What the cancel says when ml is too low
local error_lvl = "You don't have the required level to use that rune."   --What the cancel says when level is too low
local error_notPlayer = "You can only use this rune on players."        --What the cancel says when you try to use it on something not a player
local error_exhaust = "You are exhausted."                  --What the cancel says when you are exhausted
local error_pz = "You may not use this in Protected Zones." --What the cancel says when you are in PZ and canUseInPz is false 
function onUse(cid, item, frompos, item2, topos)
    --Config
    local reqml = 2         --Magic Level required to use it
    local reqlvl = 200       --Character Level required to use it
    local potExhaust = false    -- causes exhaust like potions (false creates seperate exhaust for mana rune)
    --Maximum amount of mana to be added
    local minMana = ((getPlayerLevel(cid) * 0.5 + getPlayerMagLevel(cid) * 2) * 0.55) + 15
    local maxMana = ((getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 0.95) + 20

    local ani = 14          --Animation to be sent to player when used (these can be found in your global.lua; search for CONST_ME_)
    --If you don't want it to give health, set both to 0
    local minHealth = ((getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 2) * 0.55) + 15     --Minimum amount of health to be added
    local maxHealth = ((getPlayerLevel(cid) * 4 + getPlayerMagLevel(cid) * 1) * 0.95) + 20      --Maximum amount of health to be added
   
        if getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == 6536 and getPlayerStorageValue(cid, 50781) == 1 then
        minHealth = minHealth * 1.5     --Minimum amount of health to be added
        maxHealth = maxHealth * 1.5   --Maximum amount of health to be added
     end


    ---------------------------START Check for Errors--------------------------------
    --If doesn't allow use in PZ, send poof and cancel message
    if canUseInPz == false  and getTilePzInfo(getPlayerPosition(cid)) == 1 then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_pz)
        return false
    end
    --If not high enough level, send poof and cancel message
    if getPlayerLevel(cid) < reqlvl then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_lvl)
        return false
    end
    --if character is not knight, sejnd poof and cancel message
        if((not(getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 or getPlayerVocation(cid) == 12 or getPlayerVocation(cid) == 16) or getPlayerLevel(cid) < 200) and getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == FALSE) then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_lvl)
        return false
    end

    --If ml is too low, send poof and cancel message
    if getPlayerMagLevel(cid) < reqml then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_ml)
        return false
    end

    --If it's not a player, send poof and cancel message
    if isPlayer(item2.uid) == FALSE then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_notPlayer)
        return false
    end

    --Check if exhausted
    if potExhaust == false then --If not using Potion Exhaust
        if exhaust(cid, storeValue, exhaustTime) == 0 then
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, error_exhaust)
            return false
        end
    else --If you are using potion exhaust
        if hasCondition(cid, CONDITION_EXHAUSTED) == 1 then
            doPlayerSendCancel(cid, error_exhaust)
            return false
        end
    end

    ---------------------------END Check for Errors--------------------------------
    local mana = math.random(minMana, maxMana)
    local health = math.random(minHealth, maxHealth)
    doSendMagicEffect(topos, ani)
    doPlayerAddMana(item2.uid, mana)
    doCreatureAddHealth(item2.uid, health)
    doSendAnimatedText(getThingPosition(cid), "+".. mana + health, TEXTCOLOR_DARKPURPLE)
    if infinite == false then
        if item.type > 1 then
            doChangeTypeItem(item.uid,item.type-1)
        else
            doRemoveItem(item.uid,1)
        end
    end
end


function exhaust(cid, storeValue, exhaustTime)
    local newExhaust = os.time()
    local oldExhaust = getPlayerStorageValue(cid, storeValue)
    if (oldExhaust == nil or oldExhaust < 0) then
        oldExhaust = 0
    end
    if (exhaustTime == nil or exhaustTime < 0) then
        exhaustTime = 1
    end
    diffTime = os.difftime(newExhaust, oldExhaust)
    if (diffTime >= exhaustTime) then
        setPlayerStorageValue(cid, storeValue, newExhaust)
        return 1
    else
        return false
    end
end
 
Lua:
    --If you're not using potion exhaust (potExhaust = false) edit the following the way you'd like
local storeValue = 50995       --The storage value that will be used for exhaust if you have potexhaust to false
local exhaustTime = 1       --Exhaust in seconds
local infinite = true      --Will it cause rune to lose charges
local canUseInPz = true    --If true, mana rune may be used in PZ, otherwise, it will not work.

local player_say = "Ahhh..."                            --What player says after successfully using the mana rune
local error_ml = "You don't have the required magic level to use that rune."    --What the cancel says when ml is too low
local error_lvl = "You don't have the required level to use that rune."   --What the cancel says when level is too low
local error_notPlayer = "You can only use this rune on players."        --What the cancel says when you try to use it on something not a player
local error_exhaust = "You are exhausted."                  --What the cancel says when you are exhausted
local error_pz = "You may not use this in Protected Zones." --What the cancel says when you are in PZ and canUseInPz is false
function onUse(cid, item, frompos, item2, topos)
    --Config
    local reqml = 2         --Magic Level required to use it
    local reqlvl = 200       --Character Level required to use it
    local potExhaust = false    -- causes exhaust like potions (false creates seperate exhaust for mana rune)
    --Maximum amount of mana to be added
    local minMana = ((getPlayerLevel(cid) * 0.5 + getPlayerMagLevel(cid) * 2) * 0.55) + 15
    local maxMana = ((getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 0.95) + 20

    local ani = 14          --Animation to be sent to player when used (these can be found in your global.lua; search for CONST_ME_)
    --If you don't want it to give health, set both to 0
    local minHealth = ((getPlayerLevel(cid) * 3 + getPlayerMagLevel(cid) * 2) * 0.55) + 15     --Minimum amount of health to be added
    local maxHealth = ((getPlayerLevel(cid) * 4 + getPlayerMagLevel(cid) * 1) * 0.95) + 20      --Maximum amount of health to be added
  
        if getPlayerSlotItem(cid, CONST_SLOT_RING).itemid == 6536 and getPlayerStorageValue(cid, 50781) == 1 then
        minHealth = minHealth * 1.5     --Minimum amount of health to be added
        maxHealth = maxHealth * 1.5   --Maximum amount of health to be added
     end


    ---------------------------START Check for Errors--------------------------------
    --If doesn't allow use in PZ, send poof and cancel message
    if canUseInPz == false  and getTilePzInfo(getPlayerPosition(cid)) == 1 then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_pz)
        return false
    end
    --If not high enough level, send poof and cancel message
    if getPlayerLevel(cid) < reqlvl then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_lvl)
        return false
    end
    --if character is not knight, sejnd poof and cancel message
        if((not(getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 or getPlayerVocation(cid) == 12 or getPlayerVocation(cid) == 16) or getPlayerLevel(cid) < 200) and getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == FALSE) then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_lvl)
        return false
    end

    --If ml is too low, send poof and cancel message
    if getPlayerMagLevel(cid) < reqml then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_ml)
        return false
    end

    --If it's not a player, send poof and cancel message
    if isPlayer(item2.uid) == FALSE then
        doSendMagicEffect(frompos, CONST_ME_POFF)
        doPlayerSendCancel(cid, error_notPlayer)
        return false
    end

    --Check if exhausted
    if potExhaust == false then --If not using Potion Exhaust
        if exhaust(cid, storeValue, exhaustTime) == 0 then
            doSendMagicEffect(frompos, CONST_ME_POFF)
            doPlayerSendCancel(cid, error_exhaust)
            return false
        end
    else --If you are using potion exhaust
        if hasCondition(cid, CONDITION_EXHAUSTED) == 1 then
            doPlayerSendCancel(cid, error_exhaust)
            return false
        end
    end

    ---------------------------END Check for Errors--------------------------------
    local mana = math.random(minMana, maxMana)
    local health = math.random(minHealth, maxHealth)
    doSendMagicEffect(topos, ani)
    doPlayerAddMana(item2.uid, mana)
    doCreatureAddHealth(item2.uid, health)
    doSendAnimatedText(getThingPosition(cid), "+".. mana + health, TEXTCOLOR_DARKPURPLE)
    if infinite == false then
        if item.type > 1 then
            doChangeTypeItem(item.uid,item.type-1)
        else
            doRemoveItem(item.uid,1)
        end
    end
end


function exhaust(cid, storeValue, exhaustTime)
    local newExhaust = os.time()
    local oldExhaust = getPlayerStorageValue(cid, storeValue)
    if (oldExhaust == nil or oldExhaust < 0) then
        oldExhaust = 0
    end
    if (exhaustTime == nil or exhaustTime < 0) then
        exhaustTime = 1
    end
    diffTime = os.difftime(newExhaust, oldExhaust)
    if (diffTime >= exhaustTime) then
        setPlayerStorageValue(cid, storeValue, newExhaust)
        return 1
    else
        return false
    end
end
I set showHealingDamage = false
with your script and doesn't works:/ only appear the MagicEffect , and when it is showHealingDamage = true only show the mana heal, btw i was needing it show 2 diferents colors, mana purple and health blue:/
 
I set showHealingDamage = false
with your script and doesn't works:/ only appear the MagicEffect , and when it is showHealingDamage = true only show the mana heal, btw i was needing it show 2 diferents colors, mana purple and health blue:/
If there are options in config set them manually.
Code:
healthHealingColor = TEXTCOLOR_BLUE
manaHealingColor = TEXTCOLOR_PURPLE
 
you aren't clear with explaining your problem.
first you made me think you wanted the separation to go away, now you're saying you want two different colors
 
you aren't clear with explaining your problem.
first you made me think you wanted the separation to go away, now you're saying you want two different colors
So I Want the sepparation to go away but the same animation of my pic, but ur script didnt solved it
 
Back
Top