• Sign up for TFS Icon Competition! The prize includes Otland Premium time and a medal, as well as obviously taking part in TFS history.
  • 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!

Lua help with my spell please

darknelson

Member
Joined
Jun 19, 2011
Messages
135
Reaction score
5
i make a spell for my ot server, it uses skill function, im trying to make again exori, but work with distance skill and melee skills, (have 1 vocation server) and i tested it with 100 dstance hit around 100-400 (other skills 10) and with 100 sword hit 3000, so why it not counting distance as skill? can you help me? my server is one vocation and players can up melee as fast as distance or ml but, this is pretty unfair for people who want use distance things, cause is not counting distance as same skill on melee, please help me to solve it


Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_USECHARGES, 1)
combat:setArea(createCombatArea(AREA_SQUARE1X1))

function onGetFormulaValues(player, skill, attack, factor)
    local skillTotal = 2 * player:getEffectiveSkillLevel(SKILL_AXE) and 2 * player:getEffectiveSkillLevel(SKILL_SWORD) and 2 * player:getEffectiveSkillLevel(SKILL_DISTANCE) and 2 * player:getEffectiveSkillLevel(SKILL_CLUB)
    local levelTotal = player:getLevel() / 5
    return -(((skillTotal + attack / 3500) * 1.35) + (levelTotal) + 5), -(((skillTotal + attack / 3125) * 1.5) + (levelTotal) + 10)
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end


everythings works fine, but the player distance skill not working, but if i change it for first place, for example, distance 1 axe 3 axe stop works, but 4 club always working. why just third not work?
 
Last edited:

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,242
Solutions
333
Reaction score
3,358
i make a spell for my ot server, it uses skill function, im trying to make again exori, but work with distance skill and melee skills, (have 1 vocation server) and i tested it with 100 dstance hit around 100-400 (other skills 10) and with 100 sword hit 3000, so why it not counting distance as skill? can you help me? my server is one vocation and players can up melee as fast as distance or ml but, this is pretty unfair for people who want use distance things, cause is not counting distance as same skill on melee, please help me to solve it


Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_USECHARGES, 1)
combat:setArea(createCombatArea(AREA_SQUARE1X1))

function onGetFormulaValues(player, skill, attack, factor)
    local skillTotal = 2 * player:getEffectiveSkillLevel(SKILL_AXE) and 2 * player:getEffectiveSkillLevel(SKILL_SWORD) and 2 * player:getEffectiveSkillLevel(SKILL_DISTANCE) and 2 * player:getEffectiveSkillLevel(SKILL_CLUB)
    local levelTotal = player:getLevel() / 5
    return -(((skillTotal + attack / 3500) * 1.35) + (levelTotal) + 5), -(((skillTotal + attack / 3125) * 1.5) + (levelTotal) + 10)
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end


everythings works fine, but the player distance skill not working, but if i change it for first place, for example, distance 1 axe 3 axe stop works, but 4 club always working. why just third not work?
My theory is that bows don't have an attack value, arrows do, hence the damage difference.

Print all the values, and figure out where it's going wrong.
Lua:
function onGetFormulaValues(player, skill, attack, factor)
    print("attack:" .. attack)
    print("SKILL_AXE:" .. player:getEffectiveSkillLevel(SKILL_AXE))
    print("SKILL_SWORD:" .. player:getEffectiveSkillLevel(SKILL_SWORD))
    print("SKILL_DISTANCE:" .. player:getEffectiveSkillLevel(SKILL_DISTANCE))
    print("SKILL_CLUB:" .. player:getEffectiveSkillLevel(SKILL_CLUB))
    local skillTotal = 2 * player:getEffectiveSkillLevel(SKILL_AXE) and 2 * player:getEffectiveSkillLevel(SKILL_SWORD) and 2 * player:getEffectiveSkillLevel(SKILL_DISTANCE) and 2 * player:getEffectiveSkillLevel(SKILL_CLUB)
    local levelTotal = player:getLevel() / 5
    return -(((skillTotal + attack / 3500) * 1.35) + (levelTotal) + 5), -(((skillTotal + attack / 3125) * 1.5) + (levelTotal) + 10)
end
 
Top