Mr.Caffeine
Active Member
- Joined
- Nov 4, 2018
- Messages
- 79
- Reaction score
- 43
Hello i have this uh rune script. I would like that rune can only be used to heal yourself, it cannot heal other players and monsters.
I tried to do it by comparing the name "if cid doesn't have the same name as target then cancel" but it didn't work. There are other ways to do this:?
I tried to do it by comparing the name "if cid doesn't have the same name as target then cancel" but it didn't work. There are other ways to do this:?
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
function onGetFormulaValues(cid, level, maglevel)
local ret = getCreatureMaxHealth(cid) * 0.5
return ret, ret
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
local target = variantToNumber(var)
if getCreatureName(cid) ~= getCreatureName(target) then
doPlayerSendCancel(cid,"You cannot use this rune on monsters or other players")
else
return doCombat(cid, combat, var)
end
end