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

Lua How can I use this script (get written book from bookshelf) with TFS 1.5?

ForlornSkald

New Member
Joined
Dec 4, 2024
Messages
8
Reaction score
4
GitHub
ForlornSkald
So, the last time I was into OT's it was something like 10 years ago and I utilized TFS 0.3.6. Now I'm using Greed TFS 1.5. It is so good and clean I'm almost crying. But I'm lost, directionless when it comes to scripting. I wish to add an action where the player clicks on a bookshelf and a book with tidbits of lore is then received by him. It's this system, actually:

I love the idea that the book is stored within the player, and not as an actual item (if there were lots of players getting books the ground would be polluted).

But I don't know how to use it, or if it will work with my version. I'll try and mess around with the code soon.
 

For installing the code..
paste the code into a .lua script file and place the file into data/scripts
Then restart your server.
 

For installing the code..
paste the code into a .lua script file and place the file into data/scripts
Then restart your server.
Thank you so much! I should've looked into it further.
 
One little sugestion for future scripts, it can be stored in one storage, lets say

storage = 600

and check the progress
value = 1, x text
value = 2, y text

anyway @Xikini

u did so much for this community, but a lot of ppl are literaly disrespectfull

"Give them a finger, and they’ll take the whole hand"​

 
One little sugestion for future scripts, it can be stored in one storage, lets say

storage = 600

and check the progress
value = 1, x text
value = 2, y text

anyway @Xikini

u did so much for this community, but a lot of ppl are literaly disrespectfull

"Give them a finger, and they’ll take the whole hand"​

And how you give 2 or more not ordered books?
 
And how you give 2 or more not ordered books?
then now you can use other storage


LUA:
local mainStorage = 600

local config = {
                  [1] = {
                          [1] = "First read",
                          [2] = "Second read",
                        },
                  [2] = {
                         [1] = "First read",
                         [2] = "Second read",
                         [3] = "Third read",
                  }
                }
               
function getText(player, groundItem)
   local index = groundItem:getActionId() - mainStorage
   local t = config[index] ---access to config table
   local playerProgress = player:getStorageValue(mainStorage + index)
   local progressTable = t[playerProgress]
   if not progressTable then
      return t[1]
   end
 
   return progressTable
end

---601 will point to  config[1]
---602 will ponit to  config[2]

smth like that
 
Oh this is exactly what I was looking for, I have edited the script to make "sets" of books, depending on actionid, so that I can choose what kind of category books I want to put in an area, together with achievements if one collects one set, five sets and all sets of books.

Also chance to get no book at all, and added a cooldown so one cannot stand next to a bookcase and keep getting books.

I will be using this to let players find out recipes for crafting immersively next to hinting to secrets, quests all the good stuff.

One thing I do need to add is the removal of reading books by using a command, I want players to be able to place a bookcase in their house, where all these books gets added, but then Path of Exile 2 launched so had other distractions 😓

Xikini for president!
 
Oh this is exactly what I was looking for, I have edited the script to make "sets" of books, depending on actionid, so that I can choose what kind of category books I want to put in an area, together with achievements if one collects one set, five sets and all sets of books.

Also chance to get no book at all, and added a cooldown so one cannot stand next to a bookcase and keep getting books.

I will be using this to let players find out recipes for crafting immersively next to hinting to secrets, quests all the good stuff.

One thing I do need to add is the removal of reading books by using a command, I want players to be able to place a bookcase in their house, where all these books gets added, but then Path of Exile 2 launched so had other distractions 😓

Xikini for president!
Your server looks AWESOME. I love Middle-earth too, it's so nice to see something of this scope.
 
Back
Top