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

C++ Remove summon and heals the player

Joined
Apr 11, 2015
Messages
98
Reaction score
5
Good night everyone, i am here to ask for a spell that's do the following:
The spell removes the player's summon
Then, it gets the summon's health and convert for the player.
So, if the summon has 100 health but looses 10 and the player cast the spell, it removes the summon and heals 90 health of the player.
I have a spell that removes the summons, if it help:

C++:
local effect = 10
function onCastSpell(cid, var)
summons = getCreatureSummons(cid)
for _, summon in pairs(summons) do
 doSendMagicEffect(getThingPos(summon), effect)
 doRemoveCreature(summon)
end
return true
end
Thank you guys and wash your hands
 
Solution
Lua:
local effect = MAGIC_EFFECT_TELEPORT

function onCastSpell(cid, var)
    local summons = getCreatureSummons(cid)
    if(table.maxn(summons) <= 0) then -- no summons
        doPlayerSendCancel(cid, "You've not any minions in tow!")
    else
        for _, summon in pairs(summons) do
            doCreatureAddHealth(cid, getCreatureHealth(summon))
            doSendMagicEffect(getThingPosition(summon), effect)
            doRemoveCreature(summon)
        end
    end
    return true
end

If that fulfills your request make sure to hit the thumbs up 👍 ↘ and mark this post as answer.
Lua:
local effect = MAGIC_EFFECT_TELEPORT

function onCastSpell(cid, var)
    local summons = getCreatureSummons(cid)
    if(table.maxn(summons) <= 0) then -- no summons
        doPlayerSendCancel(cid, "You've not any minions in tow!")
    else
        for _, summon in pairs(summons) do
            doCreatureAddHealth(cid, getCreatureHealth(summon))
            doSendMagicEffect(getThingPosition(summon), effect)
            doRemoveCreature(summon)
        end
    end
    return true
end

If that fulfills your request make sure to hit the thumbs up 👍 ↘ and mark this post as answer.
 
Last edited:
Solution
Back
Top