potinho
Intermediate OT User
I have a manarune script that works fine, but there's a problem: if I use the rune on me it works as expected, but if I click on the rune and on another player (to add mana to the other player) it gets added to myself (character who uses the rune).
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
local level = getPlayerLevel(cid)
local magicl = getPlayerMagLevel(cid)
local min = ((level * 0.2) + (magicl * 2) + 50)
local max = ((level * 0.2) + (magicl * 2.5) + 75)
doCreatureAddMana(cid, math.random(min, max))
return doCombat(cid, combat, var)
end