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

Mana Drain spell

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,766
Solutions
1
Reaction score
225
Location
Chile, Santiago
Hi, here is a mana drain spell

PHP:
-- Damage Configuration
local MIN = 200
local MAX = 300

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.4, -MIN, -0.4, -MAX)

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

It could be possible that the mana amount hited to the player, be added to the player that did the spell? I mean, like stealing mana, you make the spell on the targeted player X, he looses 150 mana and you gain 150 mana?

Someone plx?
 
Code:
function onCastSpell(cid, var)
	local list = getSpectators(getCreaturePosition(cid), 9, 9, false)
	if (#list > 0) then
		for i = 1, #list do
			local target = list[i]
			if (isPlayer(target) == TRUE and isNpc(target) == FALSE and cid ~= target) then
				local mana = getPlayerMana(target)
				doPlayerAddMana(target, -mana)
				doPlayerAddMana(cid, mana)
			end
		end
	end
	return TRUE
end
 
Last edited:
Edited, now works ;)

17:32 You lose 955 mana.

I think you should make a function to block drain from Game Master's etc.
 
It's nice, but could you make it to work with your ml, I mean, if you have more ml, you drain more mana?

COMBAT_FORMULA_LEVELMAGIC?
 
Back
Top