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

Lua Spell Heal/Damage

nefinoo

Carnage.flv
Joined
Sep 11, 2010
Messages
555
Solutions
1
Reaction score
62
Location
Lo Mochis, Sinaloa
spell that heals the monster and damages players, as if it were life steal from the monster, i am using tfs 1.3
 
Solution
Try this one
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

function onCastSpell(creature, variant)
local player = creature:getPlayer()
    local min = 1000
    local max = 2000
for _, target in ipairs(combat:getTargets(creature, variant)) do
if target:isPlayer() then 
doTargetCombat(0, target, COMBAT_HEALING, -min, -max)
end
if target:isMonster() then
doTargetCombat(0, target, COMBAT_HEALING, min, max)
end
end
return true
end
Try this one
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

function onCastSpell(creature, variant)
local player = creature:getPlayer()
    local min = 1000
    local max = 2000
for _, target in ipairs(combat:getTargets(creature, variant)) do
if target:isPlayer() then 
doTargetCombat(0, target, COMBAT_HEALING, -min, -max)
end
if target:isMonster() then
doTargetCombat(0, target, COMBAT_HEALING, min, max)
end
end
return true
end
 
Last edited:
Solution
[Warning - Event::checkScript] Event onCastSpell not found. scripts/monster/nightmare.lua
Did you solve it? Because you marked my reply as solution just as soon as you posted this error so I don't know if its solved or not.
I think you added it in wrong folder, It should be in data/spells/scripts/monster and you'll have to add it in spells.xml like this line
XML:
<instant name="scriptname" words="###1" aggressive="0" blockwalls="1" needtarget="0" needlearn="0"  script="monster/scriptname.lua"/>
 
Last edited:
Did you solve it? Because you marked my reply as solution just as soon as you posted this error so I don't know if its solved or not.
I think you added it in wrong folder, It should be in data/spells/scripts/monster and you'll have to add it in spells.xml like this line
XML:
<instant name="scriptname" words="###1" aggressive="0" blockwalls="1" needtarget="0" needlearn="0"  script="monster/scriptname.lua"/>
XML:
<instant name="Nightmare Beast" words="#####474" direction="1" aggressive="1" blockwalls="1" needtarget="0" needlearn="1" script="monster/nightmare.lua" />

I didn't actually copy the xml code to add the spell you passed to me. The other xml spells for monsters also come like this monster/filename.lua
By the way, it was my mistake to have set you as solved without first testing the script.
 
No is working but my monsters dont heal itself

Lua Script Error: [Spell Interface]
in callback: data/spells/scripts/monster/nightmare.lua:eek:nTargetCreature
(Unknown scriptfile)
data/spells/scripts/monster/nightmare.lua:9: attempt to index global 'player' (a nil value)
 
Last edited:
also if demon attacks player for like 500 damage
the demon will heal 500 aswell?
Yeah is gona be a spell with X interval and X chance to cast
Post automatically merged:

No heal or damage? Both not working?
Yeah nothing, my monster dont heal and dont make anydamage
 
Back
Top