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

Solved Speed on wings and auras is not applying to the player

Lmao you just don't want to post the solution :D
He probably used a script; it was here.

just look at the Infernum tutorial; you'll understand better. I just gave a simple example
speed.gif




You should just create it as a lookAura, and then add that.
getBonusCondition(self:getOutfit().lookAura, AuraBonus)


Lua:
function createHasteCondition(id, params)
    local condition = Condition(CONDITION_HASTE, CONDITIONID_DEFAULT)
    condition:setParameter(CONDITION_PARAM_TICKS, -1)
    condition:setParameter(CONDITION_PARAM_SUBID, id)
    for i = 1, #params do
        local param = params[i].param
        local value = params[i].value
        condition:setParameter(param, value)
    end
    return condition
end

Lua:
local AuraBonus = {
    [{1657}] = createHasteCondition(1, {
            {param = CONDITION_PARAM_SPEED, value = 10},
        }, CONDITION_ATTRIBUTES
    ),


I was doing the tutorial, but it's not worth it, they are so toxic that the truth discourages doing it :)
Your reluctance to provide a solution is noted. You have been added to the blacklist. In future requests for scripts, I hope others won't be dissuaded from offering their assistance. It's encouraged to share solutions rather than withholding help. Displaying good empathy towards others is appreciated..😉
 
He probably used a script; it was here.

just look at the Infernum tutorial; you'll understand better. I just gave a simple example
View attachment 84570




You should just create it as a lookAura, and then add that.



Lua:
function createHasteCondition(id, params)
    local condition = Condition(CONDITION_HASTE, CONDITIONID_DEFAULT)
    condition:setParameter(CONDITION_PARAM_TICKS, -1)
    condition:setParameter(CONDITION_PARAM_SUBID, id)
    for i = 1, #params do
        local param = params[i].param
        local value = params[i].value
        condition:setParameter(param, value)
    end
    return condition
end

Lua:
local AuraBonus = {
    [{1657}] = createHasteCondition(1, {
            {param = CONDITION_PARAM_SPEED, value = 10},
        }, CONDITION_ATTRIBUTES
    ),



Your reluctance to provide a solution is noted. You have been added to the blacklist. In future requests for scripts, I hope others won't be dissuaded from offering their assistance. It's encouraged to share solutions rather than withholding help. Displaying good empathy towards others is appreciated..😉
Hey! Pretty simple solution & a cool system, I actually tackled this yesterday but my approach was through c++, I'm using Canary though so this might be different for you guys, still should be the same concept, let me know if you guys need help implementing it and we can go over it.

In player.hpp I have defined these functions:
C++:
    bool isWinged() const {
        return defaultOutfit.lookWings != 0;
    }
    bool isAurad() const {
        return defaultOutfit.lookAura != 0;
    }
    void unequipWing();

In player.cpp:
C++:
void Player::unequipWing() {
    const auto wing = g_game().wings.getWingByID(getCurrentWing());
    if (wing && wing->speed > 0) {
        g_game().changeSpeed(static_self_cast<Player>(), -wing->speed);
    }

    defaultOutfit.lookWings = 0;
    setCurrentWing(0);
}

void Player::unequipAura() {
    const auto aura = g_game().auras.getAuraByID(getCurrentAura());
    if (aura && aura->speed > 0) {
        g_game().changeSpeed(static_self_cast<Player>(), -aura->speed);
    }
    defaultOutfit.lookAura = 0;
    setCurrentAura(0);
}

Also in player.cpp inside the onCreatureAppear function I added these to add the speed on login.

C++:
// load wing speed bonus
        uint16_t currentWingId = currentOutfit.lookWings;
        if (currentWingId != 0) {
            const auto currentWing = g_game().wings.getWingByClientID(currentWingId);
            if (currentWing && hasWing(currentWing)) {
                g_game().changeSpeed(static_self_cast<Player>(), currentWing->speed);
            } else {
                defaultOutfit.lookWings = 0;
                g_game().internalCreatureChangeOutfit(static_self_cast<Player>(), defaultOutfit);
            }
        }

        // load aura speed bonus
        uint16_t currentAuraId = currentOutfit.lookAura;
        if (currentAuraId != 0) {
            const auto currentAura = g_game().auras.getAuraByClientID(currentAuraId);
            if (currentAura && hasAura(currentAura)) {
                g_game().changeSpeed(static_self_cast<Player>(), currentAura->speed);
            } else {
                defaultOutfit.lookAura = 0;
                g_game().internalCreatureChangeOutfit(static_self_cast<Player>(), defaultOutfit);
            }
        }


In game.cpp after
C++:
    const auto playerOutfit = Outfits::getInstance().getOutfitByLookType(player->getSex(), outfit.lookType);
    if (!playerOutfit) {
        outfit.lookMount = 0;
        outfit.lookWings = 0;
        outfit.lookAura = 0;
    }

Inserted:

C++:
if (outfit.lookWings != 0) {
        const auto wing = wings.getWingByClientID(outfit.lookWings);
        if (!wing) {
            return;
        }

        if (!player->hasWing(wing)) {
            return;
        }

        std::shared_ptr<Tile> playerTile = player->getTile();
        if (!playerTile) {
            return;
        }

        auto deltaSpeedChange = wing->speed;
        if (player->isWinged()) {
            const auto prevWing = g_game().wings.getWingByID(player->getCurrentWing());
            if (prevWing) {
                deltaSpeedChange -= prevWing->speed;
            }
        }

        player->setCurrentWing(wing->id);
        changeSpeed(player, deltaSpeedChange);
    } else if (player->isWinged()) {
        player->unequipWing();
    }

    if (outfit.lookAura != 0) {
        Aura* aura = auras.getAuraByClientID(outfit.lookAura);
        if (!aura) {
            return;
        }

        if (!player->hasAura(aura)) {
            return;
        }

        std::shared_ptr<Tile> playerTile = player->getTile();
        if (!playerTile) {
            return;
        }

        auto deltaSpeedChange = aura->speed;
        if (player->isAurad()) {
            const auto prevAura = auras.getAuraByID(player->getCurrentAura());
            if (prevAura) {
                deltaSpeedChange -= prevAura->speed;
            }
        }

        player->setCurrentAura(aura->id);
        changeSpeed(player, deltaSpeedChange);
    } else if (player->isAurad()) {
        player->unequipAura();
    }
 
Wow, quite different indeed. But this C++ code was directly in the XML file, in auras.xml, just like the mounts that have speed to add velocity, right?

Hey that's right I basically took the approach that was used on mounts and adjusted it for my needs to fit auras & wings. I do not use mounts on my server so I'm not sure if it might cause some conflict if you do. The speed is taken directly from the wings/aura.xml files.
 
Back
Top