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

Weapons + spell damage increase 8.6 on 1.2

insebbe123

New Member
Joined
Mar 31, 2012
Messages
44
Reaction score
2
Hello, i looking for a script that increases weapon damage and spell damage/healing with items or with rebirth or StorageValue(85987)
i made a rebirth system using storagevalue because normal rebirth wont work for me when i try to select/update the rebirth from database,
but i can't find away to increase weapon dmg/spell damage with items or rebirth,

i want so if u got a full set of example demon set equipped will get a increase of 1.1 then 1.2 and so on,
or same but with rebirth or both,

Thanks,
King regards
s3ican :)
 
This could work with rebirth system I believe, you should give it a try.
Code:
local damageIncrease = (How much %damage increase per rebirt level)
local rebirtStorage = (Your rebirth storage here)

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if (Monster(attacker) ~= nil) then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    if attacker == nil then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    
    local rebirthCount = attacker:getStorageValue(rebirthStorage)
    if rebirthCount >= 1 then
        local newDmg = math.ceil(primaryDamage + (primaryDamage * (rebirthCount / 100)))
        return newDmg, primaryType, secondaryDamage, secondaryType
    end
end
 
This could work with rebirth system I believe, you should give it a try.
Code:
local damageIncrease = (How much %damage increase per rebirt level)
local rebirtStorage = (Your rebirth storage here)

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if (Monster(attacker) ~= nil) then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    if attacker == nil then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  
    local rebirthCount = attacker:getStorageValue(rebirthStorage)
    if rebirthCount >= 1 then
        local newDmg = math.ceil(primaryDamage + (primaryDamage * (rebirthCount / 100)))
        return newDmg, primaryType, secondaryDamage, secondaryType
    end
end
it didn't work no errors or anything, or doesn't it work because i use a custom formula with my custom weapons? but is there away to make rebirth weapons so u ned rebirth 1 or up for an item and is there a way to make armor set with lua attributes instead of item.xml so i can add rebirth to the sets so if your under rebirth 1 and us it, it will not give you the bonus?
 
Last edited:
You registered it correctly? Example.

creaturescritps.xml
Code:
 <event type="healthchange" name="statHP" script="script.lua"/>

That script will be executed whenever there's a healtChange (be it healing or damage), so it doesn't really matter which formulas you're using, it just takes the damage the formula calculates, checks the rebirth level and adds more damage to it.
 
You registered it correctly? Example.

creaturescritps.xml
Code:
<event type="healthchange" name="statHP" script="script.lua"/>

That script will be executed whenever there's a healtChange (be it healing or damage), so it doesn't really matter which formulas you're using, it just takes the damage the formula calculates, checks the rebirth level and adds more damage to it.
 
In the rebirth script take out the "()" from the values.

Code:
local damageIncrease = 5
local rebirthStorage = 85987

Oh and, forgot to mention, on creaturescripts/scripts/login.lua you should register it to the player's login.

Code:
player:registerEvent("rebirthdmg")
 
In the rebirth script take out the "()" from the values.

Code:
local damageIncrease = 5
local rebirthStorage = 85987

Oh and, forgot to mention, on creaturescripts/scripts/login.lua you should register it to the player's login.

Code:
player:registerEvent("rebirthdmg")
tested it but didn't work i using a this formula on weapons
using -100 to see that it working
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)

function onGetFormulaValues(player, level, maglevel)
    local magiclevel = maglevel
    local level = level
    local min = (-100)
    local max = (-100)
    return min, max
    end
   combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
   function onUseWeapon(creature, variant)
    return combat:execute(creature, variant)
end
 
