amokrun1 Posted March 11, 2023 Author Share Posted March 11, 2023 Yes the Enderal Editor IDs can be brutal. But I learned something from your above spoiler! This is quite different from NV. Anyway, I went into Edit Properties and filled in the spell fields correctly and testing it in-game the script does more or less what I want. The only problem now is that the higher-level book is not consumed, it's treated like a regular book and goes back into inventory(you just open the book and that's how you learn the spell). How can I tweak the script so that the higher-level book is consumed just like normal behavior(once the prerequisite has been met, of course). And also, thanks very much for the great explanation, I've learned quite a lot of the basics from you! Link to comment Share on other sites More sharing options...
scorrp10 Posted March 11, 2023 Share Posted March 11, 2023 Well, I kinda thought that Self.Delete() line would do the trick. But if that does not work, you can try replacing it with:PlayerRef.RemoveItem(Self, 1, true) If that still won't work, try:PlayerRef.RemoveItem(Self.GetBaseObject(), 1, true) Link to comment Share on other sites More sharing options...
amokrun1 Posted March 11, 2023 Author Share Posted March 11, 2023 (edited) Tried both, neither make a difference. I will look through the vanilla forms and see if that sheds any light on this. EDIT: So I'm almost there. I added a Book property because it seems the objectreference cannot be found and removed from inventory. The script looks like: Scriptname SpecialTomeSCPT extends ObjectReference Spell Property TaughtSpell AutoSpell Property PreRequisite AutoActor Property PlayerRef AutoBook Property selfRef Auto ;needs property because the objectreference can't be obtained and removed in the inventorySound Property UISpellLearned Auto Event OnRead() If PlayerRef.HasSpell(TaughtSpell) Debug.Notification("You already know " + TaughtSpell.GetName()) ElseIf PlayerRef.HasSpell(PreRequisite) PlayerRef.AddSpell(TaughtSpell) UISpellLearned.Play(PlayerRef) PlayerREF.RemoveItem(selfRef, 1) Else Debug.Notification("You must learn " + PreRequisite.GetName() + " before you can learn " + TaughtSpell.GetName()) EndIfEndEvent Book property was filled with the related book item obviously. Testing shows the book gets removed from inventory but the interface of opening a book as though to read it still remains. I need to figure out how to remove that too, then the script will be done! Edited March 11, 2023 by amokrun1 Link to comment Share on other sites More sharing options...
Sphered Posted March 11, 2023 Share Posted March 11, 2023 If your goal is to change game behavior with Rank2+ spell tomes, it will require edits to all the Rank2+ spell tomes to instead be handled in the game as regular books instead Remove the "Teaches Spell" flag Do use a script, and unfortunately this will be necessary on every Rank2+ spell tome if this is your goal here OnRead() works but it will attempt to read a blank book. I thought to suggest OnEquipped() but TBH I suspect that will have the same result of seeing the book UI, which unless you want that, wouldnt be very fluid Basically, your idea is simple and doable, but goes against the game's hard-coding. Best you can expect really is a noticeably worked-around outcome Link to comment Share on other sites More sharing options...
amokrun1 Posted March 11, 2023 Author Share Posted March 11, 2023 Not seeing the book UI is what I want, actually. Ideally, what I would want is this. Say you find Fireball Rank II before you find RanK I(Enderal uses ranks, cannot remember in Skyrim), you try to read it and there is no opening-book interface, just a pop-up or left-corner message telling you that you cannot because you have not read Rank I. Then you find Rank I, you consume it and it simply disappears with the "bang" sound FX. Then you go to Fireball Rank II, and you consume it, it disappears in the same manner with the "bang" FX just like Rank I. I don't mind the tedium of attaching a script for all the Rank 2+ books, it will take an afternoon, sure, but it would be worth it for the kind of restriction I want in the game. Link to comment Share on other sites More sharing options...
Sphered Posted March 11, 2023 Share Posted March 11, 2023 I didnt see page 2 so some of my post was redundance, my bad Well I have your solution, but its a bit out of the box. Use MiscObjects instead of Books for the Rank2+. They can use the same art etc but yeah this would give you the goldielocks result you want. No book interface, and yes script event. In XEdit there is a script called redirect references, so you could execute that, to update all the refs in Vyn to point to your MiscObject version instread. So very doable, just a question of how much you want this In above scenario you would use OnEquip() which triggers the event without actually equipping. Downside: If you know the spell already, there isnt a way to mark it as such in your inventory, but you could workaround that too using OnItemAdded() to remove itself if known etc As for sanitizing the BookObject after "consumed" you would simply removeitem. Try Self, and if that doesnt do it, GetBaseObject() should. Thing is ObjectReference is also a Form, so this comes down to how the script engine handles that request, and TBH I never had a need to test that component Link to comment Share on other sites More sharing options...
scorrp10 Posted March 11, 2023 Share Posted March 11, 2023 As you recall, reading a black book in Dragonborn briefly opens the book read view, and then immediately closes it.Look at DLC2BookDungeonControllerScript.psc, namely its ReadBook function. You probably can discard most of it but this is relevant: utility.waitMenuMode(1.5) ; wait for book opening animation...; close menu force fp, lock controlsGame.DisablePlayerControls(abMovement = true, abFighting = true, abCamSwitch = true, abLooking = pDataBook.DisableLooking, abSneaking = true, abMenu = true, abActivate = true, abJournalTabs = true) utility.wait(0.5) - I add this myself as likely need Game.EnablePlayerControls(abMovement = true, abFighting = true, abCamSwitch = true, abLooking = pDataBook.DisableLooking, abSneaking = true, abMenu = true, abActivate = true, abJournalTabs = true) Closing a 'book reading' menu is an action done by player, so you need to disable player controls to force-close a menu, and then immediately re-enable.. Link to comment Share on other sites More sharing options...
amokrun1 Posted March 13, 2023 Author Share Posted March 13, 2023 Hmm, seems to be more involved than I thought it would be. Making a consumable into a misc, for every tome in the game? Plus all the ones that mods add in a well? Not sure I want it that bad, in truth. Disappointing! But thanks both for the tips, I may try tinkering with your info a bit more, you never know. Link to comment Share on other sites More sharing options...
Recommended Posts