• 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.5 by nekiro palladin no attack weapon when use pot

jareczekjsp

Member
Joined
Jan 30, 2023
Messages
202
Reaction score
11
GitHub
Jarek123
Hello guys I use tfs 1.5 and I have problem whe palladin use potion sto attack from weapon how I can change this ?

If I change in config.lua
Lua:
classicAttackSpeed = false
to
Code:
classicAttackSpeed = true
Is every time lags

when I add to weapons.xml
swing="true" --- not working

I try compile in weapons.h i Change


change from
error in console
Code:
/home/ots/src/weapons.h:79:22: error: ‘bool Weapon::interruptSwing() const’ mark                                ed ‘final’, but is not virtual
   79 |                 bool interruptSwing() const final {
      |                      ^~~~~~~~~~~~~~
/home/ots/src/weapons.h: In member function ‘bool Weapon::interruptSwing() cons                                 ’:
/home/ots/src/weapons.h:81:17: error: expected ‘;’ before ‘}’ token
   81 |                 }
      |                 ^
In file included from /home/ots/src/combat.cpp:25:
/home/ots/src/weapons.h: At global scope:
/home/ots/src/weapons.h:264:22: error: ‘bool WeaponDistance::interruptSwing() co                                nst’ marked ‘override’, but does not override
  264 |                 bool interruptSwing() const override {
      |                      ^~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/tfs.dir/build.make:189: CMakeFiles/tfs.dir/src/combat.c                                pp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:102: CMakeFiles/tfs.dir/all] Error 2
 
config.lua change:

Lua:
-- Item Usage
timeBetweenActions = 200
timeBetweenExActions = 1000

to
Code:
timeBetweenActions = nil
timeBetweenExActions = nil
 
weapon xml check if you have exhaustion in weapon
And test your same weapon with this
Lua:
        <distance swing="true" id="8851" level="45" unproperly="1" event="function" value="default"> <!-- Modified Crossbow -->
        <vocation id="3"/>
        <vocation id="7" showInDescription="0"/>
    </distance>
 
weapon xml check if you have exhaustion in weapon
And test your same weapon with this
Lua:
        <distance swing="true" id="8851" level="45" unproperly="1" event="function" value="default"> <!-- Modified Crossbow -->
        <vocation id="3"/>
        <vocation id="7" showInDescription="0"/>
    </distance>
The same bro,when I use potion no attack
Post automatically merged:

weapons.h
Lua:
#ifndef FS_WEAPONS_H_69D1993478AA42948E24C0B90B8F5BF5
#define FS_WEAPONS_H_69D1993478AA42948E24C0B90B8F5BF5

#include "luascript.h"
#include "player.h"
#include "baseevents.h"
#include "combat.h"
#include "const.h"
#include "vocation.h"

extern Vocations g_vocations;

class Weapon;
class WeaponMelee;
class WeaponDistance;
class WeaponWand;

using Weapon_ptr = std::unique_ptr<Weapon>;

class Weapons final : public BaseEvents
{
    public:
        Weapons();
        ~Weapons();

        // non-copyable
        Weapons(const Weapons&) = delete;
        Weapons& operator=(const Weapons&) = delete;

        void loadDefaults();
        const Weapon* getWeapon(const Item* item) const;

        static int32_t getMaxMeleeDamage(int32_t attackSkill, int32_t attackValue);
        static int32_t getMaxWeaponDamage(uint32_t level, int32_t attackSkill, int32_t attackValue, float attackFactor);

        bool registerLuaEvent(Weapon* event);
        void clear(bool fromLua) override final;

    private:
        LuaScriptInterface& getScriptInterface() override;
        std::string getScriptBaseName() const override;
        Event_ptr getEvent(const std::string& nodeName) override;
        bool registerEvent(Event_ptr event, const pugi::xml_node& node) override;

        std::map<uint32_t, Weapon*> weapons;

        LuaScriptInterface scriptInterface { "Weapon Interface" };
};

class Weapon : public Event
{
    public:
        explicit Weapon(LuaScriptInterface* interface) : Event(interface) {}

        bool configureEvent(const pugi::xml_node& node) override;
        bool loadFunction(const pugi::xml_attribute&, bool) final {
            return true;
        }
        virtual void configureWeapon(const ItemType& it);
        virtual bool interruptSwing() const {
            return false;
        }

        int32_t playerWeaponCheck(Player* player, Creature* target, uint8_t shootRange) const;
        static bool useFist(Player* player, Creature* target);
        virtual bool useWeapon(Player* player, Item* item, Creature* target) const;

