Pellape Posted October 19, 2020 Share Posted October 19, 2020 Hello fellow modders I want to make a script that searches for References to a specific object and add it as a quest target. I know this is done in Skyrim, in one of my favorite mods of all mods: Legacy of the Dragonborn but I can't check how he did it as I do not have CS for Skyrim, well... The working bench for this or rather desk is in the library of the Museum. I want to make a library that the player will be able to fill in my current WIP in a similar way, either by adding books they find or be able to start a quest for it, that target one book in a time for the player to find and it is here I want to be able to do it dynamic, not static. I could search in CS where every book is located but there's a chance the book is no longer there as the player might already picked it up and sold it and I could add all those bloody books in a database and point at alternative reference objects as well... Well doing it static will require a lot of coding and a lot of work and will not be pretty at all. The thing is that the script in Skyrim find books in cells from other mods as I did store loads of books for a period in one player made home with my char there, so that script might not search cell for cell at all as it cannot search in cells added by other mods as this surprised me for sure. So how do I search for a specific base object or its reference in game from a script? It doesn't matter if it is OBSE, Puffy or Vanilla as my WIP requires OBSE anyway. //Pekka Link to comment Share on other sites More sharing options...
KatsAwful Posted October 19, 2020 Share Posted October 19, 2020 What you're asking for isn't really possible in OblivionHowever, what should work is parsing installed mods for whatever you have installed, then if said mod is active you pass off to a user function that contains all the references and do something. I'm not sure what you actually need, but you could store said references into an array that your main script can deal with. The CS will simply see these references as strings if the plugin it comes from doesn't exist. And since you're already checking if those mods are installed or not, you'll never run these user functions that do the whatever you need. That should get you somewhere Link to comment Share on other sites More sharing options...
Pellape Posted October 19, 2020 Author Share Posted October 19, 2020 (edited) Yes it might help some and it is a shame we cant do it in game, I mean CS has a simple search function that finds everything, even notepad has it Ctrl-f :wink:. It is not so important to find the object in other modders cells as it is to find the object or rather references at all... If I got it right, Arrays have a limit of 20 records and I want to be able to create quests for every single book, both vanilla and cobl. I did found 2 OBSE functions that can check if the item was already picked by the player and even sold which will be useful. It might be so that I need to make a single script for every book and store all its references in an array up to its max limit, make looped checks. I got all time in the world as this will sure take long time to do. :tongue: Edited October 19, 2020 by Pellape Link to comment Share on other sites More sharing options...
KatsAwful Posted October 19, 2020 Share Posted October 19, 2020 you can nest arrays, albeit weirdly. Might help Link to comment Share on other sites More sharing options...
Pellape Posted October 20, 2020 Author Share Posted October 20, 2020 That true but might not be needed but I will find out sooner or later if it will be possible to do what I want at all as if the player for one example took all 20 references of a specific book, I can always put a new one somewhere in the game, in a box in a cave or at a bookshelf somewhere. :) Thanks. Link to comment Share on other sites More sharing options...
qwertyasdfgh Posted October 20, 2020 Share Posted October 20, 2020 If I got it right, Arrays have a limit of 20 recordsWhere did you read that? I'm sure there is some sort of limit on array size, but it's certainly much higher than 20. As for the original question, yeah, that's not possible - non-persistent references outside of player current cell are not loaded in memory and can't be accessed directly.Closest thing to what you want would be GetFirstRef/GetNextRef functions, but they work only for loaded cells. Link to comment Share on other sites More sharing options...
Pellape Posted October 20, 2020 Author Share Posted October 20, 2020 (edited) Well I might misunderstood the size limit or a record limit when I read about arrays, like in ar_map and ar_list at the CS Wiki. Such a limit seemed a bit odd but what do I know, as I only used arrays in C (Ansi C) earlier? I did not even knew until recently that we where able to use arrays at all in the Oblivion scripts and also making functions and I made my first test with arrays 2 days ago and it worked perfect. I wish this was possible the first period I played Oblivion 2006. OBSE sure makes life much easier. So then I need to make this simple... Put the object (every damn book) somewhere and let the player go and get it as I can't send players to places where the object used to be and hope it will still be there... Well I can but how fun is that :tongue: So many books, so many cells to make dirty... :D I could do it dynamic, well adding the item to the cell after the players arrives and have the quest activated. I do wonder how he did it in Skyrim at all as well? Making the dynamic quests in game, could take between 5-10 minutes, so I guess he loaded each cell into memory, one by one, searching for the object? I never used CS for Skyrim as I quit the game when Bethesda finally released it so I know nothing about Skyrim. I did run CS for it ones, failed to make what I wanted to do, and never used it again. Open that mod in SSEEdit today also opened a new world with new trees... //Pekka Edited October 20, 2020 by Pellape Link to comment Share on other sites More sharing options...
KatsAwful Posted October 20, 2020 Share Posted October 20, 2020 (edited) Skyrim completely overhauled how references can work, and part of that allows persistence depending on if a papyrus script calls for said reference. Thus you can read through references that aren't loaded without explicitly making them persistent. I believe this change in reference handling that allowed Todd Howard to say that every chest is safe to put user items into. Skyrim is a lot more sensible in a lot of ways that Oblivion will never be able to achieve unfortunately Edited October 20, 2020 by KatsAwful Link to comment Share on other sites More sharing options...
QQuix Posted October 20, 2020 Share Posted October 20, 2020 Elaborating on what has already been said: Arrays do not have a limit themselves, (I had arrays with thousand of entries without problems) The omly actual limit is the available memory. Oblivion unloads cells 'as needed', depending on its memory management criteria. So, when you enter a new cell, most likely some other cell will be unloaded. Depending on memory size you may have the last several cells still loaded, but, on extreme low memory PC,s, the game may unload the previous cell in order to make romm for the new cell. You have two problems: (1) Find the FormID of the books: As already said, the best way to find FormIDs is GetFirstRef/GetNextRef (in your case GetFirstRefInCell). Problem is: if that cell is not loaded it will not work as you need it (see GetFirstRefInCell notes). (2) Interact with the unloaded reference If you, somehow, get the FormID of the book and the book is not loaded, it will not work either as your ref variable will be '00000000'. Check the functions GetFormIDString, GetRawFormIDString and IsFormValid But you have a very good idea to make it work: Adding the book as the player enters the cell. (I know it works, for I have used this trick) GetFirstRef will work on the player cell, so you could check if the original book is still there and add a new one it not. The only problem is to position this new book. Link to comment Share on other sites More sharing options...
Pellape Posted October 21, 2020 Author Share Posted October 21, 2020 (edited) Well replacing a taken book with a new one would not be a problem as I could check the coordinates and angles for that book that I will choose for the quest in CS and place the new one in the exact position, or choose a new location as well in the same cell with setpos and setangle, trying to avoid to reuse the same cell again, to make it as interesting as possible, well if the player now likes the idea to chase books all over the place. There's mods that adds full libraries, but what is the point with that? That's a very good idea really as when my dreams of making this dynamic did crash, the only thought that crossed my mind was to place the book's in caves that are quest less, like that Orc in Skyrim, that make you chase books he wants at the same places, well maybe at 10 different locations and after a while you need to get the same books all over again.... :D Thoose repeatable quests gets extremely boring after a while or rather very fast. When we debate books... Well maybe I should ask this in my WIP and not here but how should I handle Skill books? How would you handle them? Use the original books that adds the skills or use copies without skills? I do plan to use replicas for every book anyway at the library, removing the collisions with Nifscope or Blender, to avoid havoc and books that falls from the shelves so when the player wants to read a book, the replica will get disabled and the real one will be added to the inventory. But some might react very negative if they get a bloody replica when they know it is a skill book in the first place? I will make new shelves with Blender anyway, similar to the ones in Legacy of the dragonborn, so each book will face the player with its front and not 10-15 books stacked together as is common. Edited October 21, 2020 by Pellape Link to comment Share on other sites More sharing options...
Recommended Posts