Quote:
Originally Posted by key_strike
Thanks yosiemelo, I understand that I can just use the Lua to programmatically add/remove event drops/NPC's.
Though I am interested in understanding how these tables were used for events. For instance lua is a single threaded language so how would I write a script to keep running in the background to check if the event should have ended already to remove event items from the drop table without binding up the thread. I am not sure if this is possible. Of course since I am not running a production service, I will just do the check during server init and check against a hard coded dates and if so it will either enable an event or disable it.
Of course I would prefer to do this via the database (if it possible) that way things can remain tidy. Again nothing more than a curiosity to learn more at this point in time.
|
Sure — you can do that. In fact most events are time-based and they ARE checked dynamically, just not in the “run a Lua background thread forever” way.
The tables you posted are mainly there to store data that you already add/configure from Lua anyway. They don’t really “create” the event logic.
For example:
Telcaster.dbo.EventItemDropInfo
Telcaster.dbo.EventItemSupplyInfo
Those are basically persistence tables. They exist so the server can remember that an event was enabled + what drops it had, so if the server crashes or restarts it can restore the state instead of losing it.
And honestly, personally I don’t think making events in the database makes any sense here. There are too many limitations and it works in a very clunky way. It’s really not worth going deep into that topic when Lua events are cleaner and more flexible.
If you want, I can explain how I write events in Lua the proper/clean/optimal way on Discord. Just come with any example event idea and I’ll give you pseudocode that shows the whole mechanism and the intended structure. You’ll probably also pick up a few tricks I use.
my discord : yosiem