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

Fortera Global

Intermediate OT User
Joined
Nov 20, 2015
Messages
1,180
Solutions
2
Reaction score
117
How to make a damage for a specific monster? demon
Tried this script, dont work:


Lua:
local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_DROWNDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_NONE)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY)


local area = createCombatArea(AREA_CROSS5X5)
combat2:setArea(area)

function onTargetCreature(creature, target)   
   
    min = -3000
    max = -10000   
   
    local spec2 = getSpectators({x = 30161, y = 30951, z = 15}, 10, 10)
    if spec2 ~= nil then
         for _, s in pairs(spec2) do
             if isMonster(s) then
             if creature:getName(s):lower() == 'demon' then
                doTargetCombatHealth(0, creature, COMBAT_DROWNDAMAGE, min, max, CONST_ME_NONE)
             end
             end
         end
    end
   
    if creature and creature:getName():lower() == 'liq demon' then
    creature:remove()
    end

    --return min, max
end

combat2:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

local function spellDamage(creature, var)
        return combat2:execute(creature, var)
end

local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLPLANTS)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)

function onCastSpell(creature, var)
   
    addEvent(spellDamage, 2 * 1000, creature.uid, var)
    return combat:execute(creature, var)
end
 
This is a monster spell, it will explode and hit 1 specific monster on your side. He is exploding and is not hitting any monster.
 

Similar threads

Back
Top