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

[Request] Tutorial about exhaust

mpa

Member
Joined
Oct 8, 2008
Messages
319
Reaction score
13
Location
Sweden
I haven't seen any good tutorials on how to add exhaust to a talkaction, item usage, etc.
I would really appreciate if someone took the time to write a tutorial about this.

Best regards,
mpa
 
First of all you need to add
PHP:
dofile(getDataDir() .. "lib/exhaustion.lua")
At end of /lib/data.lua

There's all exhaust lua functions in 0.3:
PHP:
exhaustion.check(cid, storage)
exhaustion.get(cid, storage)
exhaustion.set(cid, storage, time)
exhaustion.make(cid, storage, time)

Functions checks/sets exhaust on typed storage so you can make many exhaustion types :)

First returning TRUE or FALSE (Player is exhausted (FALSE) or not (TRUE)).
Second returning time to finish exhaust or FALSE (FALSE when player isn't exhausted).
Third doesn't returning anything. It sets exhaust time with selected storage.
Fourth returning TRUE when player haven't exhaustion and sets exhaust time or FALSE when player are already exhausted.
 
Last edited:
PHP:
if exhaustion.check(cid, 666) == FALSE then
 doPlayerSendCancel(cid, "You're already exhausted.")
 return FALSE
end

PHP:
local storage = 666
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You're exhaust time on storage: ".. storage .." is ".. exhaustion.get(cid, storage) .."")

PHP:
exhaustion.set(cid, 666, 7)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've got 7 second of extra exhaust :)")

PHP:
(if exhaustion.make(cid, 666, 7)) == TRUE then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You've got 7 second of extra exhaust :)")
else
 doPlayerSendCancel(cid, "You are already exhausted.")
end
 
Last edited:
Ehm... Shouldn't it be:
PHP:
if exhaustion.check(cid, 666) == TRUE then
        doPlayerSendCancel(cid, "You are exhausted.")
    return FALSE
end
And exhaust.set and exhaust.make is the same?

Edit: Thanks for you help Keraxel, I would give you rep but "You must spread some Reputation around before giving it to Keraxel again.".

What kind of script should I do to practise now? :p
I have no ideas :(
 
Last edited:
Oh, it can be wroten in a variety of ways :p


Set always adds exh. time,
Make:
1) Checks for exhaust - if already is returns FALSE
2) if there is no exhaust sets storage to typed time and returns TRUE.
 
Last edited:
Hello there, I have this problem and I know its all about exhaustion but I duno where is it xD

Im using TFS 0.3.2 and the default exhaustion for agressive runes is 2 seconds and I desided to make it 1 second.

The problem is that, when you SPAMM the SD hotkey (keep pressing the key down) your exhaustion will be 2 seconds
In the other hand, If you are veri PRO and you press the SD hotkey once every second, you will succesfully shoot a SD every second

This problem is only appearing in the runes where the original exhaustion was 2 seconds, the other runes like healing runes etc are working fine.

I dont know where to modify this weird exhaustion phenomenon.

This is my config lua

Code:
	-- Item usage

	timeBetweenActions = 200

	timeBetweenExActions = 1000

This is my rune in spells.xml

Code:
<rune name="Sudden Death" id="2268" allowfaruse="1" charges="7" lvl="20" maglv="15" exhaustion="1000" needtarget="1" blocktype="solid" event="script" value="attack/sudden death.lua"/>

Vocation.xml

Code:
attackspeed="1000"

And this is my exhaustion.lua (I didnt touch this )

Code:
exhaustion =
{
	check = function (cid, storage)
		local exhaust = getPlayerStorageValue(cid, storage)
		if (os.time(t) >= exhaust) then
			return FALSE
		else
			return TRUE
		end
	end,

	get = function (cid, storage)
		local exhaust = getPlayerStorageValue(cid, storage)
		local left = exhaust - os.time(t)
		if (left >= 0) then
			return left
		else
			return FALSE
		end
	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 (exhaust > 0) then
			return FALSE
		else
			exhaustion.set(cid, storage, time)
			return TRUE
		end
	end
}


So I would appreciate if someone could tell me how to fix this since is kind of a big deal having exhaustion problems in a server.

Edit: Okay I edited the SD rune in spell.xml to have 0 exhaustion, I tested it and I shoot every SD in slightly less than a second, I was timing 20 sd shots and it was 18 seconds so 0.9sec every SD, WTF ?

Second Edit: Actually all the exhaustions are messed up, I tried with UH rune ( I didnt even modified that one) and sometimes It shoots the Uh every second, sometimes It has 1.5 second delay. Everything in the exhaustion of runes is messed up
 
Last edited:
Back
Top