local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
function onCastSpell(cid, var)
local outfit = {lookType = 128, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0}
if getCreatureHealth(cid) < getCreatureMaxHealth(cid) * 0.5 then
doCreatureChangeOutfit(cid, outfit)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
end
return doCombat(cid, combat, var)
end
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
function onCastSpell(cid, var)
local min, max = 50, 100
local outfit = {lookType = 130, lookHead = 100, lookBody = 100, lookLegs = 100, lookFeet = 100}
if doCreatureAddHealth(cid, math.floor(math.random(min, max))) ~= 0 then
if getCreatureHealth(cid) >= getCreatureMaxHealth(cid) * 0.5 then
doCreatureChangeOutfit(cid, outfit)
end
end
return doCombat(cid, combat, var)
end
<!-- sort of onThink -->
<defense name="spell_one" interval="1000" chance="99"/>
<!-- Scripted heal -->
<defense name="spell_two" interval="5000" chance="15"/>
<instant name="spell_one" words="###1" aggressive="0" blockwalls="0" selftarget="1" needlearn="1" script="test/script_one.lua"/>
<instant name="spell_two" words="###2" aggressive="0" blockwalls="0" selftarget="1" needlearn="1" script="test/script_two.lua"/>
Not workI guess it can be done by monster spells, however I'm not sure how to store the original outfit, which means you will have to use two scripts and change it back manually.
Script 1:
Script 2:LUA:local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) function onCastSpell(cid, var) local outfit = {lookType = 127, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0} if getCreatureHealth(cid) < getCreatureMaxHealth(cid) / 2 then doCreatureChangeOutfit(cid, outfit) doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED) end return doCombat(cid, combat, var) end
LUA:local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) function onCastSpell(cid, var) local min, max = 50, 100 local outfit = {lookType = 130, lookHead = 100, lookBody = 100, lookLegs = 100, lookFeet = 100} if doCreatureAddHealth(cid, math.floor(math.random(min, max))) then if getCreatureHealth(cid) >= getCreatureMaxHealth(cid) / 2 then doCreatureChangeOutfit(cid, outfit) end end return doCombat(cid, combat, var) end
Declare in yourmonster.xml
Code:<!-- sort of onThink --> <defense name="spell_one" interval="1000" chance="99"/> <!-- Scripted heal --> <defense name="spell_two" interval="5000" chance="15"/>
And in spells.xml
Code:<instant name="spell_one" words="###1" aggressive="0" needlearn="1" script="monster/script_one.lua"/> <instant name="spell_two" words="###2" aggressive="0" needlearn="1" script="monster/script_two.lua"/>
Okay, haven't had time to test it myself. Can you make sure the scripts are being executed properly?Not work
Alrighty, I will test it and see if I can get it to work next time I'm at my own computer.Yes I'm sure
Updated my previous post.Yes I'm sure