TFS 0.X Area Spell hitting specific creature

Tadelho

Excellent OT User
Joined
Aug 12, 2007
Messages
38
Best answers
1
Reaction score
2
Is it possible to make a area spell hits only a creature if it has a certain name? For example: how to do to a spell like, let's say, "divine caldera" (exevo mas san) hits only creatures in it's area named "rat"?

Is it possible to do? Could you help me with some ideas? I'm kinda lost trying to script that.
 
OP
T

Tadelho

Excellent OT User
Joined
Aug 12, 2007
Messages
38
Best answers
1
Reaction score
2
@Edit - YEAH, IT'S WORKING! (Feel free to copy the script, 0.4.0 users).

@hellboy I'm not sure if o.4 has it aswell, but the script should be like this, right?

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onTargetCreature(cid, target)
local creatures = {"creatureA", "creatureB"}
if isMonster(target) and isInArray(creatures, getCreatureName(target)) then
doTargetCombatHealth(cid, target, type, min, max, effect)
end
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
 
Last edited:

hellboy

Excellent OT User
Joined
Apr 6, 2008
Messages
413
Best answers
3
Reaction score
64
Location
getPlayerTown (getCreatureByName("Hellboy"))
@Edit - YEAH, IT'S WORKING! (Feel free to copy the script, 0.4.0 users).

@hellboy I'm not sure if o.4 has it aswell, but the script should be like this, right?

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)

local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)

function onTargetCreature(cid, target)
local creatures = {"creatureA", "creatureB"}
if isMonster(target) and isInArray(creatures, getCreatureName(target)) then
doTargetCombatHealth(cid, target, type, min, max, effect)
end
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
Thanks for sharing answer with community :)
 
Top