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

RevScripts Create doom event to Boss

Belfahar

New Member
Joined
Jul 21, 2016
Messages
25
Reaction score
3
Good morning, everyone! I'm creating an event for the boss where, upon reaching 80% of its health, it teleports to the center of the room, notifies players that it's about to unleash a spell. In the initial phase, warning tiles for the magic area are created. Afterward, the actual magic is triggered.

The script almost entirely works, but in the doAreaCombatHealth function, the area it should affect doesn't appear.

Lua:
local condition = Condition(CONDITION_ATTRIBUTES, CONDITIONID_DEFAULT)
condition:setParameter(CONDITION_PARAM_SUBID, 8888)
condition:setParameter(CONDITION_PARAM_BUFF_DAMAGEDEALT, 200)
condition:setParameter(CONDITION_PARAM_TICKS, 9000)

local jauldoom = CreatureEvent("jaulTeleport")

local arr = {
                { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
                { 0, 0, 0, 1, 1, 3, 1, 1, 0, 0, 0 },
                { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
                }

function jauldoom.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)

    local maxHealth = creature:getMaxHealth()
    local currentHealth = creature:getHealth()
    local healthPercentage = (currentHealth / maxHealth) * 100
    local messageSent = creature:getStorageValue(88889) == 1
     
    if healthPercentage <= 80 and creature:getStorageValue(88899) <= 0 and not creature:getCondition(CONDITION_PARAM_BUFF_DAMAGEDEALT, CONDITIONID_DEFAULT, 8888) then
        creature:teleportTo(Position(4600, 4328, 15))
        creature:setSpeed(0)
        creature:addCondition(condition)
        creature:setStorageValue(88899, 1)  
           
        if creature:isMonster() then
            doAreaCombatHealth(creature, COMBAT_NONE, arr, arr, -0, -0, CONST_ME_TUTORIALSQUARE)
        end

        if not messageSent then
            creature:say("VOU AFOGAR TODOS VOCÊS!", TALKTYPE_MONSTER_SAY)
            creature:setStorageValue(88889, 1)
        end

        addEvent(function(cid)
            local creature = Creature(cid)          
            if creature:isMonster() then          
                doAreaCombatHealth(creature, COMBAT_DROWNDAMAGE, arr, arr, -5000, -10000, CONST_ME_WATERSPLASH)
            end
        end, 2000, creature:getId())

        addEvent(function(cid)
            local creature = Creature(cid)
            if creature then
                creature:setSpeed(240)
                creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
            end
        end, 10000, creature:getId())
    end

    return primaryDamage, primaryType, secondaryDamage, secondaryType
end

jauldoom:register()

SOLVED!

Just set local arr = createCombatArea(AREA_CIRCLE6X6)
 
Last edited:
Back
Top