NationalSpearmint Posted November 19, 2018 Author Share Posted November 19, 2018 (edited) Thanks folks, I've got it working now. One more question, although it's straying a bit from my original query - is a LeveledItem a collection of Forms, then? As you mention, a Form property's drop-down doesn't show everything you would expect (I'd expect the same contents as the "Object" drop-down when editing a LeveledItem, but it instead just has CommandingActorPersistenceForm and PapyrusPersistenceForm). Is there a type which both LeveledItems and ordinary Items extend from, other than Forms? Also, is what is the 'superclass' of all (regular, non-leveled) Items (if there is one other than Form)?Thanks Edited November 19, 2018 by NationalSpearmint Link to comment Share on other sites More sharing options...
testiger2 Posted November 19, 2018 Share Posted November 19, 2018 The wiki has a class map if that helps youhttps://www.creationkit.com/index.php?title=Category:Script_Objects Link to comment Share on other sites More sharing options...
foamyesque Posted November 20, 2018 Share Posted November 20, 2018 (edited) Thanks folks, I've got it working now. One more question, although it's straying a bit from my original query - is a LeveledItem a collection of Forms, then? As you mention, a Form property's drop-down doesn't show everything you would expect (I'd expect the same contents as the "Object" drop-down when editing a LeveledItem, but it instead just has CommandingActorPersistenceForm and PapyrusPersistenceForm). Is there a type which both LeveledItems and ordinary Items extend from, other than Forms? Also, is what is the 'superclass' of all (regular, non-leveled) Items (if there is one other than Form)?Thanks Almost everything is a Form (the two major exceptions are Aliases and ActiveMagicEffects), but to fill a Property in the Properties menu you need to specify its subtype. This isn't a problem because there's nothing you'd want to refer to that doesn't have a subtype of some kind. You can treat it as a generic form thereafter, including putting it into variables or properties of the type Form without needing to explicitly cast it, so you could have, say, an array of type Form[] that you use to hold a list of both weapons and armour. You don't need to be concerned about how a LeveledItem internally stores its lists of forms because, as it is a script object, it provides the functions to find and manipulate those items itself (particularly if you're using SKSE). Edited November 20, 2018 by foamyesque Link to comment Share on other sites More sharing options...
NationalSpearmint Posted November 20, 2018 Author Share Posted November 20, 2018 (edited) Thanks very much everyone, pretty sure I've got everything working as I want it.Mod link: https://www.nexusmods.com/skyrim/mods/94772/ Edited November 20, 2018 by NationalSpearmint Link to comment Share on other sites More sharing options...
NationalSpearmint Posted November 20, 2018 Author Share Posted November 20, 2018 Just to (hopefully) be of use to people who want to have custom items added to levelled lists in future, who may stumble across this post, here's the process I used: 0. Set up Creation Kit for Papyrus scripting by extracting the Scripts.rar file in Skyrim/Data .1. Create a new Quest. Set this to Start Game Enabled and Run Once.2. Close and re-open the Quest window (not entirely sure this is necessary, but I recall other tutorials mentioning it).3. In the Scripts tab of the Quest, Add a new script. I'd recommend naming the script something like "AddBooksToLeveledItems" (if the item you want to add are books).4. Right-click on this script and click "Edit Source".5. Because of the issue Myst42 mentioned (the Forms drop-down not populating correctly), you'll need a seperate script for each type of Form you want to add to a LeveledItem. For the script text, enter as follows: Scriptname <ScriptName> extends Quest LeveledItem[] Property LevelledListToUpdateArray Auto <ItemType>[] Property ItemToAddArray Auto Int[] Property MinimumLevelArray Auto Function AddLevelledListToLevelledList(LeveledItem LevelledList, Form FormToAdd, Int MinimumLevel, Int NumberToAdd) LevelledList.AddForm(FormToAdd,MinimumLevel,NumberToAdd) EndFunction Event OnInit() Int iElement = LevelledListToUpdateArray.Length While iElement iElement-=1 AddLevelledListToLevelledList(LevelledListToUpdateArray[iElement],ItemToAddArray[iElement],MinimumLevelArray[iElement],1) EndWhile EndEvent Replace the <ScriptName> with the name of your script and <ItemType> with the type of Form your script is adding to a LevelledItem, respectively. (For the names of Forms, check the link TestTiger2 shared: https://www.creationkit.com/index.php?title=Category:Script_Objects .)After doing this, you should be able to save and compile without error. 6. Double-click the script to edit its properties; the LevelledListToUpdateArray property is an array of levelled lists to update. The ItemToAddArray property is an array of the Form you want to add to the levelled list at the same array index. The MinimumLevelArray property is an array of Integers representing the minimum level the player must be for the Form at the same index to appear in the levelled list at the same index. For example, if you want to add custom spell tomes SpellTomeCust1 and SpellTomeCust2 to LItemSpellTomes25AllConjuration, and SpellTomeCust3 to LItemSpellTomes50AllConjuration, ignoring player level, then:The above code's <ItemType> should be replaced with BookLevelledListToUpdateArray should contain LItemSpellTomes25AllConjuration, LItemSpellTomes25AllConjuration and LItemSpellTomes50AllConjuration in that orderItemToAddArray should contain SpellTomeCust1, SpellTomeCust2 and SpellTomeCust3 in that orderMinimumLevelArray should contain 1, 1 and 1It's important that all the arrays have the same number of records (or at least, that the LevelledListToUpdateArray has no more elements than the other two arrays). 7. Ok this and save. The script should then run on startup and populate the levelled lists specified with the forms specified. If you want to make sure the script runs, you can include a Debug.MessageBox("Hello") in the Event OnInit part of the script (although make sure you remove this before publishing). 8. Repeat steps 3-6 for each different type of Form you want to add to a LeveledItem. When you're happy with your script(s), go to File -> Create Archive to collate your scripts into a .bsa file which can be distributed with your esp. Thanks again for everyone's help with this. please let me know if these instructions are incorrect, insufficient, misleading etc. or if there's a more suitable place to post them. Link to comment Share on other sites More sharing options...
foamyesque Posted November 20, 2018 Share Posted November 20, 2018 For the record, since LeveledItems will accept LeveledItems, you can just insert one of those and have your script then be functionally type-agnostic. Alternatively you can place the things to add into a FormList and iterate through them. Link to comment Share on other sites More sharing options...
NationalSpearmint Posted November 20, 2018 Author Share Posted November 20, 2018 Yeah, I was considering that, but that would mean I'd have an additional LeveledItem for each LeveledItem I want to insert into (in my scenario, I only needed one item to be inserted into each LeveledItem - if I needed more items inserted this probably would've been the better option). If I have several scripts I don't have any requirement for storing that additional data. Link to comment Share on other sites More sharing options...
Recommended Posts