MrSledgeGaming Posted January 24, 2022 Share Posted January 24, 2022 (edited) Im looking into setting all pages of all skill books (regardless of mod) to X pages. I'm still pretty new to modding but I'm an experienced programmer, and saw there was something similar on the steam workshop called "read faster" (Not sure if I'm allowed to post the link). Unfortunately, the mod author didnt do the changes in the pages programmatically, so if u have other book mods, it wont change them and I was wondering if it was possible. My thoughts are: get all items from itemType "Skill Book" -> Set page # (can be just hard coded in the code or maybe mod options?) Would it be possible to update existing books or would they need to be spawned in? I would be developing this for a multiplayer server of the latest build Edited January 24, 2022 by MrSledgeGaming Link to comment Share on other sites More sharing options...
Spar10 Posted February 15, 2022 Share Posted February 15, 2022 A good place to look is the existing game code that searches and changes the 'Literature' objects. Look at the file ISLiteratureUI.lua in the "media/lua/client/ISUI' folder of the game files. Here is a snip of a function that manipulates the same data you want to change. -- Code copied from ISLiteratureUI:setLists() function function myEditSkillBooks() local skillBooks = {} local allItems = getScriptManager():getAllItems() for i=1,allItems:size() do local item = allItems:get(i-1) if item:getType() == Type.Literature then if SkillBook[item:getSkillTrained()] then -- This is a skillbook item store in structure for later table.insert(skillBooks, item) -- Can edit item here if you wish -- item:DoParam("Weight = 0.5"); end end end end -- Example of a SkillBook item --[[ item BookTailoring1 { DisplayCategory = SkillBook, NumberOfPages = 220, Weight = 0.8, Type = Literature, DisplayName = Tailoring for Beginners, Icon = Book11, SkillTrained = Tailoring, LvlSkillTrained = 1, NumLevelsTrained = 2, StaticModel = Book, WorldStaticModel = BookYellow_Ground, } --]] You would then need to have this function added to some game events to change all the data. Events.OnSpawnRegionsLoaded.Add(myEditSkillBooks) Events.OnLoad.Add(myEditSkillBooks) **Note: This function would edit/override all skill book data, possibly even new ones adds by other mods depending on load order. Link to comment Share on other sites More sharing options...
IronFist Posted March 27 Share Posted March 27 On 1/24/2022 at 1:26 PM, MrSledgeGaming said: Im looking into setting all pages of all skill books (regardless of mod) to X pages. I'm still pretty new to modding but I'm an experienced programmer, and saw there was something similar on the steam workshop called "read faster" (Not sure if I'm allowed to post the link). Unfortunately, the mod author didnt do the changes in the pages programmatically, so if u have other book mods, it wont change them and I was wondering if it was possible. My thoughts are: get all items from itemType "Skill Book" -> Set page # (can be just hard coded in the code or maybe mod options?) Would it be possible to update existing books or would they need to be spawned in? I would be developing this for a multiplayer server of the latest build It seems to me that such use of all books at the same time is impossible. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now