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

Lua Sudden Death Modify

WolffMol

New Member
Joined
Jun 12, 2015
Messages
10
Reaction score
1
Hey guys, I'm trying to make a modification on sudden death rune. I want this:

IF IM ATACKING A PLAYER
IF MY VOCATION ID IS "X" AND MY PLAYER TARGET VOCATION ID IS "Y" THEN IT'S TRUE
ELSE IS FALSE

TRUE DAMAGE = MY NEW DAMAGE
FALSE DAMAGE = NORMAL GAME SD

Here the SD original script.

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, maglevel)
    min = -((level / 5) + (maglevel * 4.3) + 32)
    max = -((level / 5) + (maglevel * 7.4) + 48)
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, var, isHotkey)
    return combat:execute(creature, var)
end


Ty for your time!

i've made some progress scripting it, but the getattackedvocation is wrong because i don't know what is the code:
http://postimg.org/image/4i792d6t3/

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)

local combat2 = Combat()

function getCreatureTarget(cid)
    local c = Creature(cid)
    if c ~= nil then
        local target = c:getTarget()
        local creatvoc = target:getVocation()
        return target ~= nil and target:getId() or 0
    end
    return
end



local vocsmulti = {
    [1] = {atack = 17, 18, 19, 20},            --Human warrior
    [2] = {atack = 17, 18, 19, 20},                --Human paladin
    [3] = {atack = 17, 18, 19, 20},            --Human Druid
    [4] = {atack = 17, 18, 19, 20},        --Human wizard
    [5] = {atack = 13, 14, 15, 16},            ---Elf warrior
    [6] = {atack = 13, 14, 15, 16},            --Elf paladin
    [7] = {atack = 13, 14, 15, 16},    --Elf Druid
    [8] = {atack = 13, 14, 15, 16},        --Elf wizard
    [9] = {atack = 21, 22, 23, 24},            --Dwarf warrior
    [10] = {atack = 21, 22, 23, 24},                --Dwarf paladin
    [11] = {atack = 21, 22, 23, 24},            --Dwarf Druid
    [12] = {atack = 21, 22, 23, 24},        --Dwarf wizard
    [13] = {atack = 1, 2, 3, 4},            --Orc warrior
    [14] = {atack = 1, 2, 3, 4},            --Orc paladin
    [15] = {atack = 1, 2, 3, 4},    --Orc Druid
    [16] = {atack = 1, 2, 3, 4},        --Orc wizard
    [17] = {atack = 9, 10, 11, 12},            --Ancestral warrior
    [18] = {atack = 9, 10, 11, 12},                --Ancestral paladin
    [19] = {atack = 9, 10, 11, 12},            --Ancestral Druid
    [20] = {atack = 9, 10, 11, 12},        --Ancestral wizard
    [21] = {atack = 5, 6, 7, 8},            --Walking Dead warrior
    [22] = {atack = 5, 6, 7, 8},    --Walking Dead paladin
    [23] = {atack = 5, 6, 7, 8},        --Walking Dead druid
    [24] = {atack = 5, 6, 7, 8},            --Walking Dead wizard
}
-- local Target = Creature:getTarget()
-- local Targethp = target:gethealthmax()
-- if target:getVocation() == vocsmulti[attacking:getVocation():getBase():getId()].atack then
-- DMG = targethp / 5
-- else
-- DMG = 0
-- end
-- use DMG in combat 2 (where is write maxhp, that actually i just used it for testing)

function onGetFormulaValues(player, level, maglevel)
local    min = -((level / 5) + (maglevel * 4.3) + 32)
local    max = -((level / 5) + (maglevel * 7.4) + 48)
    return min, max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local function bleeds(creature,var,target)
return combat2:execute(creature, var)
end
local function start2(creature,var)
return combat:execute(creature, var)
end

function onCastSpell(creature, var, isHotkey)
local maxhp = creature:getMaxHealth()
addEvent(start2, 0, creature.uid, var)
    if creature:getMana() == 20000 then -- this is just a condition that i used to test, the real one should be: if DMG > 0 then
    local condition = Condition(CONDITION_BLEEDING)
    combat2:setParameter(CONDITION_PARAM_DELAYED, 1)
    combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_BLOODYSTEPS)
    condition:addDamage(5, 2000, maxhp / 10)
    combat2:setCondition(condition)
       return combat2:execute(creature, var)
    end
return true
end

I did a more recent updage, show more or less what i'm looking for, but i really dont know what codes to use to get the if part that I just wrote after "--"
 
Last edited:
your code was too messy, so i came up with this.

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)

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

local vocsmulti = {
    [1] = {17, 18, 19, 20},                   --Human warrior
    [2] = {17, 18, 19, 20},                   --Human paladin
    [3] = {17, 18, 19, 20},                   --Human Druid
    [4] = {17, 18, 19, 20},                   --Human wizard
    [5] = {13, 14, 15, 16},                   ---Elf warrior
    [6] = {13, 14, 15, 16},                   --Elf paladin
    [7] = {13, 14, 15, 16},                   --Elf Druid
    [8] = {13, 14, 15, 16},                   --Elf wizard
    [9] = {21, 22, 23, 24},                   --Dwarf warrior
    [10] = {21, 22, 23, 24},                --Dwarf paladin
    [11] = {21, 22, 23, 24},               --Dwarf Druid
    [12] = {21, 22, 23, 24},               --Dwarf wizard
    [13] = {1, 2, 3, 4},                   --Orc warrior
    [14] = {1, 2, 3, 4},                   --Orc paladin
    [15] = {1, 2, 3, 4},                   --Orc Druid
    [16] = {1, 2, 3, 4},                   --Orc wizard
    [17] = {9, 10, 11, 12},                   --Ancestral warrior
    [18] = {9, 10, 11, 12},                 --Ancestral paladin
    [19] = {9, 10, 11, 12},                   --Ancestral Druid
    [20] = {9, 10, 11, 12},                   --Ancestral wizard
    [21] = {5, 6, 7, 8},                   --Walking Dead warrior
    [22] = {5, 6, 7, 8},                   --Walking Dead paladin
    [23] = {5, 6, 7, 8},                   --Walking Dead druid
    [24] = {5, 6, 7, 8}                     --Walking Dead wizard
}

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

function onGetFormulaValues2(player, level, maglevel)
local    min = -((level / 5) + (maglevel * 4.3) + 32) - (player:getTarget():getMaxHealth() /6)
local    max = -((level / 5) + (maglevel * 7.4) + 48) - (player:getTarget():getMaxHealth() /5)
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")

function onCastSpell(creature, var, isHotkey)
   local Target = creature:getTarget() -- get target
   if Target and Target:isPlayer() then -- check if target is player, otherwise use normal combat
      local TargetVoc = Target:getVocation():getId() -- get target player vocation
      for _,v in pairs(vocsmulti[creature:getVocation():getId()]) do -- loop through all the values of the caster's vocation
            if v == TargetVoc then -- checks if player can do extra dmg to target vocation
                return combat2:execute(creature, var) -- uses the new formula with bonus dmg
            end
            return combat:execute(creature, var) -- use normal dmg formula if player cannot do bonus dmg to target vocation
      end
    else
    return combat:execute(creature, var)
   end
end

i created it as a normal SD with bonus dmg against certain vocations. i am not sure if you wanted to have bleed condition with how many ticks, so i created it normally instead
 
Last edited:
ty so much bro!! thats a trully beautiful and clean code!
edit: now i'm get a erro on line 55: death.lua55: attemp to index local 'target' <a nil value>
its not reading my target vocation nither my target at all...
 
Last edited:
Back
Top