jakub742
Active Member
Hello, i was trying to do a monster spell that would hit all players within specific range using Game.getSpectators() after delay using addEvent.
However not sure why when using
it will attack player even if he's standing in protection zone. I thought that it will do checks for pz and path is clear aswell.
In spells.xml i have following attributes
aggressive="1" needlearn="1" blockwalls="1"
Am i missing something or do i need to manually check that in my lua ?
However not sure why when using
Code:
combat:execute(parameters.creatureId, Variant(player:getId()))
In spells.xml i have following attributes
aggressive="1" needlearn="1" blockwalls="1"
Am i missing something or do i need to manually check that in my lua ?
LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_LARGEROCK)
combat:setFormula(COMBAT_FORMULA_DAMAGE, -100, 0, -200, 0)
function onCastSpell(creature, variant)
parameters = {creatureId = creature:getId(), position = creature:getPosition()}
addEvent(castUltimate, 1500, parameters)
end
function castUltimate(parameters)
local players = Game.getSpectators(parameters.position, false, true, 7, 7, 6, 6)
for _, player in pairs(players) do
if player.getId ~= nil then
combat:execute(parameters.creatureId, Variant(player:getId()))
end
end
end