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

If player have X storage then get 2 attacks per second

Dran Ryszard

Member
Joined
Apr 25, 2023
Messages
52
Reaction score
12
Location
Poland
Hi, i think about little character update, then if player got X storage, he have 2 attacks per second for few min or something like that.
(Im not tried anything for now, only thinking xD)

So in my head, i thinked something like that.
- Add that function - Lua Function - [TFS 1.2/1.3] player:setAttackSpeed(ms) | player:getAttackSpeed() (https://otland.net/threads/tfs-1-2-1-3-player-setattackspeed-ms-player-getattackspeed.257468/)
And then check in login event if player have X storage then set X attackspeed, but if someone use that upgrade without logout/login then he not get 2aps
So there is my question, how to check if player have X storage to add him more attack per sec?

Its possible to check storage in every singel attack? Or it get to much memory of server and possible to make lags?
 
just inflict demage 2x instead of attack speed, maybe such way is easier to make and would work also good, while storage xxx for xx time, player deal double hits, epic idea, but i think display in screen would show 1 hit , idk.. Just chating :)))
 
just inflict demage 2x instead of attack speed, maybe such way is easier to make and would work also good, while storage xxx for xx time, player deal double hits, epic idea, but i think display in screen would show 1 hit , idk.. Just chating :)))

ye good idea, but you know, its not impressive like two shoots in one second :D
Mhm, maybe someone know, that function is using in every single shot?
Code:
void Player::doAttacking(uint32_t)
{
    if (lastAttack == 0) {
        lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
    }

    if (hasCondition(CONDITION_PACIFIED)) {
        return;
    }

    if ((OTSYS_TIME() - lastAttack) >= getAttackSpeed()) {
        bool result = false;

        Item* tool = getWeapon();
        const Weapon* weapon = g_weapons->getWeapon(tool);
        uint32_t delay = getAttackSpeed();
        bool classicSpeed = g_config.getBoolean(ConfigManager::CLASSIC_ATTACK_SPEED);

        if (weapon) {
            if (!weapon->interruptSwing()) {
                result = weapon->useWeapon(this, tool, attackedCreature);
            } else if (!classicSpeed && !canDoAction()) {
                delay = getNextActionTime();
            } else {
                result = weapon->useWeapon(this, tool, attackedCreature);
            }
        } else {
            result = Weapon::useFist(this, attackedCreature);
        }

        SchedulerTask* task = createSchedulerTask(std::max<uint32_t>(SCHEDULER_MINTICKS, delay), std::bind(&Game::checkCreatureAttack, &g_game, getID()));
        if (!classicSpeed) {
            setNextActionTask(task, false);
        } else {
            g_scheduler.addEvent(task);
        }

        if (result) {
            lastAttack = OTSYS_TIME();
        }
    }
}
 
ye good idea, but you know, its not impressive like two shoots in one second :D
Mhm, maybe someone know, that function is using in every single shot?
Code:
void Player::doAttacking(uint32_t)
{
    if (lastAttack == 0) {
        lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
    }

    if (hasCondition(CONDITION_PACIFIED)) {
        return;
    }

    if ((OTSYS_TIME() - lastAttack) >= getAttackSpeed()) {
        bool result = false;

        Item* tool = getWeapon();
        const Weapon* weapon = g_weapons->getWeapon(tool);
        uint32_t delay = getAttackSpeed();
        bool classicSpeed = g_config.getBoolean(ConfigManager::CLASSIC_ATTACK_SPEED);

        if (weapon) {
            if (!weapon->interruptSwing()) {
                result = weapon->useWeapon(this, tool, attackedCreature);
            } else if (!classicSpeed && !canDoAction()) {
                delay = getNextActionTime();
            } else {
                result = weapon->useWeapon(this, tool, attackedCreature);
            }
        } else {
            result = Weapon::useFist(this, attackedCreature);
        }

        SchedulerTask* task = createSchedulerTask(std::max<uint32_t>(SCHEDULER_MINTICKS, delay), std::bind(&Game::checkCreatureAttack, &g_game, getID()));
        if (!classicSpeed) {
            setNextActionTask(task, false);
        } else {
            g_scheduler.addEvent(task);
        }

        if (result) {
            lastAttack = OTSYS_TIME();
        }
    }
}
idk about codes, but i got so op idea i think

i hope someone reads and maybe even make it real


so like there is those mana leech chance , mana leech ammount, or critical hit chance-critical hit demage(amount) skills...

So to make like a new skill, Double Hit Chance, lets say by click some item player gains 0.1% Double Hit Chance, and keeps stacking, shoud be with limit lets say, 25% chance to double hit, also this bonus shoud appear on player to be vissible like "Double Hit Chance 1.2%''

so yeah, if double, hit it shoud double hit , whatever voc you are, wands/rods/weps/distance weps, it shoud kinda like double hit, more realistic as possible

:)))
 
Ok, i was tried something. But not with attack speed, i was maked wand script, when i added events 250ms/500ms, so its imitation of attack speed. But i don;t understand why distance effect is send only one time? Damage with poison effect is doubeld, but distance effect no :(

Code:
local min, max = 140,150 


function onUseWeapon(player, variant)
    local target = Creature(variant:getNumber())
    if target then
        local target_pos = target:getPosition()
        addEvent(doAreaCombatHealth, 250, player.uid, COMBAT_POISONDAMAGE, target_pos, 0, -min, -max, player:getPosition():sendDistanceEffect(target_pos, 29))
        addEvent(doAreaCombatHealth, 500, player.uid, COMBAT_POISONDAMAGE, target_pos, 0, -min, -max, player:getPosition():sendDistanceEffect(target_pos, 29))
    end
    return true
end
 
Ok, i was tried something. But not with attack speed, i was maked wand script, when i added events 250ms/500ms, so its imitation of attack speed. But i don;t understand why distance effect is send only one time? Damage with poison effect is doubeld, but distance effect no :(

Code:
local min, max = 140,150


function onUseWeapon(player, variant)
    local target = Creature(variant:getNumber())
    if target then
        local target_pos = target:getPosition()
        addEvent(doAreaCombatHealth, 250, player.uid, COMBAT_POISONDAMAGE, target_pos, 0, -min, -max, player:getPosition():sendDistanceEffect(target_pos, 29))
        addEvent(doAreaCombatHealth, 500, player.uid, COMBAT_POISONDAMAGE, target_pos, 0, -min, -max, player:getPosition():sendDistanceEffect(target_pos, 29))
    end
    return true
end
up up
 
Back
Top