• 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!

Change the MagicDamage?

Fonts

New Member
Joined
Oct 22, 2009
Messages
32
Reaction score
0
Location
Canada
Hiho, i'm trying to change the magic damage for specific vocations, i thought it would be in vocations.xml just like these:

<formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0"/>

but i can't find it. Is there a way to change it without editing every spells?

Thank you,
Kevin F. :D
 
if you're using TFS 1.0 try this

add this code in creaturescripts.xml
Code:
    <event type="changehealth" name="voc" script="voc.lua"/>

add this line in creaturescripts/scripts/login.lua before "return true"
Code:
    player:registerEvent("voc")

creaturescripts/scripts/voc.lua
Code:
-- add vocation id and the multiplies in the array below.
local vocsmulti = {
    [1] = {magic = 1.5 , healing = 1.25, melee = 0.75, distance = 0.75},            --sorcerer
    [2] = {magic = 1.25 , healing = 1.5, melee = 0.75, distance = 0.75},                --druid
    [3] = {magic = 0.75 , healing = 0.75, melee = 0.75, distance = 1.5},            --paladin
    [4] = {magic = 0.75 , healing = 0.75, melee = 1.5, distance = 0.75},        --knight
    [5] = {magic = 2 , healing = 1.5, melee = 0.5, distance = 0.5},            --master sorcerer
    [6] = {magic = 1.5 , healing = 2, melee = 0.5, distance = 0.5},            --elder druid
    [7] = {magic = 0.5 , healing = 0.5, melee = 1, distance = 2.0},    --royal paladin
    [8] = {magic = 0.5 , healing = 0.5, melee = 2, distance = 0.5}        --elite knight
}

