• 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 StorageValue on Sources [TFS 1.2]

Aeronx

Intermediate OT User
Joined
Dec 17, 2015
Messages
735
Solutions
9
Reaction score
119
Hello all!

I've been trying to change the formula of attackspeed on sources adding a storage value.

Code:
uint32_t ret = (vocation->getAttackSpeed() * (1 - getStorageValue(88888) * 0.00375));

but i get an error at the "888)<---"

Code:
too few arguments in function call

Can anyone tell me what im actually doing wrong?

Thank you in advance.
 
Solution
I've tried something like this, but now i get "ret undifined".

Im 100% noob on c++ sorry! >.<

C++:
uint32_t Player::getAttackSpeed() const {
    int32_t value;
    if (getStorageValue(88888, value)) {
        uint32_t ret = (vocation->getAttackSpeed() * (1 - value * 0.00375));
    }
    else {
        uint32_t ret = vocation->getAttackSpeed();
    }
 

    if (isDualWielding()) {
        double multiplier = 100.0 / static_cast<double>(g_config.getNumber(ConfigManager::DUAL_WIELDING_SPEED_RATE));
        ret = static_cast<uint32_t>(std::ceil(static_cast<double>(ret) * multiplier));
    }

    return ret;
}

You can't define the ret variable in the if/else scope and try to use it outside that scope.

C++:
uint32_t...
That is not how this method works in the source, you have to provide a reference for an int32_t value to store the value in that variable.

C++:
int32_t value;
if (getStorageValue(88888, value)) {
    // do something with value
} else {
    // player doesnt have that storage
}
 
I've tried something like this, but now i get "ret undifined".

Im 100% noob on c++ sorry! >.<

C++:
uint32_t Player::getAttackSpeed() const {
    int32_t value;
    if (getStorageValue(88888, value)) {
        uint32_t ret = (vocation->getAttackSpeed() * (1 - value * 0.00375));
    }
    else {
        uint32_t ret = vocation->getAttackSpeed();
    }
  

    if (isDualWielding()) {
        double multiplier = 100.0 / static_cast<double>(g_config.getNumber(ConfigManager::DUAL_WIELDING_SPEED_RATE));
        ret = static_cast<uint32_t>(std::ceil(static_cast<double>(ret) * multiplier));
    }

    return ret;
}
 
I've tried something like this, but now i get "ret undifined".

Im 100% noob on c++ sorry! >.<

C++:
uint32_t Player::getAttackSpeed() const {
    int32_t value;
    if (getStorageValue(88888, value)) {
        uint32_t ret = (vocation->getAttackSpeed() * (1 - value * 0.00375));
    }
    else {
        uint32_t ret = vocation->getAttackSpeed();
    }
 

    if (isDualWielding()) {
        double multiplier = 100.0 / static_cast<double>(g_config.getNumber(ConfigManager::DUAL_WIELDING_SPEED_RATE));
        ret = static_cast<uint32_t>(std::ceil(static_cast<double>(ret) * multiplier));
    }

    return ret;
}

You can't define the ret variable in the if/else scope and try to use it outside that scope.

C++:
uint32_t Player::getAttackSpeed() const {
    int32_t value;
uint32_t ret;
    if (getStorageValue(88888, value)) {
        ret = (vocation->getAttackSpeed() * (1 - value * 0.00375));
    }
    else {
        ret = vocation->getAttackSpeed();
    }


    if (isDualWielding()) {
        double multiplier = 100.0 / static_cast<double>(g_config.getNumber(ConfigManager::DUAL_WIELDING_SPEED_RATE));
        ret = static_cast<uint32_t>(std::ceil(static_cast<double>(ret) * multiplier));
    }

    return ret;
}
 
Solution
Back
Top