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

Solved Script help needed.

Moj mistrz

Monster Creator
Joined
Feb 1, 2008
Messages
932
Solutions
10
Reaction score
295
Location
Poland
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.
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
Tried to remove 'for i = 1, #spectactors do' etc. but it bugs instead of working fine:/.
Thanks for any help.
 
You can add return true under creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
Also add the combat:execute(creature, var) there then else it won't do that or move it above it.
 
Back
Top