clario
OTS based on Heroes III Might and Magic
- Joined
- Feb 4, 2018
- Messages
- 98
- Reaction score
- 5
Mana drain that deal dmg to ppl/monster and get same mana number of dmg deal .
im currently using this one:
But its not working on monser , just need much simple i think than this one...
im currently using this one:
local voc = 1, 2
function onCastSpell(cid, var)
local target = getCreatureTarget(cid)
local cidpos = getCreaturePosition(cid)
local targetpos = getCreaturePosition(target)
if getPlayerVocation(target) == voc then
drain = ((getCreatureMaxMana(target)/100) * (getPlayerLevel(cid)/7.5))-math.random(2, 43)
else
drain = ((getCreatureMaxMana(target)/100) * (getPlayerLevel(cid)/10))-math.random(2, 43)
end
if isPlayer(cid) and isPlayer(target) then
if getCreatureMana(target) < drain and getCreatureMana(target) > 0 then
local drain = getCreatureMana(target)
doCreatureAddMana(cid, drain)
doCreatureAddMana(target, -drain)
doSendMagicEffect(targetpos, 30)
doSendMagicEffect(cidpos, 30)
doSendDistanceShoot(targetpos, cidpos, 35)
return LUA_NO_ERROR
elseif getCreatureMana(target) > drain then
doCreatureAddMana(cid, drain)
doCreatureAddMana(target, -drain)
doSendMagicEffect(targetpos, 30)
doSendMagicEffect(cidpos, 30)
doSendDistanceShoot(targetpos, cidpos, 35)
return LUA_NO_ERROR
elseif getCreatureMana(target) == 0 then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return LUA_ERROR
elseif getCreatureMaxMana(target) < drain and getCreatureMana(target) > 0 then
local drain = getCreatureMaxMana(target)
doCreatureAddMana(cid, drain)
doCreatureAddMana(target, -drain)
doSendMagicEffect(targetpos, 30)
doSendMagicEffect(cidpos, 30)
doSendDistanceShoot(targetpos, cidpos, 35)
return LUA_NO_ERROR
end
end
end
But its not working on monser , just need much simple i think than this one...