TFS 1.3.10
Hello, is there a chance that a weapon has increased damage against some monsters?
example an rl weapon:
+ 100% dmg vs All Dragons
Should I add any script in movements.xml or weapons.xml?
Final version
In weapons.xml add item:
dragonslayer.lua (in \data\weapons\scripts):
Hello, is there a chance that a weapon has increased damage against some monsters?
example an rl weapon:
Lua:
<item id="7402" article="a" name="dragon slayer">
<attribute key="weight" value="8200" />
<attribute key="defense" value="28" />
<attribute key="attack" value="44" />
<attribute key="weaponType" value="sword" />
<attribute key="slotType" value="two-handed" />
<attribute key="imbuingSlots" value="3" />
</item>
+ 100% dmg vs All Dragons
Should I add any script in movements.xml or weapons.xml?
Final version
In weapons.xml add item:
Lua:
<!-- dragon slayer -->
<melee id="7402" level="70" unproperly="1" script="dragonslayer.lua" >
<vocation name="Knight" />
</melee>
dragonslayer.lua (in \data\weapons\scripts):
Lua:
-- Normal combat damage
local combat_normal = Combat()
combat_normal:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat_normal:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat_normal:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0) -- normal damage
-- Combat damage against dragons
local combat_dragons = Combat()
combat_dragons:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat_dragons:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat_dragons:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat_dragons:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 2, 0) -- damage x 2
-- On use weapon
function onUseWeapon(player, variant)
local target = Monster(variant.number)
-- Is target a monster
if target and target:isMonster() then
-- Does the target have "dragon" somewhere in the creature name
if target:getName():lower():find("dragon") then
-- Use combat_dragons combat object
return combat_dragons:execute(player, variant)
end
end
-- Use normal combat object
return combat_normal:execute(player, variant)
end
Last edited: