Mateus Robeerto
Excellent OT User
I would like to know if it's possible, for example, when using a sword, the script reads it correctly. This weapon belongs to class A. I've created a unique script for each sword, axe, club, and fist, even though they are all classified as class A weapons. However, when I use an axe, it's recognized as a sword. I aim for it to automatically recognize the axe and execute the correct skill for attacking. I've attempted to add more functions, but without success. Could someone assist me in resolving this issue?
I made alterations and added a regular player with 100 axe skill, yet the damage dealt was significantly less than expected compared to using a sword. Despite the sword having only 10 skill, it inflicts more damage than the axe. I intended for it to recognize the specific skill when equipped with an axe, ensuring it deals the appropriate damage. However, it consistently recognizes only the sword. I'm having difficulty making it function properly; any assistance would be appreciated.
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
function onGetFormulaValues(cid, level, maglevel)
local player = Player(cid)
if not player then
return 0, 0
end
local skill = player:getSkillLevel(SKILL_SWORD)
local playerLevel = player:getLevel()
local min = -((skill * 18) + playerLevel * 9)
local max = -((skill * 27) + playerLevel * 9)
return min, max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onUseWeapon(cid, var)
combat:execute(cid, var)
end
I made alterations and added a regular player with 100 axe skill, yet the damage dealt was significantly less than expected compared to using a sword. Despite the sword having only 10 skill, it inflicts more damage than the axe. I intended for it to recognize the specific skill when equipped with an axe, ensuring it deals the appropriate damage. However, it consistently recognizes only the sword. I'm having difficulty making it function properly; any assistance would be appreciated.
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
function onGetFormulaValues(cid, level, maglevel)
local player = Player(cid)
if not player then
return 0, 0
end
local swordSkill = player:getSkillLevel(SKILL_SWORD)
local axeSkill = player:getSkillLevel(SKILL_AXE)
local fistSkill = player:getSkillLevel(SKILL_FIST)
local clubSkill = player:getSkillLevel(SKILL_CLUB)
local playerLevel = player:getLevel()
local min = -(((swordSkill + axeSkill + fistSkill + clubSkill) * 18) + playerLevel * 9)
local max = -(((swordSkill + axeSkill + fistSkill + clubSkill) * 27) + playerLevel * 9)
return min, max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onUseWeapon(cid, var)
combat:execute(cid, var)
end