Didn't work without any errors? As long as I recall, it doesn't really matter the formulas, as onStatsChange applies after all those things are calculated.
Try using this script (It's the same one, but it will print messages to your server console to see what is going on)
Code:
local damageIncrease = 5
local rebirtStorage = 85987

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if (Monster(attacker) ~= nil) then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    if attacker == nil then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    
    local rebirthCount = attacker:getStorageValue(rebirthStorage)
    print("Rebirth count is: " ..rebirthCount)
    if rebirthCount >= 1 then
        local newDmg = math.ceil(primaryDamage + (primaryDamage * (rebirthCount / 100)))
        print("Damage modified by " ..(damageIncrease * rebirthCount).."%. New damage is: "..newDmg)
        return newDmg, primaryType, secondaryDamage, secondaryType
    end
end

Results, for example:
Code:
Rebirth count is: 1
Damage modified by 5%. New damage is: 105

Rebirth count is: 3
Damage modified by 15%. New damage is: 115
 
Didn't work without any errors? As long as I recall, it doesn't really matter the formulas, as onStatsChange applies after all those things are calculated.
Try using this script (It's the same one, but it will print messages to your server console to see what is going on)
Code:
local damageIncrease = 5
local rebirtStorage = 85987

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if (Monster(attacker) ~= nil) then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    if attacker == nil then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
 
    local rebirthCount = attacker:getStorageValue(rebirthStorage)
    print("Rebirth count is: " ..rebirthCount)
    if rebirthCount >= 1 then
        local newDmg = math.ceil(primaryDamage + (primaryDamage * (rebirthCount / 100)))
        print("Damage modified by " ..(damageIncrease * rebirthCount).."%. New damage is: "..newDmg)
        return newDmg, primaryType, secondaryDamage, secondaryType
    end
end

Results, for example:
Code:
Rebirth count is: 1
Damage modified by 5%. New damage is: 105

Rebirth count is: 3
Damage modified by 15%. New damage is: 115
this nothing in console, and i am rebirth 2, but i tested with a normal play and i says, rebirth count is:8 damage modifed by 40%, new damage is: 5159 when i use spells but not weapons
 
Last edited:
Try this one, equip a weapon with a normal player and try hitting some monsters.
Code:
local damageIncrease = 5
local rebirtStorage = 85987

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if (Monster(attacker) ~= nil) then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    if attacker == nil then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
  
    local rebirthCount = attacker:getStorageValue(rebirthStorage)
    print("Rebirth count is: " ..rebirthCount)
    if rebirthCount >= 1 then
        if origin == ORIGIN_MELEE then
            print("This is a melee hit.")
            return primaryDamage, primaryType, secondaryDamage, secondaryType
        else
            local newDmg = math.ceil(primaryDamage + (primaryDamage * (rebirthCount / 100)))
            print("Original damage was: " ..primaryDamage)
            print("Damage modified by " ..damageIncrease.."%. New damage is: "..newDmg)
            return newDmg, primaryType, secondaryDamage, secondaryType
        end
    end
end

If it shows on console: "This is a melee hit."
Then we know we're receiving the information from weapons and can adjust the script to bump the damage.
 
Try this one, equip a weapon with a normal player and try hitting some monsters.
Code:
local damageIncrease = 5
local rebirtStorage = 85987

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if (Monster(attacker) ~= nil) then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
    if attacker == nil then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
 
    local rebirthCount = attacker:getStorageValue(rebirthStorage)
    print("Rebirth count is: " ..rebirthCount)
    if rebirthCount >= 1 then
        if origin == ORIGIN_MELEE then
            print("This is a melee hit.")
            return primaryDamage, primaryType, secondaryDamage, secondaryType
        else
            local newDmg = math.ceil(primaryDamage + (primaryDamage * (rebirthCount / 100)))
            print("Original damage was: " ..primaryDamage)
            print("Damage modified by " ..damageIncrease.."%. New damage is: "..newDmg)
            return newDmg, primaryType, secondaryDamage, secondaryType
        end
    end
end

If it shows on console: "This is a melee hit."
Then we know we're receiving the information from weapons and can adjust the script to bump the damage.
didn't work no prints, the weapon does still 100 and i tried to use a normal unchanged weapon but didn't work
 
Doesn't know how to fix the weapon formula do the spell works but not weapons, in my head this script Looks to work btw i fix the local rebirth storage you wrote rebirt
 
Back
Top