        virtual int32_t getWeaponDamage(const Player* player, const Creature* target, const Item* item, bool maxDamage = false) const = 0;
        virtual int32_t getElementDamage(const Player* player, const Creature* target, const Item* item) const = 0;
        virtual CombatType_t getElementType() const = 0;

        uint16_t getID() const {
            return id;
        }
        void setID(uint16_t newId) {
            id = newId;
        }

        uint32_t getReqLevel() const {
            return level;
        }
        void setRequiredLevel(uint32_t reqlvl) {
            level = reqlvl;
        }

        uint32_t getReqMagLv() const {
            return magLevel;
        }
        void setRequiredMagLevel(uint32_t reqlvl) {
            magLevel = reqlvl;
        }

        bool isPremium() const {
            return premium;
        }
        void setNeedPremium(bool prem) {
            premium = prem;
        }

        bool isWieldedUnproperly() const {
            return wieldUnproperly;
        }
        void setWieldUnproperly(bool unproperly) {
            wieldUnproperly = unproperly;
        }

        uint32_t getMana() const {
            return mana;
        }
        void setMana(uint32_t m) {
            mana = m;
        }

        uint32_t getManaPercent() const {
            return manaPercent;
        }
        void setManaPercent(uint32_t m) {
            manaPercent = m;
        }

        int32_t getHealth() const {
            return health;
        }
        void setHealth(int32_t h) {
            health = h;
        }

        uint32_t getHealthPercent() const {
            return healthPercent;
        }
        void setHealthPercent(uint32_t m) {
            healthPercent = m;
        }

        uint32_t getSoul() const {
            return soul;
        }
        void setSoul(uint32_t s) {
            soul = s;
        }

        uint8_t getBreakChance() const {
            return breakChance;
        }
        void setBreakChance(uint8_t b) {
            breakChance = b;
        }

        bool isEnabled() const {
            return enabled;
        }
        void setIsEnabled(bool e) {
            enabled = e;
        }

        uint32_t getWieldInfo() const {
            return wieldInfo;
        }
        void setWieldInfo(uint32_t info) {
            wieldInfo |= info;
        }

        void addVocWeaponMap(std::string vocName) {
            int32_t vocationId = g_vocations.getVocationId(vocName);
            if (vocationId != -1) {
                vocWeaponMap[vocationId] = true;
            }
        }

        const std::string& getVocationString() const {
            return vocationString;
        }
        void setVocationString(const std::string& str) {
            vocationString = str;
        }

        WeaponAction_t action = WEAPONACTION_NONE;
        CombatParams params;
        WeaponType_t weaponType;
        std::map<uint16_t, bool> vocWeaponMap;

    protected:
        void internalUseWeapon(Player* player, Item* item, Creature* target, int32_t damageModifier) const;
        void internalUseWeapon(Player* player, Item* item, Tile* tile) const;

        uint16_t id = 0;

    private:
        virtual bool getSkillType(const Player*, const Item*, skills_t&, uint32_t&) const {
            return false;
        }

        uint32_t getManaCost(const Player* player) const;
        int32_t getHealthCost(const Player* player) const;

        uint32_t level = 0;
        uint32_t magLevel = 0;
        uint32_t mana = 0;
        uint32_t manaPercent = 0;
        uint32_t health = 0;
        uint32_t healthPercent = 0;
        uint32_t soul = 0;
        uint32_t wieldInfo = WIELDINFO_NONE;
        uint8_t breakChance = 0;
        bool enabled = true;
        bool premium = false;
        bool wieldUnproperly = false;
        std::string vocationString = "";

        std::string getScriptEventName() const override final;

        bool executeUseWeapon(Player* player, const LuaVariant& var) const;
        void onUsedWeapon(Player* player, Item* item, Tile* destTile) const;

        static void decrementItemCount(Item* item);

        friend class Combat;
};

class WeaponMelee final : public Weapon
{
    public:
        explicit WeaponMelee(LuaScriptInterface* interface);

        void configureWeapon(const ItemType& it) override;

        bool useWeapon(Player* player, Item* item, Creature* target) const override;

        int32_t getWeaponDamage(const Player* player, const Creature* target, const Item* item, bool maxDamage = false) const override;
        int32_t getElementDamage(const Player* player, const Creature* target, const Item* item) const override;
        CombatType_t getElementType() const override { return elementType; }

    private:
        bool getSkillType(const Player* player, const Item* item, skills_t& skill, uint32_t& skillpoint) const override;

