- Joined
- Nov 17, 2010
- Messages
- 6,829
- Solutions
- 586
- Reaction score
- 5,410
These Scripts will allow a creature to heal when under 40% until they are above 40%
Repp++ me if you want
Credit goes to Summ for fixing the spell Here
Make a new file named fortypercentheal.lua
Server\data\spells\scripts\custommonsterspells\
Edit Spells.lua
Server\data\spells\spells.lua
Add this
Put this inside of the monster you want to heal at 40% and lower
Server\data\monster\
Have fun everyone
Repp++ me if you want
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
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>
Server\data\monster\
Lua:
<defense name="fortypercentheal" interval="2000" chance="100" min="30" max="50">
<attribute key="areaEffect" value="blueshimmer"/>
</defense>
Have fun everyone
Last edited: