• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Spell Creature heal at 40% life

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,827
Solutions
586
Reaction score
5,408
These Scripts will allow a creature to heal when under 40% until they are above 40%
Repp++ me if you want :cool:

Credit goes to Summ for fixing the spell Here

Make a new file named fortypercentheal.lua
Server\data\spells\scripts\custommonsterspells\
Lua:
local monsters = {
	["Demon"] = {400, 500, 0.4}, -- minimum, maximum, percent
	["Behemoth"] = {30, 400, 0.3}
}
 
function onCastSpell(cid, var)
	if not(monsters[getCreatureName(cid)]) then
		print("No healing values for monster: " .. getCreatureName(cid))
		return true
	end
 
	local min, max, percent = monsters[getCreatureName(cid)][1], monsters[getCreatureName(cid)][2], monsters[getCreatureName(cid)][3]
        if (getCreatureHealth(cid) / getCreatureMaxHealth(cid)) <= percent then
            doCreatureAddHealth(cid, math.random(min, max))
            doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
            return true
        end
end
Edit Spells.lua
Server\data\spells\spells.lua
Add this
Lua:
<instant name="fortypercentheal" words="iauhdfjcadnvjn" lvl="999999" mana="50" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="custommonsterspells/fortypercentheal.lua">
	</instant>
Put this inside of the monster you want to heal at 40% and lower
Server\data\monster\
Lua:
<defense name="fortypercentheal" interval="2000" chance="100" min="30" max="50">
			<attribute key="areaEffect" value="blueshimmer"/>
		</defense>

Have fun everyone :D
 
Last edited:
Back
Top