Moj mistrz
Monster Creator
Hello guys, I've got one problem with the script(I did not make it by myself fully, used some other scripts also), to the point. My script works fine besides it removes all Necromantic Energies and I want it to remove only one.
Tried to remove 'for i = 1, #spectactors do' etc. but it bugs instead of working fine:/.
Thanks for any help.
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_NONE)
function onCastSpell(creature, var)
local msg = "Shargon absorbs necromantic energy to regenerate!"
local spectators, spectator = Game.getSpectators(creature:getPosition(), false, false, 10, 10, 10, 10)
for i = 1, #spectators do
spectator = spectators[i]
if spectator:isMonster() and spectator:getName() == "Necromantic Energy" then
spectator:getPosition():sendMagicEffect(CONST_ME_POFF)
spectator:remove()
creature:say(msg, TALKTYPE_ORANGE_1)
creature:addHealth(50000)
creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
end
return combat:execute(creature, var)
end
Thanks for any help.