Many years ago I played a little bit about creating a Tibia server, but today I don't remember almost anything. I don't particularly remember the functions.
I started this script today, in fact I've been working on it for almost an hour. I'm very outdated haha
I need help finishing this script, so I'll follow as an example and create others for other runes.
In the case of this rune I'm creating it will work as follows:
When using this rune on a monster, it will deal damage and freeze. If the rune is used on another player, then some calculations will be made.
If the target has an evasion level higher than the precision level of the player using the rune, then nothing will happen, in fact, the player using the rune will only spend mana points.
If the target has an evasion level lower than the caster's accuracy level, then the target takes damage and has a chance to be frozen for three seconds.
Another note: When the player uses the rune, even not hitting the target, the caster will be invulnerable for three seconds, that is, the caster's evasion will be at maximum level for three seconds and then it will return to the previous level.
I started this script today, in fact I've been working on it for almost an hour. I'm very outdated haha
I need help finishing this script, so I'll follow as an example and create others for other runes.
In the case of this rune I'm creating it will work as follows:
When using this rune on a monster, it will deal damage and freeze. If the rune is used on another player, then some calculations will be made.
If the target has an evasion level higher than the precision level of the player using the rune, then nothing will happen, in fact, the player using the rune will only spend mana points.
If the target has an evasion level lower than the caster's accuracy level, then the target takes damage and has a chance to be frozen for three seconds.
Another note: When the player uses the rune, even not hitting the target, the caster will be invulnerable for three seconds, that is, the caster's evasion will be at maximum level for three seconds and then it will return to the previous level.
Lua:
local config ={
damageMultiplier = 6.80,
manaCost = 1248, -- Whenever the player uses this rune, he will lose 1250 mana.
cooldown = 600, -- Every ten minutes the player will be able to use the rune.
}
function freeze()
-- Debilitates the target, be it monster or player.
-- The freezing effect doesn't let the target move or even cast spells.
-- The effect will only last for three seconds.
return true
end
function becomeInvulnerable()
-- The player will have the evasion level at 999999999.
-- This will be the maximum evasion level, so no one will be able to hit the player when he is invulnerable.
-- The effect will only last for three seconds.
return true
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:removeMana()
player:becomeInvulnerable()
if target:isMonster() == true then
target:freeze()
target:removeHealth(player:getMagicLevel()*config.damageMultiplier)
else
if player:getPrecision() > target:getEvasion() then
if math.random(1, 100000) <= player:getChanceToFreeze() then
target:freeze()
end
target:removeHealth(player:getMagicLevel()*config.damageMultiplier)
else
-- If the target has an evasion greater than the caster's precision, then it will happen:
-- A small message appears above the target with the following text: *miss*
end
end
return true
end
-------- Things to add to the code:
---- Add a rune effect exactly the same as the effect of: Avalanche Rune
---- Everyone in the rune's area of effect is subject to being affected.
---- The calculation between the ratio of the caster's precision and the target's evasion will determine whether or not the target will take damage.
---- Example: If the caster has a higher accuracy than the target's evasion, then the target will take damage from the rune.