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

CreatureEvent [TFS 1.3 / 1.4] Upgrade System

@oen432 there is a folder called data/scripts/lib all files of type lib should be defined here
these files are loaded after the classical lib's
Wasn't related to his error anyway. But for the future, RevScript is loading files in alphanumerical order, not prioritizing files over folders and that's the shitty part.
1637804955933.png
For example this structure will be loaded in this order:
1. companions.lua
2. enchantress.lua
3. scoundriel.lua
4. spells folder
5. templar.lua

So to make spells folder load last I had to rename scripts and make it this way
1637805032658.png
 
Nice system!
I've worked on dynamic items myself few years ago and remember it was painfull to repair everything that was based on itemId. I'm not familiar with TFS 1.x+ but without any source modification i think it is kinda pointless since functions like luaPlayerRemoveItem will not recognize attributes every npc sell will pick randomly not to mention market or loading from sql.
 
Wasn't related to his error anyway. But for the future, RevScript is loading files in alphanumerical order, not prioritizing files over folders and that's the shitty part.
View attachment 63578
For example this structure will be loaded in this order:
1. companions.lua
2. enchantress.lua
3. scoundriel.lua
4. spells folder
5. templar.lua

So to make spells folder load last I had to rename scripts and make it this way
View attachment 63579

Hello, I have a little problem, the items add the attributes, but when deequip the item, it does not remove the attributes.

I have no error in console, any possible solution?
 
Do you have this problem on every items? If you added custom item maybe it will need extra lines in movements.xml, but firstly test if you have same problem with item that is already present in movement.xml with equip and deequip functions
 
Do you have this problem on every items? If you added custom item maybe it will need extra lines in movements.xml, but firstly test if you have same problem with item that is already present in movement.xml with equip and deequip functions

I am using otservbr, I have the callback functions installed, all system works perfectly.

the only change I made:
Original Line:
MoveItemEvent.onMoveItem = function(player, item, fromPosition, toPosition)

Change to:
MoveItemEvent.onMoveItem = function(player, item, count, fromPosition, toPosition, fromCylinder, toCylinder)


because with the original line: I can't unequip any part of the set on players xD

and have this error in console:
attempt to index local 'fromPosition' (a number value)

I have been analyzing in detail, the problem is in fromPosition.

In line:
if fromPosition.y >= 64 or fromPosition.x ~= CONTAINER_POSITION then
When I remove that line, now it doesn't put the attributes, it just removes them.
 
Last edited:
yeah, probably count(number) is returned as fromPosition(position table) if you have source to your engine find there onMoveItem and check correct order or troubleshoot yourself by printing every value
 
Do you have this problem on every items? If you added custom item maybe it will need extra lines in movements.xml, but firstly test if you have same problem with item that is already present in movement.xml with equip and deequip functions
This script is not using Movements and is not depending on it.

I am using otservbr, I have the callback functions installed, all system works perfectly.

the only change I made:
Original Line:
MoveItemEvent.onMoveItem = function(player, item, fromPosition, toPosition)

Change to:
MoveItemEvent.onMoveItem = function(player, item, count, fromPosition, toPosition, fromCylinder, toCylinder)


because with the original line: I can't unequip any part of the set on players xD

and have this error in console:
attempt to index local 'fromPosition' (a number value)
That's my bad. Fixed, download new version.

