• 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 1.3 wand with attack

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
Hi, how create wand with attack?
Like wand (atk: 30 def: 0), i try make script in weapons, but not work, how to apllay script in <wand></wand? How make custom dmg formula attack/5 + level/10?
 
weapons.xml
<wand id="2182" mana="0" type="earth" script="custom/snakebite.lua"/> <!-- Snakebite Rod -->

items.xml
note that attack value is symbolic only and has no effect on the damage of the wand unless you specifically call it in onGetFormulaValues
Lua:
    <item id="2182" article="a" name="snakebite rod">
        <attribute key="description" value="A weak poison rod."/>
        <attribute key="weight" value="1900"/>
        <attribute key="weaponType" value="wand"/>
        <attribute key="shootType" value="poison"/>
        <attribute key="attack" value="18"/>
        <attribute key="range" value="4"/>
    </item>

weapon/scripts/custom/snakebite.lua
this will shoot SDs
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 4.3) + 32
    local max = (level / 5) + (magicLevel * 7.4) + 48
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onUseWeapon(player, variant)
    return combat:execute(player, variant)
end
 
@Silba okey, so i see in your script - damage = level + mlvl + 32, okey good but how add to this formula attack? Its possible to get how many attack have this wand? Something like "GetWeaponAttack" does it exist?

Because I plan to add an upgrade system, and I want to do when someone upgrade wand, he has a better dmg, so I want the DMG with the wand to be dependent on his attack set in items.xml
 
note that attack value is symbolic only and has no effect on the damage of the wand unless you specifically call it in onGetFormulaValues
@Silba okey, so i see in your script - damage = level + mlvl + 32, okey good but how add to this formula attack? Its possible to get how many attack have this wand? Something like "GetWeaponAttack" does it exist?

Because I plan to add an upgrade system, and I want to do when someone upgrade wand, he has a better dmg, so I want the DMG with the wand to be dependent on his attack set in items.xml
They way I know would be using CALLBACK_PARAM_SKILLVALUE instead of CALLBACK_PARAM_LEVELMAGICVALUE

This will do SD damage + the attack value of the currently equipped weapon.
Lua:
function onGetFormulaValues(player, skill, attack)
    local level = player:getLevel() -- so we still have access to player level
    local magicLevel = player:getMagicLevel() -- so we still have access to player magic level
    local min = (level / 5) + (magicLevel * 4.3) + attack
    local max = (level / 5) + (magicLevel * 7.4) + attack
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
 
Back
Top