        CombatType_t elementType = COMBAT_NONE;
        uint16_t elementDamage = 0;
};

class WeaponDistance final : public Weapon
{
    public:
        explicit WeaponDistance(LuaScriptInterface* interface);

        void configureWeapon(const ItemType& it) override;
        bool interruptSwing() const override {
            return true;
        }

        bool useWeapon(Player* player, Item* item, Creature* target) const override;

        int32_t getWeaponDamage(const Player* player, const Creature* target, const Item* item, bool maxDamage = false) const override;
        int32_t getElementDamage(const Player* player, const Creature* target, const Item* item) const override;
        CombatType_t getElementType() const override { return elementType; }

    private:
        bool getSkillType(const Player* player, const Item* item, skills_t& skill, uint32_t& skillpoint) const override;

        CombatType_t elementType = COMBAT_NONE;
        uint16_t elementDamage = 0;
};

class WeaponWand final : public Weapon
{
    public:
        explicit WeaponWand(LuaScriptInterface* interface) : Weapon(interface) {}

        bool configureEvent(const pugi::xml_node& node) override;
        void configureWeapon(const ItemType& it) override;

        int32_t getWeaponDamage(const Player* player, const Creature* target, const Item* item, bool maxDamage = false) const override;
        int32_t getElementDamage(const Player*, const Creature*, const Item*) const override { return 0; }
        CombatType_t getElementType() const override { return COMBAT_NONE; }

        void setMinChange(int32_t change) {
            minChange = change;
        }

        void setMaxChange(int32_t change) {
            maxChange = change;
        }

    private:
        bool getSkillType(const Player*, const Item*, skills_t&, uint32_t&) const override {
            return false;
        }

        int32_t minChange = 0;
        int32_t maxChange = 0;
};

#endif
 
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<weapons>
    <!-- Bows and Crossbows -->
    <distance id="8849" level="45" unproperly="1" event="function" value="default"> <!-- Modified Crossbow -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
    <distance id="8853" level="80" unproperly="1" event="function" value="default"> <!-- Ironworker -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
    <distance id="8852" level="100" unproperly="1" event="function" value="default"> <!-- Devileye -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
    <distance id="8851" level="130" unproperly="1" event="function" value="default"> <!-- Royal Crossbow -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
    <distance id="8857" swing="true" level="8" unproperly="1" event="function" value="default"> <!-- Silkweaver Bow -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
    <distance id="8855" level="50" unproperly="1" event="function" value="default"> <!-- Composite Hornbow -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
    <distance id="8856" level="60" unproperly="1" event="function" value="default"> <!-- Yol's Bow -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
    <distance id="8858" level="70" unproperly="1" event="function" swing="true" value="default"> <!-- Elethriel's Elemental Bow -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
    <distance id="8854" level="80" unproperly="1" event="function" value="default"> <!-- Warsinger Bow -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
        <distance id="2352" range="7" enabled="1" hitchance="100" swing="true" level="1500" script="santera.lua"> <!-- Winning Spear -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
        <distance id="2433" range="7" enabled="1" hitchance="100" swing="true" level="2" script="staff.lua"> <!-- Winning Spear -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
    <distance id="2545" event="script" swing="true" value="poison_arrow.lua"/>
    <distance id="2546" event="script" swing="true" value="burst_arrow.lua"/>
    <distance id="7838" type="energy" swing="true" event="function" value="default"/>
    <distance id="7839" type="ice" swing="true" event="function" value="default"/>
    <distance id="7840" type="fire" swing="true" event="function" value="default"/>
    <distance id="7850" type="earth" swing="true" event="function" value="default"/>
        <distance id="7366" level="8" swing="true" event="function" value="default"/> <!-- Hunting Spear -->
    <distance id="3965" level="20" swing="true" event="function" value="default"/> <!-- Hunting Spear -->
        <distance id="5907" level="8"  event="function" value="default"> <!-- Mega Slingshot -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
</distance>
        <distance id="8850" level="8" swing="true" event="function" value="default"/> <!-- Assault Bowbolt -->
    <distance id="7378" level="7" swing="true" event="function" value="default"/> <!-- Royal Spear -->
    <distance id="7367" level="42" swing="true" event="function" value="default"/> <!-- Enchanted Spear -->
    <distance id="7368" level="80" swing="true" event="function" value="default"/> <!-- Assassin Star -->
        <distance id="2425" level="100" swing="true" event="function" value="default"/> <!-- Megafree Spear -->
    <distance id="7364" level="20" swing="true" event="function" value="default"/> <!-- Sniper Arrow -->
    <distance id="7365" level="40" swing="true" event="function" value="default"/> <!-- Onyx Arrow -->
    <distance id="7363" level="30" swing="true" event="function" value="default"/> <!-- Piercing Bolt -->
    <distance id="2547" level="55" swing="true" event="function" value="default"/> <!-- Power Bolt -->
    <distance id="6529" level="70" swing="true" event="function" value="default"/> <!-- Infernal Bolt -->
