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

[0.3.6] lua function doCreatureAddCurse(cid, minDmgValue, maxTicks, dmgDelay)

Mummrik

Hey!
Joined
Oct 22, 2007
Messages
707
Solutions
28
Reaction score
126
Location
Sweden
This is my method to replicate the curse system, since i didnt find it on my server.
defalut useage = doCreatureAddCurse(cid, 1, 36, 4000)
that means you cant use lower values than the ones i show, unless you modify the function.
but it is however possible to use higher values

minDmgValue = start dmg value
maxTicks = the maximum amount of curse ticks, it will randomize (maxTicks/2, maxTicks)
dmgDelay = basicly interval, how long delay between each dmg tick

data\lib\050-function.lua
Lua:
local curseLoop = {}
local curseLoopCondition = createConditionObject(CONDITION_CURSED)
setConditionParam(curseLoopCondition, CONDITION_PARAM_DELAYED, true)
addDamageCondition(curseLoopCondition, 1, 5000, 0)

function loopCurse(target, dmg, round, interval)
    if (round >= 0) then
        round = round - 1
        doAddCondition(target, curseLoopCondition)
        doTargetCombatHealth(0, target, COMBAT_DEATHDAMAGE, -dmg, -dmg, CONST_ME_SMALLCLOUDS)
        local nextDmg = math.ceil(dmg * 0.2) + dmg
        curseLoop[target] = addEvent(loopCurse, interval, target, nextDmg, round, interval)
        if getCreatureHealth(target) <= nextDmg then
            stopEvent(curseLoop[target])
            curseLoop[target] = nil
            addEvent(doRemoveCondition, interval, target, CONDITION_CURSED)
            addEvent(doTargetCombatHealth, interval, 0, target, COMBAT_DEATHDAMAGE, -nextDmg, -nextDmg, CONST_ME_SMALLCLOUDS)
        end
        return true
    else
        curseLoop[target] = nil
        doRemoveCondition(target, CONDITION_CURSED)
        return true
    end
end

function doCreatureAddCurse(cid, minDmgValue, maxTicks, dmgDelay)
    if not getCreatureCondition(cid, CONDITION_CURSED) then
        if minDmgValue < 1 or minDmgValue == nil then
            minDmgValue = 1
        end
        if maxTicks < 36 or maxTicks == nil then
            maxTicks = 36
        end
        if dmgDelay < 4000 or dmgDelay == nil then
            dmgDelay = 4000
        end
        local minTicks = math.ceil(maxTicks / 2)

        local tick = math.ceil(math.random(minTicks, maxTicks) / 2)
        if cid ~= 0 then
            if isPlayer(cid) then
                doPlayerSendCancel(cid, "You are cursed.")
            end
            doAddCondition(cid, curseLoopCondition)
            curseLoop[cid] = addEvent(loopCurse, dmgDelay, cid, minDmgValue, tick, dmgDelay)
        end
    end
end
 
Top