Jump to content

Scripting means to 'load item from mod' and place it straight onto a bookshelf??


Recommended Posts

This is a fun puzzle, and not sure if it is fully possible.....

 

There is the ever popular command known as  GetFormFromMod  which I use quite often for many a features. And one can place contents from such calls into containers, be they chests or NPCs themselves.  However, these items do not physically appear within the game until taken out of said container.

 

What I want is to be able to acquire the form (as in above), and be able to place the form (or reference thereof) on a shelf.  For example, if I was to make a Tamago-based mod and the player had installed and activated a copy of my TamagoGuide.esp in their game, I would like said mod detect the book and visually place it on a bookshelf as I so prescribe.  This, only working if TamagoGuide is detected, and the mod not hampered if it were not.

Link to comment
20 hours ago, LongDukDong said:

There is the ever popular command known as  GetFormFromMod  which I use quite often for many a features. And one can place contents from such calls into containers, be they chests or NPCs themselves.  However, these items do not physically appear within the game until taken out of said container.

 

What I want is to be able to acquire the form (as in above), and be able to place the form (or reference thereof) on a shelf. 

 

You can spawn objects in the world with PlaceAtMe and then position them with SetPos.

 

Link to comment
On 2/22/2021 at 2:23 PM, Akor said:

You can spawn objects in the world with PlaceAtMe and then position them with SetPos.

 

I attempted to use PlaceAtMe as you suggested, but with no joy. 

 

PlaceAtMe appears to only accept the creation and placement of items from the actual Database list and not to reference objects such as loaded objects which is the actual intent.  I can grab the "BlankSheet" item from the Books database.  But if I tried to use a reference object that is drawn on a map, it will not work.  And with that, neither will a reference object loaded using the GetFormFromMod command.

 

EXAMPLES:

PlaceAtMe Book4RareSpiritoftheDaedra, 1, 256, 1

( This is just fine.  But the item is from the database )

 

let MyBook := GetFormFromMod "LoversPrimaBooks2.esp" "002A2A" ;; Lady Sauria

PlacaAtMe MyBook, 1, 256, 1

( Error Message:  Item 'MyBook' not found for parameter ObjectID Compiled script not saved )

 

Thank you for the consideration.

Link to comment
6 hours ago, LongDukDong said:

 

let MyBook := GetFormFromMod "LoversPrimaBooks2.esp" "002A2A" ;; Lady Sauria

PlacaAtMe MyBook, 1, 256, 1

( Error Message:  Item 'MyBook' not found for parameter ObjectID Compiled script not saved )

 

Thank you for the consideration.

 

I think the error message you get is because you don't have MyBook defined in the script?

 

I wrote a test script and I can compile it without errors. I haven't tested it in game yet, will do that later I'm currently at work, but I'm pretty sure it should work this way. ;)

 

 

scn lksCoreGameLoadedKinkyCollarsFunc

ref 		formRef
string_var 	formID
ref 		objRef


Begin Function {}
	
let formID := lksKinkyCollarQuest.LoadCollarID
PrintC "LKS-DEBUG|lksCoreGameLoadedKinkyCollarsFunc|formID|%z" formID
				
let formRef := GetFormFromMod "LoversKinkyStalker.esp" $formID
PrintC "LKS-DEBUG|lksCoreGameLoadedKinkyCollarsFunc|formRef|%n" formRef

let objRef := Player.PlaceAtMe formRef, 1, 256, 1
	
End

 

 

 

 

 

Link to comment

Alas, no.  And there was a misunderstanding.  I certainly had a MyBook reference defined within my code.  I merely gave the main content within the funciton block.

 

 

Let's assume this alteration of your code:

 

let formID := "002A2A"
PrintC "LKS-DEBUG|lksCoreGameLoadedKinkyCollarsFunc|formID|%z" formID
				
let formRef := GetFormFromMod "LoversPrimaBooks2.esp" $formID
PrintC "LKS-DEBUG|lksCoreGameLoadedKinkyCollarsFunc|formRef|%n" formRef

let objRef := Player.PlaceAtMe formRef, 1, 64, 1

 

And lets assume this change is meant to grant me access to one of the books in my Prima Book mods, "Lady Sauria" that describes Ocheeva's rise within the Dark Brotherhood thanks to a secret weapon.

 

Yes, I do receive the message:  "LKS-DEBUG|lksCoreGameLoadedKinkyCollarsFunc|formID|7C002A2A"

And yes, I do receive the message:  "LKS-DEBUG|lksCoreGameLoadedKinkyCollarsFunc|formRef|Lady Sauria"

 

So both debug messages do recognize my string and refernce objects.  However, the book does not appear.  And at the time, I am in the expansive foyer of Castle Chorrol.

 

I have also tried the variants of:   let objRef := PlaceAtMe formRef, 1, 64, 1

and  PlaceAtMe formRef, 1, 64, 1

 

Both to no avail.  Again, my belief is that  PlaceAtMe only functions properly with  objects from the current database (the database for the mod itself) and not loaded objects.  So while I could use PlaceAtMe within the PrimaBook2 mod to move Lady Sauria around, or have a mod that had PrimaBook2 as a dependent, it appears non-functional here.

