good night i'm learning and i'm trying to make a script for all the damage that the weak spot monster receives the boss the pale worm receives the same damage
Lua:
local effects = {
[COMBAT_PHYSICALDAMAGE] = CONST_ME_DRAWBLOOD,
[COMBAT_ENERGYDAMAGE] = CONST_ME_ENERGYAREA,
[COMBAT_EARTHDAMAGE] = CONST_ME_POISONAREA,
[COMBAT_FIREDAMAGE] = CONST_ME_FIREAREA,
[COMBAT_ICEDAMAGE] = CONST_ME_ICEAREA,
[COMBAT_HOLYDAMAGE] = CONST_ME_HOLYAREA,
[COMBAT_DEATHDAMAGE] = CONST_ME_MORTAREA,
[COMBAT_HEALING] = CONST_ME_MAGIC_GREEN
}
local ThePaleWorm = CreatureEvent("ThePaleWorm")
function ThePaleWorm.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
if not attacker or not creature:isMonster() then
return primaryDamage, primaryType, secondaryDamage, secondaryType
end
if creature:getName():lower() == 'the pale worm' then
local spectators = Game.getSpectators(Position(23735, 21562, 13), false, false, 20, 20, 20, 20)
for i = 1, #spectators do
local spectator = spectators[i]
if spectator:getName():lower() == 'a weak spot' then
spectator:addHealth(-primaryDamage, effects[primaryType])
return creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end
end
end
return creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end
ThePaleWorm:register()