• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Summon which healing his Boss.

Permamently

New Member
Joined
Jul 23, 2015
Messages
34
Reaction score
3
Hello, is it possible to make summon which is healing his Boss(player who summoned him) ? If yes please tell me how : )
 
For 0.3.6~0.4 TFS

In creaturescripts/creaturescripts.xml, add this:
Code:
    <event type="think" name="healer" event="script" value="healer.lua"/>
In creaturescripts/scripts/ make a script called healer.lua and paste this inside:
Code:
-- Configure the healing here:
configHealer = {
healMin = 20, -- Minimum heal
healMax = 30, -- Maximum heal
distanceEffect = 9, -- Shoots this effect to the player it heals
magicEffect = 5 -- This effect is displayed at the healed unit's pos
}

function onThink(cid)
local master = getCreatureMaster(cid)
doSendMagicEffect(getThingPos(master), configHealer.magicEffect)
doSendDistanceShoot(getThingPos(cid), getThingPos(master), configHealer.distanceEffect)
doCreatureAddHealth(master, math.random(healMin,healMax))
return true
end

In the script of the monster that should use this ability, paste this xml code:
Code:
    <script>
    <event name="healer"/>
    </script>
 
Last edited by a moderator:
Code:
-- Configure the healing here:
configHealer = {
healMin = 20, -- Minimum heal
healMax = 30, -- Maximum heal
distanceEffect = 9, -- Shoots this effect to the player it heals
magicEffect = 5, -- This effect is displayed at the healed unit's pos
storage = 50251, -- Some free storage value
speed = 6 -- The lesser the number, the faster the healing
}

function onThink(cid)
local counter = getPlayerStorageValue(cid, configHealer.storage)

if counter % configHealer.speed == 0 then
local master = getCreatureMaster(cid)
doSendMagicEffect(getThingPos(master), configHealer.magicEffect)
doSendDistanceShoot(getThingPos(cid), getThingPos(master), configHealer.distanceEffect)
doCreatureAddHealth(master, math.random(configHealer.healMin,configHealer.healMax))
end

setPlayerStorageValue(cid, configHealer.storage, counter+1)

return true
end


Try this

EDITED again, found a small mistake
 
Last edited by a moderator:
Yea I did notice some errors in console moment ago but you were faster :) Thank you all is working good :) @Shadowsong
Np. I was actually working on a very similar script in the moment when I saw your thread, so it was not a huge hassle to move around a few lines and get this going.
Cheers!
 
Back
Top