• 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.5 weapon charges doesn't get decayed

3alola1

I don't have time
Joined
Sep 2, 2010
Messages
768
Solutions
7
Reaction score
331
Location
Darashia
Hello

I have a problem with weapons where the charges doesn't decay at all how to solve this?
1742301543720.webp
 
Last edited:
Solution
Do you have such property in your config.lua?
LUA:
removeWeaponCharges = true

How does your implementation of removecharge look like?

C++:
        case WEAPONACTION_REMOVECHARGE: {
            uint16_t charges = item->getCharges();
            if (charges != 0 && g_config.getBoolean(ConfigManager::REMOVE_WEAPON_CHARGES)) {
                g_game.transformItem(item, item->getID(), charges - 1);
            }
            break;
        }

or lua binding

C++:
int LuaScriptInterface::luaWeaponAction(lua_State* L)
{
    // weapon:action(callback)
    Weapon* weapon = getUserdata<Weapon>(L, 1);
    if (weapon) {
        std::string typeName = getString(L, 2);
        std::string tmpStr = asLowerCaseString(typeName);
        if (tmpStr ==...
Maybe it will be my lucky guess but check your weapons.xml

XML:
<melee id="7858" level="45" action="removecharge" unproperly="1">
    <vocation name="Knight" />
</melee>
You have to define that this weapon will loose charges.
Additionally check your items.xml

XML:
    <item id="7858" article="an" name="earth dragon slayer">
        <attribute key="weight" value="8200" />
        <attribute key="defense" value="28" />
        <attribute key="attack" value="35" />
        <attribute key="weaponType" value="sword" />
        <attribute key="slotType" value="two-handed" />
        <attribute key="elementEarth" value="9" />
        <attribute key="charges" value="1000" />
        <attribute key="showcharges" value="1" />
        <attribute key="decayTo" value="7402" />
    </item>
 
Maybe it will be my lucky guess but check your weapons.xml

XML:
<melee id="7858" level="45" action="removecharge" unproperly="1">
    <vocation name="Knight" />
</melee>
You have to define that this weapon will loose charges.
Additionally check your items.xml

XML:
    <item id="7858" article="an" name="earth dragon slayer">
        <attribute key="weight" value="8200" />
        <attribute key="defense" value="28" />
        <attribute key="attack" value="35" />
        <attribute key="weaponType" value="sword" />
        <attribute key="slotType" value="two-handed" />
        <attribute key="elementEarth" value="9" />
        <attribute key="charges" value="1000" />
        <attribute key="showcharges" value="1" />
        <attribute key="decayTo" value="7402" />
    </item>
yeah everything is set like this but still doesn't get decayed.
 
Do you have such property in your config.lua?
LUA:
removeWeaponCharges = true

How does your implementation of removecharge look like?

C++:
        case WEAPONACTION_REMOVECHARGE: {
            uint16_t charges = item->getCharges();
            if (charges != 0 && g_config.getBoolean(ConfigManager::REMOVE_WEAPON_CHARGES)) {
                g_game.transformItem(item, item->getID(), charges - 1);
            }
            break;
        }

or lua binding

C++:
int LuaScriptInterface::luaWeaponAction(lua_State* L)
{
    // weapon:action(callback)
    Weapon* weapon = getUserdata<Weapon>(L, 1);
    if (weapon) {
        std::string typeName = getString(L, 2);
        std::string tmpStr = asLowerCaseString(typeName);
        if (tmpStr == "removecount") {
            weapon->action = WEAPONACTION_REMOVECOUNT;
        } else if (tmpStr == "removecharge") {
            weapon->action = WEAPONACTION_REMOVECHARGE;
        } else if (tmpStr == "move") {
            weapon->action = WEAPONACTION_MOVE;
        } else {
            std::cout << "Error: [Weapon::action] No valid action " << typeName << std::endl;
            pushBoolean(L, false);
        }
        pushBoolean(L, true);
    } else {
        lua_pushnil(L);
    }
    return 1;
}
 
Solution
Back
Top