• 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?
 
Could you post link, I cant find it :S

Dont think we can post links here to that forum but Ill give you the post/script. Full credits to Mindrage (from otfans):

~If anyone wants this removed from here, tell me~

Mindrage said:
Hello guys, Its been a long time ago since I posted a spell so here is something I worked for my server:

Lua:
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


xml line is the same as exori hur (just remove needweapon="1")

I can't take a screenshot because I'm on my phone.
lol anyways this has been tested on TFS 0.3.4 patch level 2 (pl2)

This is what it does:
it drains 10% mana if you are at level 100.
on mages it does a bit more.
20% on level 200.

it can't drain mana if you got no mana, if you got less than the damage dealt it takes away that little piece you have left.
you drain the same amount of mana as you got from victim


maybe in an update I can make a modifyable thing to give you a % of what you took from victim.

it doesn't work on monsters since they don't any mana...(what I know)
I may also make a lifedrain later.

Enjoy!..
 
Back
Top