• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Items - healing increase, damage increase

SamX

VoltageOT Developer
Joined
Aug 27, 2010
Messages
557
Reaction score
151
Location
Canada
Hi,

I was wondering if anyone knows whether it's possible to add increased healing or increased damage if an item is equipped.

Lets say I equip a demon helmet, it should give me 5% more healing when using health potions/mana potions/healing spells. Same goes for damage with melee weapons/runes.

Just wondering if this is possible in items.xml, or would it be with a lua script?
 
It is possible. I am not known with the newer TFS but this could work around TFS 0.3.6

The easiest way(if you aren't a good scripter) is:

1. Register every weapon like wands but with damage formula according to the real tibia formula.

2. Register every equipment with script that the equipment gives the user a storagevalue. And loses it if he does not wear the equipment.

3. Give every weapon a secondary or third formula if the user have storagevalue X and/or storagevalue Y. With the additional bonus in the formula.


OR

Create more vocations that receives certain melee bonus on wearing certain equip, but this makes a mess you have to fix all your spells/weapons/vocationdoors?

But i think maybe by this time they got functions for that in the newer TFS, or you must be a good scripter in LUA/C++ I think.
But this is the fastest way i could find think of.



The storagevalue might also work in the pots and spells scripts.
 
2. Register every equipment with script that the equipment gives the user a storagevalue. And loses it if he does not wear the equipment.

I'd like this on my server also but I'm not good at scripting. I would like an amulet to gives +5% damage on all spells when equipped. Is there any chance you could construct the script for me?

Thanks
 
I'd like this on my server also but I'm not good at scripting. I would like an amulet to gives +5% damage on all spells when equipped. Is there any chance you could construct the script for me?

Thanks

I would like to help you, but i got barely free time. I even got no time for my own project(That's why i am hiring people).
But it is an simple script i think people might help you in the support forum or what i would recommend (as you will learn more from LUA)

Open a spell(animated) script, open another script where storagevalue is used.
And try to combine them.

Oncastspell~
if getplayerstoragevalue(cid, storagevalue, 1) == true then
return do combat(cid, combat2, var)
else
return do combat(cid, combat1, var)

and give the equipment a script that will give the player certain storagevalue if he wears it.
or take a look at other similar scripts.

I hope this helped you a bit.
 
Damage and healing can be done with onHealthChange/onManaChange in lua (TFS 1.2) or with onStatsChange(TFS 0.4-)

You would just have to either register some storage onequip/deequip for every piece of equipment that is going to have this or if you can edit the source you would do it there without storages and would work for every equipment without registering equip/deequip for every item.
 
Back
Top