As for why is it not removing attributes, maybe you don't have events enabled in data/events/events.xml?
Updated Wiki for that Installation RevScript & EventCallback · Oen44/TFS-Upgrade-System Wiki (https://github.com/Oen44/TFS-Upgrade-System/wiki/Installation-RevScript-&-EventCallback)
In OTServBR onItemMoved is disabled by default otservbr-global/events.xml at main · opentibiabr/otservbr-global (https://github.com/opentibiabr/otservbr-global/blob/main/data/events/events.xml#L22)
 
This script is not using Movements and is not depending on it.


That's my bad. Fixed, download new version.

As for why is it not removing attributes, maybe you don't have events enabled in data/events/events.xml?
Updated Wiki for that Installation RevScript & EventCallback · Oen44/TFS-Upgrade-System Wiki (https://github.com/Oen44/TFS-Upgrade-System/wiki/Installation-RevScript-&-EventCallback)
In OTServBR onItemMoved is disabled by default otservbr-global/events.xml at main · opentibiabr/otservbr-global (https://github.com/opentibiabr/otservbr-global/blob/main/data/events/events.xml#L22)

Wow, I missed that detail: onItemMoved

now if it is working well. Thank you so much

Suggestions for future system updates:
  • Message when stats change, with stats equipped.
  • Add mana regeneration/health regeneration (Ticks)
  • Add speed attribute

excellent system, very clean code, I hope I can add myself the suggestions that I made
 
This script is not using Movements and is not depending on it.


That's my bad. Fixed, download new version.

As for why is it not removing attributes, maybe you don't have events enabled in data/events/events.xml?
Updated Wiki for that Installation RevScript & EventCallback · Oen44/TFS-Upgrade-System Wiki (https://github.com/Oen44/TFS-Upgrade-System/wiki/Installation-RevScript-&-EventCallback)
In OTServBR onItemMoved is disabled by default otservbr-global/events.xml at main · opentibiabr/otservbr-global (https://github.com/opentibiabr/otservbr-global/blob/main/data/events/events.xml#L22)


Hello,
Im spent 2 days for trying configure it. I give up. If somebody can help me with it i'll be very thankfull.
My TFS is: The Forgotten Server - Version v1.4-46-g84337dfc
that's my console:
 

Attachments

Hello,
Im spent 2 days for trying configure it. I give up. If somebody can help me with it i'll be very thankfull.
My TFS is: The Forgotten Server - Version v1.4-46-g84337dfc
that's my console:

you need edit this part:

local LookEvent = EventCallback
local MoveItemEvent = EventCallback
local ItemMovedEvent = EventCallback
local GainExperienceEvent = EventCallback
local TargetCombatEvent = EventCallback


and:
LookEvent:register()
MoveItemEvent:register()
ItemMovedEvent:register()
GainExperienceEvent:register()
TargetCombatEvent:register()

For Example:

find function LookEvent:

LookEvent.onLook = function(player, thing, position, distance, description)


now place up:
local LookEvent = EventCallback

and add at the end of the function:
LookEvent:register()

Final result:

local LookEvent = EventCallback
LookEvent.onLook = function(player, thing, position, distance, description)
code code
code
code
code
return true
end
LookEvent:register(1)

you must do that process with the 5 eventcallback functions
 

I have enabled things in event.xml but should I make full instalation like pre 1.4? (on github instruction is only make event.xml and im not sure)
After your update i dont have any bug in console but this system still dont work correct on my ots.
I mean crystals working good, they are dissapear when i use it, I see info like:
22:18 Item upgrade level increased to 3!
22:18 Max number of bonuses reached!
22:18 Successfuly removed last attribute.
But when i look on item i dont see any bonus, when I wear it still nothing happens (im also try relog).
 
I have enabled things in event.xml but should I make full instalation like pre 1.4? (on github instruction is only make event.xml and im not sure)
After your update i dont have any bug in console but this system still dont work correct on my ots.
I mean crystals working good, they are dissapear when i use it, I see info like:
22:18 Item upgrade level increased to 3!
22:18 Max number of bonuses reached!
22:18 Successfuly removed last attribute.
But when i look on item i dont see any bonus, when I wear it still nothing happens (im also try relog).
You are using 1.4 so you don't follow pre-1.4. This is the only installation you need to follow Installation RevScript & EventCallback · Oen44/TFS-Upgrade-System Wiki (https://github.com/Oen44/TFS-Upgrade-System/wiki/Installation-RevScript-&-EventCallback)

Also read this
 
Last edited:
I have enabled things in event.xml but should I make full instalation like pre 1.4? (on github instruction is only make event.xml and im not sure)
After your update i dont have any bug in console but this system still dont work correct on my ots.
I mean crystals working good, they are dissapear when i use it, I see info like:
22:18 Item upgrade level increased to 3!
22:18 Max number of bonuses reached!
22:18 Successfuly removed last attribute.
But when i look on item i dont see any bonus, when I wear it still nothing happens (im also try relog).
Try:
LookEvent:register(1)

With the number 1.

I had a similar problem, that the attributes were not seen in the items, and solved with (1)
 
Oh nice, EventCallback has execution priority support.
Fixed here
thanks for valuing my work to repair small errors in your great system.

I have a good knowledge of code, and you are one of the programmers that I most admire for the work they share.
I'm glad I added a grain of sand to your system.

I would like to learn from you, greetings
 
Back
Top