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

Spell [TFS 1.3] Knight Spells - Elemental Weapon Bug Fixx

Hyresu

Professional Dumb
Joined
Apr 7, 2012
Messages
56
Solutions
8
Reaction score
23
Location
Chile
damage.forcecritical = getNumber<int32_t>(L, 10, 0);Hello, as I've seen in some tfs servers, and some otx-based servers, when you have a weapon that has mixed damage between physical and another element, it will hit calculating only with the physical value

For example: a fire sword will calculate the damage as it has 24 attack, not including the 11 fire

You can check if your server has this bug using an umbral masterblade and a gnome sword and compare the damage between them

With this spells, the fórmula will hit based in a workaround of a normal combat:execute, but at least it will hit calculating the 24 physical damage and 11 fire damage from a fire sword

However, normally the function doTargetCombatHealth and doAreaCombatHealth don't include in their formula the armor of the creature
If you want to consider the armor in the spell damage you will have to edit sources, if you don't, the spells will also work, but the physical damage will not be reduced by creature armor

luascript.cpp

In the function doAreaCombatHealth, below:
C++:
        params.impactEffect = getNumber<uint8_t>(L, 7);
add:
C++:
        params.blockedByArmor = getBoolean(L, 9, false);

In the function doTargetCombatHealth, below:
C++:
    params.impactEffect = getNumber<uint8_t>(L, 6);
add:
C++:
    params.blockedByArmor = getBoolean(L, 8, false);

UPDATE 05/03/2020:

I managed to add something missing in the spells, before this fix, the crit was being calculated individually (You could hit 8 monsters and only crit 2). I also fixed the effects to avoid duplicated effects, you should be able now to crit normally with this patch [Download the files again]

luascript.cpp


In function doAreaCombatHealth, below
C++:
damage.primary.value = normal_random(getNumber<int32_t>(L, 6), getNumber<int32_t>(L, 5));
Add
C++:
damage.forcecritical = getNumber<int32_t>(L, 10, 0);

In function doTargetCombatHealth, below
C++:
damage.primary.value = normal_random(getNumber<int32_t>(L, 4), getNumber<int32_t>(L, 5));
Add
C++:
damage.forcecritical = getNumber<int32_t>(L, 9, 0);

enums.h

below
C++:
int affected;
add
C++:
int forcecritical;
below
C++:
affected = 1;
add
C++:
forcecritical = 0;

Next, update the files in this link
This will fix the area crit error in every aoe

combat.cpp

We will replace every
C++:
if (chance != 0 && uniform_random(1, 100) <= chance) {
With
C++:
if ((damage.forcecritical == 2 || (chance != 0 && uniform_random(1, 100) <= chance)) && damage.forcecritical != 1) {

This will help us bypass the chances, as they are being calculated in the lua script

-- End of 05/03/2020 Update --

The functions will now have 2 additional parameters
Lua:
doAreaCombatHealth(cid, type, pos, area, min, max, effect[, origin = ORIGIN_SPELL, checkArmor = false, forcecritical = 0]]])
doTargetCombatHealth(cid, target, type, min, max, effect[, origin = ORIGIN_SPELL, checkArmor = false, forcecritical = 0]]])

Note that you have to edit sources for this spells to work, if you can't edit sources then download the old spells.

Add to your data/spells/lib/spells.lua
Lua:
weaponDistanceEffect = {
[1] = CONST_ANI_WHIRLWINDSWORD,
[2] = CONST_ANI_WHIRLWINDCLUB,
[3] = CONST_ANI_WHIRLWINDAXE,
}
function Player:getSkillFromId(item)
local weapontype = ItemType(item):getWeaponType()
local skills = {
[1] = SKILL_SWORD,
[2] = SKILL_CLUB,
[3] = SKILL_AXE,
}
return self:getEffectiveSkillLevel(skills[weapontype])
end

Replace the spells with the ones uploaded here

If you get any bug, or you have ideas of any kind or you have the answer to this "bug", feel free to reply
 

Attachments

  • spells with source edit.rar
    7 KB · Views: 44 · VirusTotal
  • spells without source edit.rar
    5.5 KB · Views: 27 · VirusTotal
Last edited:
it works perfectly but now the problem is utito tempo
Thank you for the bug report

Replace in data/spells/lib/spells.lua
Lua:
return self:getSkillLevel(skills[weapontype])

With
Lua:
return self:getEffectiveSkillLevel(skills[weapontype])

I updated the post btw, thank you again ^^
 
Last edited:
Thank you for the bug report

Replace in data/spells/lib/spells.lua
Lua:
return self:getSkillLevel(skills[weapontype])

With
Lua:
return self:getEffectiveSkillLevel(skills[weapontype])

I updated the post btw, thank you again ^^
it works perfectly
only that my players say that the critic does not work with the knight D:
 
it works perfectly
only that my players say that the critic does not work with the knight D:
Code:
10:03 A training monk loses 150 hitpoints due to your attack. <- CRIT
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 100 hitpoints due to your attack.
10:03 A training monk loses 150 hitpoints due to your attack. <- CRIT
Try it yourself, at least for me it is working
 
Sorry, I came here to resurrect the topic.


Is it possible to deal more damage to the player or monster when using a wand (wand) and casting an SD rune? Without the wand, the damage is normal, but with the wand, the damage is double?
 
Back
Top