• 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.X+ Sudden death rune - Exaust on monster movement

bpm91

Advanced OT User
Joined
May 23, 2019
Messages
1,046
Solutions
7
Reaction score
177
Location
Brazil
YouTube
caruniawikibr
I have a small problem, my SD is in revscript. The problem is that when you try to use creatures that walk very fast in battle, you can't hit them and I get the message "you can only attack creatures" as if the floor they passed was fast enough to not recognize the creature in battle.

I'm using a version 1.5 nekiro 7.72 with spells converted to TVP "real formulas from old tibia"

Basically I just need the SD to hit the creature in battle regardless of its position on the map, as this causes exhaustion in the player.


XML:
local spell = Spell(SPELL_INSTANT)

spell:needLearn(true)
spell:mana(220)
spell:magicLevel(25)
spell:soul(0)
spell:isAggressive(false)
spell:name("Sudden Death")
spell:vocation("Sorcerer", "Master Sorcerer")
spell:words("ad,ori, vita, vis")

function spell.onCastSpell(creature, variant)
    return creature:conjureItem(220, 2260, 2268, 1)
end

spell:register()

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, true)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, false)
combat:setArea(createCombatArea(AREA_SINGLE))

function onGetFormulaValues(player, level, magicLevel)
    return player:computeDamage(150, 20)
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local rune = Spell(SPELL_RUNE)

function rune.onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

rune:runeMagicLevel(15)
rune:runeId(2268)
rune:charges(1)
rune:allowFarUse(true)
rune:blockWalls(true)
rune:checkFloor(true)
rune:isBlocking(true)
rune:needTarget(true)
rune:isAggressive(true)
rune:register()
Post automatically merged:

LUA:
bool Spell::playerRuneSpellCheck(Player* player, const Position& toPos)
{
    if (!playerSpellCheck(player)) {
        return false;
    }

    if (toPos.x == 0xFFFF) {
        return true;
    }

    const Position& playerPos = player->getPosition();
    if (playerPos.z > toPos.z) {
        player->sendCancelMessage(RETURNVALUE_FIRSTGOUPSTAIRS);
        g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
        return false;
    } else if (playerPos.z < toPos.z) {
        player->sendCancelMessage(RETURNVALUE_FIRSTGODOWNSTAIRS);
        g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
        return false;
    }

    Tile* tile = g_game.map.getTile(toPos);
    if (!tile) {
        player->sendCancelMessage(RETURNVALUE_NOTPOSSIBLE);
        g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
        return false;
    }

    if (range != -1 && !g_game.canThrowObjectTo(playerPos, toPos, true, true, range, range)) {
        player->sendCancelMessage(RETURNVALUE_DESTINATIONOUTOFREACH);
        g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
        return false;
    }

    ReturnValue ret = Combat::canDoCombat(player, tile, aggressive);
    if (ret != RETURNVALUE_NOERROR) {
        player->sendCancelMessage(ret);
        g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
        return false;
    }

    const Creature* topVisibleCreature = tile->getBottomVisibleCreature(player);
    if (blockingCreature && topVisibleCreature) {
        player->sendCancelMessage(RETURNVALUE_NOTENOUGHROOM);
        g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
        return false;
    } else if (blockingSolid && tile->hasFlag(TILESTATE_BLOCKSOLID)) {
        player->sendCancelMessage(RETURNVALUE_NOTENOUGHROOM);
        g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
        return false;
    }

    if (needTarget && !topVisibleCreature) {
        player->sendCancelMessage(RETURNVALUE_CANONLYUSETHISRUNEONCREATURES);
        g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
        return false;
    }

    if (aggressive && needTarget && topVisibleCreature && player->hasSecureMode()) {
        const Player* targetPlayer = topVisibleCreature->getPlayer();
        if (targetPlayer && targetPlayer != player && player->getSkullClient(targetPlayer) == SKULL_NONE && !Combat::isInPvpZone(player, targetPlayer)) {
            player->sendCancelMessage(RETURNVALUE_TURNSECUREMODETOATTACKUNMARKEDPLAYERS);
            g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
            return false;
        }
    }
    return true;
}
Post automatically merged:

It seems like I need to stop for the rune to hit. If I keep shooting without stopping it says "you can only attack creatures"
Post automatically merged:

I switched to original base spells, but the error continues, I believe it would be the character's movement while walking and he cannot use the rune
Post automatically merged:

with GM for example where there is no cooldown when walking and using it works, the problem is that the player cannot walk and use it.
 
Last edited:
the problem is Game:PlayerUseWithCreature
For some reason in my battle list, otcv8 understands that it is the position of the monster and not the monster itself. That's why sometimes I have trouble hitting the monster when it's moving quickly. Has anyone experienced this?


1737581422379.webp


When adding a log here, I also didn't get any information when using rune on creature.
std::cout << "Using AIMBOT rune to " << creatureId << std::endl;

I use otcv8, if anyone can help me with any information I would appreciate it

LUA:
oid Game::playerUseWithCreature(uint32_t playerId, const Position& fromPos, uint8_t fromStackPos, uint32_t creatureId, uint16_t spriteId)
{
   
    Player* player = getPlayerByID(playerId);
    if (!player) {
        return;
    }

    Creature* creature = getCreatureByID(creatureId);
    if (!creature) {
        return;
    }
   
    if (!Position::areInRange<Map::maxClientViewportX - 1, Map::maxClientViewportY - 1, 0>(creature->getPosition(), player->getPosition())) {
        return;
    }

    bool isHotkey = (fromPos.x == 0xFFFF && fromPos.y == 0 && fromPos.z == 0);
    if (!g_config.getBoolean(ConfigManager::AIMBOT_HOTKEY_ENABLED)) {
        if (creature->getPlayer() || isHotkey) {
            player->sendCancelMessage(RETURNVALUE_DIRECTPLAYERSHOOT);
            return;
        }
    }
Post automatically merged:

Only add
g_game.enableFeature(GameForceAllowItemHotkeys)
 
Last edited:
Back
Top