NationalSpearmint Posted November 18, 2018 Share Posted November 18, 2018 Hi all,Are there any detailed, up-to-date tutorials on how to add items to a levelled list (ideally for people who are unfamiliar with Papyrus scripting)? Based on resources I've found online, you first need to create a quest which runs automatically - the quest then runs a script which adds the item to the levelled list, and then deletes itself. However, what I'm struggling with is - what's the script to add the items? This post:https://bethesda.net/community/topic/53041/how-do-i-add-items-to-merchants/4Says to use the function AddForm in the Papyrus Fragment of the quest stage, in the format LEVELEDITEMLIST.AddForm(ITEMNAME, #, #) . However, when enter my code fragment:LItemSpellTomes00AllConjuration.AddForm(StaffNatSprRaiseDead,1,1)Papyrus fails to compile, as "variable LItemSpellTomes00AllConjuration is undefined", "variable StaffNatSprRaiseDead is undefined", and "none is not a known user-defined type". Obviously LItemSpellTomes00AllConjuration should be defined, since it's one of Skyrim's default levelled lists. Do I need additional Papyrus code to 'import' the levelled lists or something? Another tutorial post I've found is this one:http://bertscktutorial.ucoz.com/index/adding_to_leveled_lists_the_easy_safe_way/0-20However, this refers to a script which was hosted on Nexus, but is no longer available, so that doesn't help either. Thanks Link to comment Share on other sites More sharing options...
Myst42 Posted November 19, 2018 Share Posted November 19, 2018 (edited) Looks like a simple compilation error perhapsYou need to define the property on the script and later, use the compiled script on a quest or something, and point the property from the CK to the proper items/listsTo define, dont forget: LeveledItem Property LItemSpellTomes00AllConjuration AutoAnd alsoWeapon Property StaffNatSprRaiseDead Auto Edited November 19, 2018 by Myst42 Link to comment Share on other sites More sharing options...
NexusComa Posted November 19, 2018 Share Posted November 19, 2018 off the top of my head: Do you have LItemSpellTomes00AllConjuration and StaffNatSprRaiseDeadsetup as variables on the top of your script and filled with the correct values from the Creation Kit (the list and the staff) ...You can't just call a list name or a weapon name mid script and Skyrim just pick it up. It must be defined as a list and a object then pointed at the correct one. Formlist Property MYLIST autoObjectReference Property MYSTAFF Auto Then fill them from the Creation Kit with LItemSpellTomes00AllConjuration and StaffNatSprRaiseDead. Link to comment Share on other sites More sharing options...
NexusComa Posted November 19, 2018 Share Posted November 19, 2018 lol, we must have been typing the same answer at the same time ... Link to comment Share on other sites More sharing options...
NationalSpearmint Posted November 19, 2018 Author Share Posted November 19, 2018 Thanks both. Please could you clarify, what would the expected Papyrus fragment be? I'm getting "no viable alternative at input 'Property'" and "no viable alternative at input '.'" errors.I've tried:"Formlist Property MYLIST autoObjectReference Property MYSTAFF AutoMYLIST.AddForm(MYSTAFF,1,1)" (assuming this should let you pass through values for MYLIST and MYSTAFF to the script as variables, or 'properties'?)and"LeveledItem Property LItemSpellTomes00AllConjuration AutoWeapon Property StaffNatSprRaiseDead AutoLItemSpellTomes00AllConjuration.AddForm(StaffNatSprRaiseDead,1,1)"Both return the no viable alternative at input errors.I'm entering this in the "Papyrus Fragment" box under Quest Stages for my quest. Is that right? Link to comment Share on other sites More sharing options...
NexusComa Posted November 19, 2018 Share Posted November 19, 2018 Why is this: LeveledItem Property LItemSpellTomes00AllConjuration AutoWeapon Property StaffNatSprRaiseDead Auto still in the script at all ,,, The part you added: Formlist Property MYLIST autoObjectReference Property MYSTAFF Auto is them - once you add: LItemSpellTomes00AllConjuration and StaffNatSprRaiseDeadto them from the creation kit. The part: Formlist Property MYLIST autoObjectReference Property MYSTAFF Auto Is how you set the variables up. but, you still need to fill them with the values.You do that from the Creation Kit in the property of the script ... not in the script itself. Link to comment Share on other sites More sharing options...
foamyesque Posted November 19, 2018 Share Posted November 19, 2018 Unlike older versions of the Papyrus engine, in Skyrim the variable names don't need to be explicitly the same as the forms they're holding. They're linked via the Properties interface. However, adding properties to a fragment is a bit of a hassle. The simplest way in which to do so is to compile and save an empty script with just a single ; (the remark character). This will then turn on the Add Property button in the fragment editor, from which you can add the properties you want. Link to comment Share on other sites More sharing options...
NexusComa Posted November 19, 2018 Share Posted November 19, 2018 (edited) There is an advantage to using the proper name in that when you go to set up the properties on the script from the Creation Kit you can simply press the auto button.But considering the length of some of the object names and the fact I love pretty looking code :smile: ... But I guess doing it that way is a bit more informative. You still have to set them upin the script just as another then in the Creation Kit ... The name you use is then variable you work with in the script. The script has no clue what object it is by any name unless set upthrough the Creation Kit after. like this: Formlist Property LItemSpellTomes00AllConjuration AutoObjectReference Property StaffNatSprRaiseDead Auto Then I would go press auto fill from the script property in the Creation Kit. When you see someone say MYLIST or MYSCRIPT it is generic way of explaining what that variable is. It's ausmed you will use your own names whatever way you wish to do it.Just understand that name is a variable. It is not a direct pointer to that object by any name. You point that variable at the correct object from the properties you set from the script with the Creation Kit. However ... lol ... if you use the proper name like this Formlist Property LItemSpellTomes00AllConjuration Auto HiddenObjectReference Property StaffNatSprRaiseDead Auto Hidden The Creation Kit will pick them up without having to even press auto fill from properties. You see the stock scripts do this a lot.No matter what way you do it, it is still doing the same thing in the end and works the same way. There are advantages to every form. Edited November 19, 2018 by NexusComa Link to comment Share on other sites More sharing options...
Myst42 Posted November 19, 2018 Share Posted November 19, 2018 (edited) Upon defining properties and using functions, you should always check the wiki and see what script does that certain function you want to use belong to, and what kinds of parameters it uses (and what script do parameters belong to as well) I can see this is a bit confusing, but It seems there are at least 2 kinds of AddForm functionsOne belongs to the FormList script, and the other belongs to the LeveledList script So you want to be real sure of what exactly you're adding to whatSorry, my bad to suggest Weapon at first place, upon checking the page I realized the property type was incorrect. This one compiles just fine. Scriptname AddFormScript Extends Quest ; This must extend the script type you want it to be, if it's on a spell, you use ActiveMagicEffect, if the trigger is on a world object, you probably should use ObjecReference ; Always check the wiki ; https://www.creationkit.com/index.php?title=LeveledItem_Script ;;== Case 1 =========================;; FormList Property MyList Auto ; Note that "MyList" is defined as a property of FormLIST Script Form Property SomeItem Auto ; According to the wiki for this version of Addform https://www.creationkit.com/index.php?title=AddForm_-_FormList the parameter to add is another form Function AddFormToFormList() MyList.AddForm(SomeItem) ; This will add a form to a form list EndFunction ;;== Case 2 =========================;; Form Property MyForm Auto LeveledItem Property MyLeveledList Auto Function AddFormToLeveledList() MyLeveledList.AddForm(MyForm, 1 ,1) ; In this case, we are adding a form to a leveled item list instead EndFunction ;;==================================;; ;;== Events ========================;; ; Dont forget you always need an event to make things happen Event OnInit() AddFormToFormList() AddFormToLeveledList() EndEvent Also One more thing, I think Form as a script property on the CK may be a bit buggedAfter compiling the script and testing it for drop-down menus on a random quest, found out that the Form property drop down list does not really fill with all the items on the game as it shouldSo I think you could try something like this or alyternatively, use TES5Edit to add the proper weapon in the Form slot of the compiled script on the esp file Scriptname AddFormScript Extends Quest Weapon Property SomeItem Auto LeveledItem Property MyLeveledList Auto Function AddFormToList() MyLeveledList.AddForm(SomeItem as Form, 1 ,1) ; In this case, we read the Weapon item as a Form for the function to work EndFunction ;;==================================;; ;;== Events ========================;; Event OnInit() AddFormToList() EndEvent Edited November 19, 2018 by Myst42 Link to comment Share on other sites More sharing options...
NexusComa Posted November 19, 2018 Share Posted November 19, 2018 Yes I was wondering about that with ... ObjectReference Property StaffNatSprRaiseDead AutoWe ended up talking about how to add variable and how they are preset and loaded.I've never added anything to a forms list on the fly. Created a bunch and read from them.Was planning on waiting for a reply from the post as we seem to be on our own here.Kind of trying to answer him error by error for now ... Link to comment Share on other sites More sharing options...
Recommended Posts