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

Runes based on count, not charges [8.54]

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
741
Solutions
5
Reaction score
193
Location
Pr0land
GitHub
Erexo
Hello there,
Ive put a normal, useable, stackable item into rune script.
Main idea is to create an mwall "rune" but in normal stackable item, and when you cast that "rune", 1 count from stack will be loss, not whole stack (runes based on item count, not charges).
Ive found out that:
Code:
bool RuneSpell::executeUse(Player* player, Item* item, const PositionEx& posFrom,
    const PositionEx& posTo, bool extendedUse, uint32_t creatureId)
{
    if(!playerRuneSpellCheck(player, posTo))
        return false;

    bool result = false;
    if(isScripted())
    {
        LuaVariant var;
        if(creatureId && needTarget)
        {
            var.type = VARIANT_NUMBER;
            var.number = creatureId;
        }
        else
        {
            var.type = VARIANT_POSITION;
            var.pos = posTo;
        }

        result = internalCastSpell(player, var);
    }
    else if(function)
        result = function(this, player, item, posFrom, posTo);

    if(result)
    {
        Spell::postCastSpell(player);
        if(hasCharges && item && g_config.getBool(ConfigManager::REMOVE_RUNE_CHARGES))
            g_game.transformItem(item, item->getID(), std::max((int32_t)0, ((int32_t)item->getCharges()) - 1));
    }

    return result;
}

there is that line:
Code:
g_game.transformItem(item, item->getID(), std::max((int32_t)0, ((int32_t)item->getCharges()) - 1));

But I dont really know how to change it that it will remove count, not charge.
Any ideas? Im using tfs0.3.6pl1

Greetings,
Erexo
 
Back
Top