amokrun1 Posted March 8, 2023 Share Posted March 8, 2023 So I want to make a mod that prohibits reading or "eating" a spell tome if you haven't already eaten the one from the level before. So if you find a rank 3 tome but have not consumed the rank 2 yet, a msg will pop up saying you have not learned the preceding rank and therefore cannot learn this one yet. Does someone have an idea as to how I can get this going on? Link to comment Share on other sites More sharing options...
scorrp10 Posted March 8, 2023 Share Posted March 8, 2023 A taught spell/skill is an internal native property of a Book type object. If the property is set, internal game engine checks if spell is already known, and if not, adds spell to player and consumes the book. So if you want to make a change like you describe, you need to override every higher tier spell book form. You would need a script, something like: Scriptname AdvancedSpellTome Extends ObjectReference Spell Property TaughtSpell Auto Spell Property PreRequisite Auto Actor Property PlayerRef Auto Sound 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) Self.Delete() Else Debug.Notification("You must learn " + PreRequisite.GetName() + " before you can learn " + TaughtSpell.GetName()) EndIf EndEventI.e. FormID 0010F7F5 - Spell Tome 'ThunderBolt'. Set 'Teaches' selection to 'None' and attach above script. AutoFill the sound and playerRef properties. For spells, you would need to fill TaughtSpell with Thunderbolt, and PreRequisite with LightningBolt.(For all other tomes, you attach same script, just fill spell properties accordingly). Note that will likely mess with mods that rely on Book:GetSpell() (such as Unread Books Glow SE) Link to comment Share on other sites More sharing options...
amokrun1 Posted March 8, 2023 Author Share Posted March 8, 2023 Thanks for the reply! My limited scripting practice is with Fallout NV and it seems to work differently here. How do I attach a script to a form, i.e. as in the one above? Link to comment Share on other sites More sharing options...
scorrp10 Posted March 8, 2023 Share Posted March 8, 2023 Far as overall scripting goes, setting up the environment and such is really out of scope of this discussion - there are a fair few tutorials on YouTube about that. I do it in Creation Kit Once you click the Add, you can select an existing script or specify creating a new one. Once a script is created, it is placed in Data\Source\Scripts, and can be edited in external editor (I use NetBeans) and then compiled using Papyrus Script Manager (under Gameplay menu in CK) Link to comment Share on other sites More sharing options...
amokrun1 Posted March 9, 2023 Author Share Posted March 9, 2023 Ah right. In truth I am trying to apply the mod to Enderal but I am having trouble getting the Creation Kit to load up with it so in the interim I was using TES5Edit, which is why I could not see the scripts option. I need to resolve the loadup issue first. Thanks for the great visual feedback! Link to comment Share on other sites More sharing options...
Sphered Posted March 9, 2023 Share Posted March 9, 2023 Enderal works fine with the CK at least it does for me in 32Bit environment Maybe a localization thing. Make sure you copy over string files and it might help if they are loose Link to comment Share on other sites More sharing options...
amokrun1 Posted March 10, 2023 Author Share Posted March 10, 2023 (edited) I got it running and I am creating the script but it returns 'getname is not a function or does not exist' error. Is there a Creation Kit fixes I need to install or am I overlooking something acutely obvious? I checked the function out and apparently only available with SKSE, which I have installed. EDIT: Extracted SKSE scripts into the right place and was able to compile, but the script in-game doesn't work. The tome is prevented from being learned but even after having learned the spell from a rank lower. Edited March 10, 2023 by amokrun1 Link to comment Share on other sites More sharing options...
scorrp10 Posted March 10, 2023 Share Posted March 10, 2023 You started brand new game for this or loaded a save where you already had a book ? And have you filled the script properties in CK? Link to comment Share on other sites More sharing options...
amokrun1 Posted March 10, 2023 Author Share Posted March 10, 2023 (edited) I loaded a save and added books through console. I will try a completely new game to see. ED: Just tried new game, same result. And scripts were filled in CK. As in here: Scriptname SpecialTomeLevelSCPT extends ObjectReference Spell Property _48E_FS_Spell_Overstrain AutoSpell Property _30E_FS_Spell_Overstrain AutoActor Property PlayerRef AutoSound Property UISpellLearned Auto Event OnRead() If PlayerRef.HasSpell(_48E_FS_Spell_Overstrain) Debug.Notification("You already know " + _48E_FS_Spell_Overstrain.GetName()) ElseIf PlayerRef.HasSpell(_30E_FS_Spell_Overstrain) PlayerRef.AddSpell(_48E_FS_Spell_Overstrain) UISpellLearned.Play(PlayerRef) Self.Delete() Else Debug.Notification("You must learn " + _30E_FS_Spell_Overstrain.GetName() + " before you can learn " + _48E_FS_Spell_Overstrain.GetName()) EndIfEndEvent Perhaps I did not enter the forms correctly? Edited March 10, 2023 by amokrun1 Link to comment Share on other sites More sharing options...
scorrp10 Posted March 10, 2023 Share Posted March 10, 2023 Those are rather weird names there. What you want is a generic script that can be attached to ANY spell book, but you need to make sure to load proper spells into properties. I.e. I created the script 'PriorRequirementScript', and I attached it to 3 books. But for each book, I filled properties differently. Have you filled properties on your scripts? Link to comment Share on other sites More sharing options...
Recommended Posts