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

Spell Cooldown Effect (specific exhaust)

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,890
Reaction score
458
Location
Texas
Ok ive seen this requested enough so here you go. This is just an example using the spell "Light healing" so take from this and apply to all your spells.

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
setHealingFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1.5, 2)

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

You need to change 23000 to another storage value for each spell, each spell needs a different value. 100 is the time of cooldown. Thats all you need to know basically.
 
Thanks a lot ^^
I'am was looking for it about 2 months :p

Rep ++ He's Deserve It ;)
 
Last edited:
definetly a good script, very easy and short... works perfectly! haha i bothered enough people to get this done rep for syntax :D
 
No problem, yeah I was tired of seeing the posts floating around here about it... If enough people request it, itll get scripted lmao.
 
I'm using tfs 2.10 and i get that error

Lua Script Error: [Spell Interface]
data/spells/scripts/healing/light healing.lua:eek:nCastSpell

data/spells/scripts/healing/light healing.lua:9: attempt to index global 'exhaus
tion' (a nil value)

I think this server don't recognize exhaustion command, how can i add in to my ot 8.1?
 
8.5x and you can always try to take the exhaust.lua file from the lib folder and paste into the global.lua file of your folder.
 
copy this into the end of your global.lua file.

Lua:
exhaustion =
{
	check = function (cid, storage)
		if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
			return false
		end

		return getPlayerStorageValue(cid, storage) >= os.time(t)
	end,

	get = function (cid, storage)
		if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
			return false
		end

		local exhaust = getPlayerStorageValue(cid, storage)
		if(exhaust > 0) then
			local left = exhaust - os.time(t)
			if(left >= 0) then
				return left
			end
		end

		return false
	end,

	set = function (cid, storage, time)
		setPlayerStorageValue(cid, storage, os.time(t) + time)
	end,

	make = function (cid, storage, time)
		local exhaust = exhaustion.get(cid, storage)
		if(not exhaust) then
			exhaustion.set(cid, storage, time)
			return true
		end

		return false
	end
}
 
Mmm now it says this error:

Warning: [Event::loadScript] Can not load script. data/spells/scripts/healing/li
ght healing.lua
data/spells/scripts/healing/light healing.lua:12: 'end' expected (to close 'if'
at line 9) near 'doPlayerSendCancel'

I have this on spells in light healing :S

function onCastSpell(cid, var)
if exhaustion.check(cid, 23000) == false then
exhaustion.set(cid, 23000, 100)
return doCombat(cid, combat, var)
doPlayerSendCancel(cid, "test")
else
doPlayerSendCancel(cid, "Cooldown " ..exhaustion.get(cid, 23000).."")
end
end
 
paste the whole spell in lua tag

<instant name="Light Healing" words="exura" lvl="9" mana="25" aggressive="0" selftarget="1" needlearn="0" script="healing/light healing.lua"/>

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 1.335, 0, 1.58, 0)

function onCastSpell(cid, var)
if exhaustion.check(cid, 23000) == false then
exhaustion.set(cid, 23000, 100)
return doCombat(cid, combat, var)
doPlayerSendCancel(cid, "test")
else
doPlayerSendCancel(cid, "Cooldown " ..exhaustion.get(cid, 23000).."")
end
end
 
Last edited:
I don't know where is the error but if i erase the line of do player cancel "test" doesent show any error message but when I cast exura isn't working :S... btw for what tfs is?
 
Ok ive seen this requested enough so here you go. This is just an example using the spell "Light healing" so take from this and apply to all your spells.

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
setHealingFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1.5, 2)

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

You need to change 23000 to another storage value for each spell, each spell needs a different value. 100 is the time of cooldown. Thats all you need to know basically.


I got a question, don't tell me to test it as I won't configure my server yet to test it by myself and i have a lot of work to do...

I can break the cooldown? I mean, or example that gives you a 1m40s cooldown (100secs)

but if i do a quest, and i get a storagevalue I can break that value into 75 or 50 seconds?

The real question is, can I add storagevalues to a spell on the TFS 0.6?
 
It will be like: if you don't have storage set exhaust to 100 sec, if you have it set to lower value
Hope you know how to make it?
 
@up
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
setHealingFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1.5, 2)

function onCastSpell(cid, var)
	if exhaustion.check(cid, 23000) == false then
		if getCreatureStorage(cid, 23001) == -1 then
			exhaustion.set(cid,23000, 100)
		else
			exhaustion.set(cid,23000, 50)
		end
		return doCombat(cid, combat, var)
	else
		doPlayerSendCancel(cid, "Cooldown[" ..exhaustion.get(cid,23000).."]")
	end
end

hope I don't need to explain it, try to figure out the config.
 
Can someone make it or something like that on tfs 0.2.10 please? I really need it :/
 
Can someone make it or something like that on tfs 0.2.10 please? I really need it :/
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
setHealingFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 1.5, 0, 2, 0)

local exhaustion =
{
	check = function (cid, storage)
		if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION) == TRUE) then
			return false
		end

		return getPlayerStorageValue(cid, storage) >= os.time(t)
	end,

	get = function (cid, storage)
		if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION) == TRUE) then
			return false
		end

		local exhaust = getPlayerStorageValue(cid, storage)
		if(exhaust > 0) then
			local left = exhaust - os.time(t)
			if(left >= 0) then
				return left
			end
		end

		return false
	end,

	set = function (cid, storage, time)
		setPlayerStorageValue(cid, storage, os.time(t) + time)
	end,

	make = function (cid, storage, time)
		local exhaust = exhaustion.get(cid, storage)
		if(not exhaust) then
			exhaustion.set(cid, storage, time)
			return true
		end

		return false
	end
}

function onCastSpell(cid, var)
	return not exhaustion.check(cid, 23000) and exhaustion.set(cid, 23000, getPlayerStorageValue(cid, 23001) < 0 and 100 or 50) and doCombat(cid, combat, var) or doPlayerSendCancel(cid, "Cooldown[" ..exhaustion.get(cid,23000).."]")
end
 
Back
Top