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

TFS 0.X Area Spell hitting specific creature

Tadelho

New Member
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.
 

hellboy

Well-Known Member
Joined
Apr 6, 2008
Messages
450
Best answers
4
Reaction score
72
Location
player:getTown()
I don't know how about 0.x, but in 1.x you have CALLBACK_PARAM_TARGETTILE and CALLBACK_PARAM_TARGETCREATURE in spells.

Example in 1.3 with mass healing and healing only players.
otland/forgottenserver
 
OP
T

Tadelho

New Member
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

Well-Known Member
Joined
Apr 6, 2008
Messages
450
Best answers
4
Reaction score
72
Location
player:getTown()
@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