</weapons>
id 2352 and 8858
Post automatically merged:

tfs 1.5. by nekiro of course
swing option in weapons.ml no working the same

iin config.lua

classicAttackSpeed = false
to
Code:
classicAttackSpeed = true


-- Item Usage
timeBetweenActions = 200
timeBetweenExActions = 1000

to
Code:
timeBetweenActions = nil
timeBetweenExActions = nil
 
Last edited:
timeBetweenActions = nil
timeBetweenExActions = nil
= buged in mana potion
test weapon xml
XML:
    </distance>
       <distance id="2352" range="7" level="1500" enabled="1" exhaustion="0" hitchance="100" ammo="removecount" script="santera.lua.lua"> <!-- Winning Spear -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
Test
 
timeBetweenActions = nil
timeBetweenExActions = nil
= buged in mana potion
test weapon xml
XML:
    </distance>
       <distance id="2352" range="7" level="1500" enabled="1" exhaustion="0" hitchance="100" ammo="removecount" script="santera.lua.lua"> <!-- Winning Spear -->
        <vocation name="Paladin" />
        <vocation name="Ninja" />
        <vocation name="Super Ninja" />
    </distance>
Test
no working
 
try this
 
try this
no working, sorry guys when I use
classicAttackSpeed = true

Working great buy is tooo high cpu
 
how much your speed attack in vocations?
<vocation id="5" clientid="3" name="Shaman" description="a shaman" gaincap="10" gainhp="5" gainmana="30" gainhpticks="1" gainhpamount="130" gainmanaticks="1" gainmanaamount="250" manamultiplier="1.1" attackspeed="400" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="1" noPongKickTime="40">
<formula meleeDamage="1.0" distDamage="1.3" defense="1.4" armor="1.4" />
<skill id="0" multiplier="1.5" />
<skill id="1" multiplier="2.0" />
<skill id="2" multiplier="2.0" />
<skill id="3" multiplier="2.0" />
<skill id="4" multiplier="2.0" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="6" clientid="4" name="Priest" description="an priest" gaincap="10" gainhp="5" gainmana="30" gainhpticks="1" gainhpamount="130" gainmanaticks="1" gainmanaamount="250" manamultiplier="1.1" attackspeed="400" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="2" noPongKickTime="40">
<formula meleeDamage="1.0" distDamage="1.3" defense="1.4" armor="1.4" />
<skill id="0" multiplier="1.5" />
<skill id="1" multiplier="1.8" />
<skill id="2" multiplier="1.8" />
<skill id="3" multiplier="1.8" />
<skill id="4" multiplier="1.8" />
<skill id="5" multiplier="1.5" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="7" clientid="2" name="Ninja" description="a ninja" gaincap="20" gainhp="10" gainmana="30" gainhpticks="1" gainhpamount="150" gainmanaticks="1" gainmanaamount="220" manamultiplier="1.4" attackspeed="400" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="3" noPongKickTime="50">
<formula meleeDamage="1.0" distDamage="1.1" defense="1.1" armor="1.2" />
<skill id="0" multiplier="1.2" />
<skill id="1" multiplier="1.2" />
<skill id="2" multiplier="1.2" />
<skill id="3" multiplier="1.2" />
<skill id="4" multiplier="1.1" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
<vocation id="8" clientid="1" name="Warrior" description="an warrior" gaincap="25" gainhp="15" gainmana="5" gainhpticks="1" gainhpamount="250" gainmanaticks="1" gainmanaamount="200" manamultiplier="3.0" attackspeed="420" basespeed="220" soulmax="200" gainsoulticks="15" fromvoc="4">
<formula meleeDamage="1.1" distDamage="1.0" defense="1.2" armor="1.1" />
<skill id="0" multiplier="1.1" />
<skill id="1" multiplier="1.1" />
<skill id="2" multiplier="1.1" />
<skill id="3" multiplier="1.1" />
<skill id="4" multiplier="1.4" />
<skill id="5" multiplier="1.1" />
<skill id="6" multiplier="1.1" />
</vocation>
 
Back
Top