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

Lua Exhaustion script on spell

Raiden

Developer
Joined
Sep 16, 2008
Messages
486
Reaction score
32
Location
Venezuela
hello! searching in this forum i found a nice exhaust script!, but i got one problem with it, when i'm "exhausted" and i cast the spell it continues removing me mana, and i want delete that because a exevo gran mas vis removes me 700 mana and if i want check my exhausted i need waste that amount of mana... I might that you will understand...

Server: Avesta 7.6
Script: Light healing (exura)

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
function onGetFormulaValues(cid, level, maglevel)
	min = (level * 2 + maglevel * 3) * 0.10
	max = (level * 2 + maglevel * 3) * 0.35
	
	if min < 15 then
		min = 15
	end

	return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
        if exhaustion.check(cid, 18000) == 0 then
                exhaustion.set(cid, 18000, 100)
                return doCombat(cid, combat, var)
        else
                doPlayerSendCancel(cid, "Cooldown[" ..exhaustion.get(cid, 18000).."]")
        end
end

All works fine, but when i'm exhausted it continues wasting me mana...
 
this is happening because you have mana="700" in your spells.xml, then everytime you use the spell, it will use your mana.

you must set mana="0" on spells.xml and change your lua script of the spell to something like

Code:
function onCastSpell(cid, var)
        if exhaustion.check(cid, 18000) == 0 then
				if [COLOR="red"]hasEnoughMana[/COLOR] then
					exhaustion.set(cid, 18000, 100)
					return doCombat(cid, combat, var)
				else
					[COLOR="red"]sendCancelMessage[/COLOR]
				end
        else
                doPlayerSendCancel(cid, "Cooldown[" ..exhaustion.get(cid, 18000).."]")
        end
end

and change the red pieces to the correct ones...
 
Back
Top