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

GlobalEvent [System] Speed of the player is slower depends on the capacity used. V0.1

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
Speed of the player is slower depends on the capacity used. (Like Diablo II)

Update Log:
Code:
[B]v0.1:[/B]
- Now, player speed will be more slowly if the capacity used is highest than her speed multiplied by 2.

data/lib/function.lua
Lua:
function getPlayerMaxCap(cid)
local query = db.getResult("SELECT `cap` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";")
	if query:getID() ~= -1 then
		return query:getDataInt("cap")
	end
	query:free()
	return LUA_ERROR
end

data/globalevent/scripts/script_name.lua
Lua:
function onThink(interval, lastExecution, thinkInterval)

	for _, name in ipairs(getOnlinePlayers()) do

		local currentCap = getPlayerMaxCap(getPlayerByName(name)) - getPlayerFreeCap(getPlayerByName(name))
		local speed = getCreatureBaseSpeed(getPlayerByName(name)) - currentCap
		if (getCreatureBaseSpeed(getPlayerByName(name)) * 2) - currentCap < 220 then
			speed = 220
		end
		doChangeSpeed(getPlayerByName(name), -getCreatureSpeed(getPlayerByName(name)) + speed)
	end
	return TRUE
end

data/lib/globalevent.xml
PHP:
	<globalevent name="System_Name" interval="1" event="script" value="script_name.lua"/>

How works?
* When player take an item, speed change.
* More items = -speed.

Formula: (baseSpeed * 2) - capUsed.. example:
PHP:
Player have in her inventory/slot or in some place a boots of haste(Weight: 7.50 oz.) and a demon armor(Weight: 80.00 oz), total: 87.50 cap used.

So.. formula is: (baseSpeed * 2) - 87 --without decimals.

If (baseSpeed * 2) - capUsed < minimunSpeed(220 --speed of a level 1), player get the speed of a level 1.
 
Last edited:
Nice idea, and good work.
Interesting.
 
You don't run slower in diablo ii with many items, if I remember right..

However, I hate this would hate if many ots had this.
 
You don't run slower in diablo ii with many items, if I remember right..

However, I hate this would hate if many ots had this.

Mmmm.. i remember in Diablo II it happens... sorry if i'm wrong.

@script

Well.. is just a script, if somebody want to use, is her problem.
 
Should cause mass lag, running a loop through every online player, and using a mysql query too, every second. Don't recommend using this with a huge server. Maybe find another way to check. Don't use onThink
 
Haha nice, too bad it would make lags. If not, i'd use this.
__________________
klekSu.png

You are welcome on kleksoria.com!
Please visit new open tibia forum with it's own ots list. otservers.net!
 
Last edited:
I'd rather move it to sources and change the speed only if player has changed his inventory weight. No need to check it every sec at all.
 
@up, true, it can be dont without any lags just in sources...+ yeah, I already tried to make this system, but it needs more advanced formula, becouse knights always got too much free cap :D
 
I'd rather move it to sources and change the speed only if player has changed his inventory weight. No need to check it every sec at all.

Yep if someone would do this, I will be so happy :)
I dont want to use it, I just love seeing cool stuff like this made.
 
@up, true, it can be dont without any lags just in sources...+ yeah, I already tried to make this system, but it needs more advanced formula, becouse knights always got too much free cap :D


Do it by % used of (max capacity / Cap gain per level)

__________________

Are you tired of the customer neglect of TibiaBotNG? Do you think LoW needs to add more updates? Are you tired of using a crappy bot because its a cheap alternative to Elf? Well, dont be tired anymore! Check out my blog!
 
Last edited:
Back
Top