function onChangeHealth(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
local attacking = Creature(attacker)
if attacking:isPlayer() then
    if origin == ORIGIN_MELEE then    --checks if damage is done by melee
        primaryDamage = primaryDamage * vocsmulti[attacking:getVocation()].melee
        secondaryDamage = secondaryDamage * vocsmulti[attacking:getVocation()].melee
    elseif origin == ORIGIN_RANGED then    --checks if damage is done by distance
        primaryDamage = primaryDamage * vocsmulti[attacking:getVocation()].distance
        secondaryDamage = secondaryDamage * vocsmulti[attacking:getVocation()].distance
    elseif origin == ORIGIN_SPELL then    --checks if damage/healing is done by a spell
        if primaryType == COMBAT_HEALING then    --checks if healing
            primaryDamage = primaryDamage * vocsmulti[attacking:getVocation()].healing
            secondaryDamage = secondaryDamage * vocsmulti[attacking:getVocation()].healing
        else    --rest is damage
            primaryDamage = primaryDamage * vocsmulti[attacking:getVocation()].magic
            secondaryDamage = secondaryDamage * vocsmulti[attacking:getVocation()].magic
        end
    end
end
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
 
i was getting a error:
[error - creature event : : configureevent] invalid type for creature event: voc ... failed to configure event

then i change all changehealth for healthchange and i think it worked, can someone help me?

now i'm having this issue when i atk with sd and others ways:
khpkvioc9

(http://postimg.org/image/khpkvioc9/)
updating:
i descovery now that the problem r in here (mark with green)
if origin == ORIGIN_MELEE then --checks if damage is done by melee
primaryDamage = primaryDamage * vocsmulti[attacking:getVocation()].melee
secondaryDamage = secondaryDamage * vocsmulti[attacking:getVocation()].melee
elseif origin == ORIGIN_RANGED then --checks if damage is done by distance
primaryDamage = primaryDamage * vocsmulti[attacking:getVocation()].distance
secondaryDamage = secondaryDamage * vocsmulti[attacking:getVocation()].distance
elseif origin == ORIGIN_SPELL then --checks if damage/healing is done by a spell
if primaryType == COMBAT_HEALING then --checks if healing
primaryDamage = primaryDamage * vocsmulti[attacking:getVocation()].healing
secondaryDamage = secondaryDamage * vocsmulti[attacking:getVocation()].healing
else --rest is damage
primaryDamage = primaryDamage * vocsmulti[attacking:getVocation()].magic
secondaryDamage = secondaryDamage * vocsmulti[attacking:getVocation()].magic
end
end

seems like it's not getting the right value of:
local vocsmulti = {
[1] = {magic = 1.0 , healing = 1.0, melee = 1, distance = 1}, --sorcerer
[2] = {magic = 1.0 , healing = 1.0, melee = 1, distance = 1}, --druid
[3] = {magic = 1.0 , healing = 1.0, melee = 1, distance = 1}, --paladin
[4] = {magic = 1.0 , healing = 1.0, melee = 1, distance = 1}, --knight
[5] = {magic = 1.0 , healing = 1.0, melee = 1, distance = 1}, --master sorcerer
[6] = {magic = 1.0 , healing = 1.0, melee = 1, distance = 1}, --elder druid
[7] = {magic = 1.0 , healing = 1.0, melee = 1, distance = 1}, --royal paladin
[8] = {magic = 1.0 , healing = 1.0, melee = 1, distance = 1}, --elite knight
 
Last edited by a moderator:
i did it, and then i got the other issue i wrote, when i change the green part to any num it works like a charm, but putting back the green part it got the image error, just like its no finding vocsmulti variable
 
SOLVED PROBLEM
change "changehealth" to "healthchange" in creaturescript.xml
change "onChangeHealth" to "onHealthChange" in voc.lua
change "getVocation()" to "getVocation():getBase():getId()" in voc.lua

Works like a charm!
ty guys!
 
did not work for me.. I upgraded to 1.2 and its something i really needed.

if someone have any clue on how to fix that that be great ! =D
 
sample from 1.3 vocation.xml

i can't see the magicDamage multiplier. ima have to set up a whole 1.3 server and see for myself i guess...

Code:
    <vocation id="1" clientid="3" name="Sorcerer" description="a sorcerer" gaincap="10" gainhp="5" gainmana="30" gainhpticks="6" gainhpamount="5" gainmanaticks="3" gainmanaamount="5" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>
 
sample from 1.3 vocation.xml

i can't see the magicDamage multiplier. ima have to set up a whole 1.3 server and see for myself i guess...

Code:
    <vocation id="1" clientid="3" name="Sorcerer" description="a sorcerer" gaincap="10" gainhp="5" gainmana="30" gainhpticks="6" gainhpamount="5" gainmanaticks="3" gainmanaamount="5" manamultiplier="1.1" attackspeed="2000" basespeed="220" soulmax="100" gainsoulticks="120" fromvoc="1">
        <formula meleeDamage="1.0" distDamage="1.0" defense="1.0" armor="1.0" />
        <skill id="0" multiplier="1.5" />
        <skill id="1" multiplier="2.0" />
        <skill id="2" multiplier="2.0" />
        <skill id="3" multiplier="2.0" />
        <skill id="4" multiplier="2.0" />
        <skill id="5" multiplier="1.5" />
        <skill id="6" multiplier="1.1" />
    </vocation>

I believe this is a feature that only exists in TFS 0.4.

If you want to make a multiplier in vocations xml, you would have to edit the sources to make it possible.
Its actually not that complicated, and you can do it with a limited amount of programming knowledge.

However if you are looking for a workaround in lua this might be the solution for you.
Just add
Lua:
MagicDamage = 1 -- This would change the multiplier
to global.lua

and just add MagicDamage to the spells. This way you can change it whenever you like, easily in global.lua.

Example:
Lua:
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_DEATH)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 1.4) + 8
    local max = (level / 5) + (magicLevel * 2.2) + 14
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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

to

Lua:
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_DEATH)

function onGetFormulaValues(player, level, magicLevel)
    local min = ((level / 5) + (magicLevel * 1.4) + 8) * MagicDamage
    local max = ((level / 5) + (magicLevel * 2.2) + 14) * MagicDamage
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end
 
that no easy solution. everything worked fine with my older version. i can't see why they only left the melee multiplicator in there and not the magic one.. i bet its somewhere in the build still. any idea where to look ?
 
that no easy solution. everything worked fine with my older version. i can't see why they only left the melee multiplicator in there and not the magic one.. i bet its somewhere in the build still. any idea where to look ?
It doesn't exist anymore. That's why nobody including myself has told you where to look for it.
 
here is what I found in vocation. H

Code:
        float meleeDamageMultiplier = 1.0f;
        float distDamageMultiplier = 1.0f;
        float defenseMultiplier = 1.0f;
        float armorMultiplier = 1.0f;

pretty sure i could add my magic modifier here.
i just dont know where those floats are being used. ( for now : D)

i will let you know if i get this to work. this is a pretty neat feature to have.. i dunno why its been removed.
 
Back
Top