• 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+ Bows & Crossbows don't count as a weapon

  • Thread starter Deleted member 210450
  • Start date
D

Deleted member 210450

Guest
I have very weird problem.
Bows & crossbows don't count as a weapon. I mean, if i have spell with

Code:
needweapon="1"

While have bow/crossbow equipped, it says

"You need to equip a weapon to use this spell".

If I change weapon to e.g. Sword, it works.
It weirdo because i haven't changed anything in crossbows/bows, so I don't understand.
 
Bump & some update.

Actually I realized that only knight's spells require weapon. So apparently it is not a bug. Here goes my question - how can add this?
 
just edit this function and add the weapon type you want:


valid weapon types are:

C++:
    WEAPON_SWORD,
    WEAPON_CLUB,
    WEAPON_AXE,
    WEAPON_SHIELD,
    WEAPON_DISTANCE,
    WEAPON_WAND,
    WEAPON_AMMO,

Nice! So, additional question. If i would like to add separately melee weapons from distance and wands, can i add this like this?

Code:
    if (needWeapon) {
        switch (player->getWeaponType()) {
            case WEAPON_SWORD:
            case WEAPON_CLUB:
            case WEAPON_AXE:
                break;

            default: {
                player->sendCancelMessage(RETURNVALUE_YOUNEEDAWEAPONTOUSETHISSPELL);
                g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
                return false;
            }
        }
    }

if (needDistanceWeapon) {
        switch (player->getWeaponType()) {
            case WEAPON_DISTANCE:
                break;

            default: {
                player->sendCancelMessage(RETURNVALUE_YOUNEEDAWEAPONTOUSETHISSPELL);
                g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
                return false;
            }
        }
    }

if (needWand) {
        switch (player->getWeaponType()) {
            case WEAPON_WAND:
                break;

            default: {
                player->sendCancelMessage(RETURNVALUE_YOUNEEDAWEAPONTOUSETHISSPELL);
                g_game.addMagicEffect(player->getPosition(), CONST_ME_POFF);
                return false;
            }
        }
    }

Or is it not enough and requires additional modifications in source?


Do you have a custom spell?
Yes and no. In the first place i wanted to add that requirement to custom spell, but when it was not working, i tried on already existing.
 
Back
Top