Link to comment
  • 4 weeks later...
  • 4 weeks later...

Cursory 1-month(ish) bump ?

 

Hopefully, someone may have an answer to being able to physically place a referenced object loaded from one mod for another, now realizing the  PlaceAtMe command appears only to work with items from its own native mod.

 

Even so, I was hoping to load a store-front with books prior to my arrival at the store.... as an example.  I would prefer to have said item placement occur at mod start and not require the player be present where the placement occurs.

Link to comment
2 hours ago, LongDukDong said:

Cursory 1-month(ish) bump ?

 

Hopefully, someone may have an answer to being able to physically place a referenced object loaded from one mod for another, now realizing the  PlaceAtMe command appears only to work with items from its own native mod.

 

Even so, I was hoping to load a store-front with books prior to my arrival at the store.... as an example.  I would prefer to have said item placement occur at mod start and not require the player be present where the placement occurs.

MOO does what you ask it gets code from a loaded mod "etc.esp" and pulls in info. But, as for actual code for that , I'm not a writer.

Link to comment

I remember PlaceAtMe being kind of janky. I did some testing at the Waterfront, and out of curiosity used the toggle wireframe command - the book I spawned was floating beneath the cobblestones. You need to get the player's Z pos, and set the book's Z pos to that + 100. It'll appear near eye-height.

 

I've attached two masterless esps - one with a book that isn't loaded by anything, and the other that uses your code above to spawn it.

PlaceAtMeTesting.zip

Link to comment
10 hours ago, LongDukDong said:

:O   Snagging now.  I won't be able to get to it this weekend (BUSY AS HELL).  But this sounds promising!

 

Another option might be to use the Better Bookshelves resource. It's a container that uses a bookshelf model, and you place static books on it. You could enable /disable the statics depending on what mods are loaded, and fill the container with a list. Might be easier than trying to spawn actual books on markers.

 

Edit: Using a marker wasn't too hard, I've attached an example. It'd need some fine-tuning for your actual mod. The test cell is called "xtbsRoom". This'll cause some file save bloat though.

TestingBookshelves.zip

Link to comment
On 4/22/2021 at 11:12 PM, Sandalwood said:

I've attached two masterless esps - one with a book that isn't loaded by anything, and the other that uses your code above to spawn it.

 

I am UTTTERLY confused!!!  :O  This works, yet it is practically a mirror of ....

 

On 3/1/2021 at 3:35 PM, LongDukDong said:

 


let formID := "002A2A"
PrintC "LKS-DEBUG|lksCoreGameLoadedKinkyCollarsFunc|formID|%z" formID
				
let formRef := GetFormFromMod "LoversPrimaBooks2.esp" $formID
PrintC "LKS-DEBUG|lksCoreGameLoadedKinkyCollarsFunc|formRef|%n" formRef

let objRef := Player.PlaceAtMe formRef, 1, 64, 1

 

... which did NOT work.  WHY? :no_mouth:

 

For further testing purposes, I did the following:
* The former
FormID of "000800" was replaced with "002A2A"

* The GetFormFromMod command no longer designates  "TestingBook.esp" , but now "LoversPrimaBooks2.esp"

 

And now, the book "Lady Sauria" from my Prima Book mod drops into my lap whence the mod is loaded!

 

Furthermore, I changed the reference target in the PlaceAtMe from player to another reference, a Bookshelf reference in another cell, and the book is suddenly on top of the bookshelf!!!!  :flushed:

 

I'm still stunned!  :dizzy:  It still freakin' works, and is virtually no different than what I had prior!

 

Now I can make mods (or anyone with this kinda code) that can load books from outside mods and have them placed in designated shelves, tables, display units if said book mods are in play!   Better if the books have custom jackets. ;) A porn book store would love this... of course they need to have knowledge of all the books they sell (and show).

 

This can now be closed.

Link to comment
7 hours ago, LongDukDong said:

 

I am UTTTERLY confused!!!  :O  This works, yet it is practically a mirror of ....

 

... which did NOT work.  WHY? :no_mouth:

 

For further testing purposes, I did the following:
* The former
FormID of "000800" was replaced with "002A2A"

* The GetFormFromMod command no longer designates  "TestingBook.esp" , but now "LoversPrimaBooks2.esp"

 

And now, the book "Lady Sauria" from my Prima Book mod drops into my lap whence the mod is loaded!

 

Furthermore, I changed the reference target in the PlaceAtMe from player to another reference, a Bookshelf reference in another cell, and the book is suddenly on top of the bookshelf!!!!  :flushed:

 

I'm still stunned!  :dizzy:  It still freakin' works, and is virtually no different than what I had prior!

 

Now I can make mods (or anyone with this kinda code) that can load books from outside mods and have them placed in designated shelves, tables, display units if said book mods are in play!   Better if the books have custom jackets. ;) A porn book store would love this... of course they need to have knowledge of all the books they sell (and show).

 

This can now be closed.

You should sticky these in your user tag/bar.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use