• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Mana Drain sword im looking 8.10

Haaan

New Member
Joined
Oct 24, 2009
Messages
56
Reaction score
0
Hello im looking for script for Mana draining sword.

Example 1:

If i hittting Train my mana regen by some % of my hits or just of some count(example 50mana/per hit).

Example 2:

If sword is equiped in hand, make faster mana regen(15mana/per sec)

Example 3:

If i hit player is stealing his mana by some % of hit. If player who i attacking is out of mana this will not regen my mana.


I prefer for Example 3, then Example 1 and then Example 2 if possible.

Sry for bad english ask when you dont understand.
 
Something like this? (Tested with tfs 0.3.6pl1, if it doesn't work, show me the errors)

LUA:
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_MANADRAIN)

	function onGetFormulaValues(cid, level, maglevel)
	min = -(maglevel*1) -level/10 -30
	max = -(maglevel*1) -level/10 -50

	return min, max
	end

	setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

    local combat1 = createCombatObject()
    setCombatParam(combat1, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat1, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatFormula(combat1, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

    local combat2 = createCombatObject()
    setCombatParam(combat2, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat2, COMBAT_PARAM_BLOCKSHIELD, 1)
    setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatFormula(combat2, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
 
function onUseWeapon(cid, var)
	local matmin = getPlayerMagLevel(cid)+getPlayerLevel(cid)/10+30
	local matmax = getPlayerMagLevel(cid)+getPlayerLevel(cid)/10+50
	local addmana = math.random(matmin/10, matmax/10)

 
    if getPlayerLevel(cid) >= 20 then
	if isPlayer(cid) and getCreatureMana(getCreatureTarget(cid)) >= 10 then
		doCombat(cid, combat, var)
		doCombat(cid, combat1, var)
        	doPlayerAddMana(cid, addmana)
        	doSendAnimatedText(getPlayerPosition(cid),"+"..addmana.."", TEXTCOLOR_LIGHTBLUE)
        	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
	else
        	doCombat(cid, combat2, var)
	end
    else
        doPlayerSendCancel(cid, 'You need level 20 to use this weapon.')
    end
end

Btw next time post in requests.
 
Last edited:
Back
Top