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

Solved onTargetCreature not working

Cadyan

Well-Known Member
Joined
Mar 30, 2008
Messages
845
Reaction score
63
Code:
function onTargetCreature(cid, target)
    if target and isPlayer(target) then
        doTargetCombatHealth(0, Player(target), COMBAT_HEALING, 5, 10, CONST_ME_HOLYAREA)
    end
    return true
end
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
function onCastSpell(cid, var)
        doCombat(cid, combat, var)
        return true
end

It's not sending the heal. TFS 1.0
 
Last edited by a moderator:
no it is suppose to be a heal, so does it need to be negative?
BTW: The spell is set to use params
Note: I plan on using more things with it, so I want it to work as is.
 
No I mean the type of spell, so that you have to target someone, because you don't have a combat area.
The combat should hit the target, atm this only happens when you target someone.
 
Code:
<instant group="healing" spellid="84" name="Holy Touch" words="exura sio" lvl="7" mana="30" aggressive="0" blockwalls="1" needtarget="1" playernameparam="1" params="1" exhaustion="3000" groupcooldown="1000" needlearn="1" script="priest/holy touch.lua">
    <vocation name="Priest"/>
</instant>
Code:
function onHolyTouch(cid, target)
    if target and isPlayer(target) then
        doTargetCombatHealth(0, target, COMBAT_HEALING, 5, 10, CONST_ME_HOLYAREA)
    end
    return true
end

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onHolyTouch")

function onCastSpell(cid, var)
    doCombat(cid, combat, var)
    return true
end


It's not healing me.

This is what I wanted:
Code:
function onHolyTouch(cid)
    return 5, 10
end
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onHolyTouch")

function onCastSpell(cid, var)
        doCombat(cid, combat, var)
        return true
end
 
Last edited by a moderator:
It has to be with a name?
Then you could use a talkaction script. You can add the mana spent and level/voc/exhaustion in the lua script.
CALLBACK_PARAM_TARGETCREATURE is ment for a creature that is hit by the combat, for example area combat, but it can also with targeting someone.

Btw, use code tags
[ code]
your script
[/code]
 
Back
Top