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

Doesn't work :S

Zaphery

New Member
Joined
Dec 14, 2009
Messages
28
Reaction score
0
I'm trying to make a function that if i'm exhausted the counter displayme a message saying how many seconds I have to wait for cast it again but doesen't work... some help please?

I'm using tfs 0.2.10 thanks!
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)

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)
	if exhaustion.get(cid,23000) == false then 
doPlayerSendTextMessage(cid,22,"Cooldown["..exhaustion.get(cid,23000).."]")
end
end
 
you shoulda just posted in the thread that you requested it from to begin with, no need for a whole new thread.

It should work but I'm not familiar with 0.2, does the exhaust work, oh and this is the wrong section... you know that.
 
you shoulda just posted in the thread that you requested it from to begin with, no need for a whole new thread.

It should work but I'm not familiar with 0.2, does the exhaust work, oh and this is the wrong section... you know that.

So i'm asking for someone to helpme with this, because I don't know how to make it...
 
but it doesnt belong in this section. its not a release its a question. but I'm not gunna act like a mod or ill get infracted lol. I gave you the best answer I can, but I can't help you if you dont use 0.3
 
Code:
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
}

local duration = 5

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)
	return exhaustion.get(cid,23000) and doPlayerSendTextMessage(cid,22,"Cooldown["..exhaustion.get(cid,23000).."]") or doCombat(cid, combat, var) and exhaustion.set(cid, 23000, duration)
end
Keep in mind though that it'll use mana even if it fails to cast (because of cooldown), so you might have to set mana="0" in spells.xml and make something like that in the Lua script.
 
Back
Top