Jump to content

Solution: Dynamically change images in book with script.


dylbill

Recommended Posts

Hey guys, as the title says I was looking for a way to change an image you see in a book with a script and I found one!

 

Instead of putting the image code directly in a book, you make a new item, I used a misc item, and name it the image code. Then in your book you use an alias that's filled with the misc item reference that has the image code name. Then you can use ForceRefTo to change the alias to another item with a different image code to change the book image.

 

Put this in the book in the ck:

<Alias=MyAlias>

 

Then to change the image you can do:

Int Property Image Auto 

If Image == 1   
    MyAlias.ForceRefTo(ObjectRefImage1) ;change to image1
Elseif Image == 2
    MyAlias.ForceRefTo(ObjectRefImage2) ;change to image2 
Endif
Also, if you're using skse, you don't need to use separate objects with different image code names, you can just use SetName like so:
If Image == 1   
    MyAlias.GetRef().GetBaseObject().SetName("<img src='img://textures/MyFolder/Image1.png'height='439' width='296'>")
    ;change to image1
Elseif Image == 2
    MyAlias.GetRef().GetBaseObject().SetName("<img src='img://textures/MyFolder/Image2.png'height='439' width='296'>")
    ;change to image2
Endif

I really didn't think this would work when I first started testing it but it does!

 

Keep in mind that the book you're reading has to be in an alias in the same quest as your MyAlias alias is in.

 

Link to comment
Share on other sites

  • 4 weeks later...

With the CK wiki it seems that user created files can only be seen when logged in which defeats the purpose for instructing the average user. You can post it to the Nexus wiki for Skyrim. At least it would be somewhere. But you might have to ask how to add new information. I cannot see how to add anything new. I am, however, able to edit existing pages.

Link to comment
Share on other sites

Cool thanks for the info, I'll look into that. If nothing else it's in this thread. A lot of times when I google how to do something mod wise, a thread from the nexus forums pop up.

 

Edit: Yep. I googled "Skyrim Script, change image in book" and this thread was the first thing that showed up.

Edited by dylbill
Link to comment
Share on other sites

So, CK wiki shares info only if one is logged in ?, and i was thinking to post a lot of things that i've discovered and they are not documented anywhere...


I'm completely opposite in the control of information, partially or under conditions share of information, this is so Not Democratic !!! especially when that info / data comes from random people which their only purpose is to share and expand freely knowledge and knowhow.


@ dylbill

Nice work.

Link to comment
Share on other sites

I have an account on the CK Wiki so I'm happy to post it there. I'll add it to the Text Replacement page.

 

I've added a bunch of stuff on there before. You don't need to be logged in to see things users have contributed.

That hadn't been my experience. I've just made sure that I was logged in from that point on.

 

Apparently they did fix it and I just hadn't noticed the reply: https://www.creationkit.com/index.php?title=Category_talk:Community_Tutorials

But they also purged much of the community content when SSE came out. Most of my contributions aside from an occasional grammar / spelling / syntax edit have been tossed out. Seems they only wanted content that worked with the CK's features rather than working around or through issues with the CK.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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