• 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 0.X Weapon

qruczu

New Member
Joined
Jan 8, 2012
Messages
104
Reaction score
0
Hello, i make weapon like this
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 1.5 + levelTotal), -(skillTotal * 1.5 + levelTotal)
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


function onUseWeapon(cid, var)
return doCombat(cid, combat, var)
end
but if i change in vocation > magDMG then weapon have more hit
i need if i change meleeDMG then weapon hit have more dmg
how fix that ?
 
Hello, i make weapon like this
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 1.5 + levelTotal), -(skillTotal * 1.5 + levelTotal)
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


function onUseWeapon(cid, var)
return doCombat(cid, combat, var)
end
but if i change in vocation > magDMG then weapon have more hit
i need if i change meleeDMG then weapon hit have more dmg
how fix that ?
combat is read by engine as "spell", thats why its multipled by magDMG, you need source edit for it. You need add extra line for it like "magWeaponDMG"

After this
C++:
                pugi::xml_attribute distDamageAttribute = childNode.attribute("distDamage");
                if (distDamageAttribute) {
                    voc.distDamageMultiplier = pugi::cast<float>(distDamageAttribute.value());
                }
add this
Code:
                pugi::xml_attribute MWDamageAttribute = childNode.attribute("MWDamage");
                if (MWDamageAttribute) {
                    voc.MWDamageMultiplier = pugi::cast<float>(spellDamageAttribute.value());
                }
Exchange this:
C++:
        float meleeDamageMultiplier = 1.0f;
        float distDamageMultiplier = 1.0f;
        float defenseMultiplier = 1.0f;
        float armorMultiplier = 1.0f;
to this:
C++:
        float meleeDamageMultiplier = 1.0f;
        float distDamageMultiplier = 1.0f;
        float MWDamageMultiplier = 1.0f;
        float defenseMultiplier = 1.0f;
        float armorMultiplier = 1.0f;

Anyway i dont know what engine u have and how you have registered "spell" multiple, i just show you "the way" do that, if you need help with it, you must paste you sources.
 
0.3.6
8.6
but if i change formula to this:
Lua:
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 50, 1.5, 100)
then its good but this formula dont have lvl calculate
 
Last edited:
Code:
function onUseWeapon(cid, var, enemy)
local damage = (((cid:getLevel() * 1) + (cid:getEffectiveSkillLevel(SKILL_SWORD) * 1) + (cid:getTotalAttack() * 1)) * 1.0)
return doTargetCombatHealth(cid, enemy, COMBAT_PHYSICALDAMAGE, -damage, -damage, 1)
end
 
Code:
function onUseWeapon(cid, var, enemy)
local damage = (((cid:getLevel() * 1) + (cid:getEffectiveSkillLevel(SKILL_SWORD) * 1) + (cid:getTotalAttack() * 1)) * 1.0)
return doTargetCombatHealth(cid, enemy, COMBAT_PHYSICALDAMAGE, -damage, -damage, 1)
end
This have min and max dmg ?
 
This have min and max dmg ?
Code:
function onUseWeapon(cid, var, enemy)
local mindamage = (((cid:getLevel() * 1) + (cid:getEffectiveSkillLevel(SKILL_SWORD) * 1) + (cid:getTotalAttack() * 1)) * 1.0)
local maxdamage = (((cid:getLevel() * 1) + (cid:getEffectiveSkillLevel(SKILL_SWORD) * 1) + (cid:getTotalAttack() * 1)) * 1.0)
return doTargetCombatHealth(cid, enemy, COMBAT_PHYSICALDAMAGE, -mindamage, -maxdamage, 1)
end
 
[Error - Weapon Interface]
data/weapons/scripts/sword.lua:eek:nUseWeapon
Description:
data/weapons/scripts/sword.lua:2: attempt to index local 'cid' (a number value)
stack traceback:
data/weapons/scripts/sword.lua:2: in function <data/weapons/scripts/sword.lua:1>
 
[Error - Weapon Interface]
data/weapons/scripts/sword.lua:eek:nUseWeapon
Description:
data/weapons/scripts/sword.lua:2: attempt to index local 'cid' (a number value)
stack traceback:
data/weapons/scripts/sword.lua:2: in function <data/weapons/scripts/sword.lua:1>
Code:
function onUseWeapon(creature, var)
local mindamage = (((creature:getLevel() * 1) + (creature:getEffectiveSkillLevel(SKILL_SWORD) * 1) + (creature:getTotalAttack() * 1)) * 1.0)
local maxdamage = (((creature:getLevel() * 1) + (creature:getEffectiveSkillLevel(SKILL_SWORD) * 1) + (creature:getTotalAttack() * 1)) * 1.0)
return doTargetCombatHealth(creature, enemy, COMBAT_PHYSICALDAMAGE, -mindamage, -maxdamage, 1)
end

You need try edit it for you engine if this still wont work, i use 1.2 :p
 
Back
Top