Jump to content

[LE] Adding Items to Levelled Lists


Recommended Posts

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/4

Says 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-20

However, 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

Looks like a simple compilation error perhaps

You 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/lists

To define, dont forget:

 

LeveledItem Property LItemSpellTomes00AllConjuration Auto

And also

Weapon Property StaffNatSprRaiseDead Auto

Edited by Myst42
Link to comment
Share on other sites

off the top of my head:

 

Do you have LItemSpellTomes00AllConjuration and StaffNatSprRaiseDead
setup 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 auto

ObjectReference Property MYSTAFF Auto

 

Then fill them from the Creation Kit with LItemSpellTomes00AllConjuration and StaffNatSprRaiseDead.

Link to comment
Share on other sites

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 auto
ObjectReference Property MYSTAFF Auto
MYLIST.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 Auto
Weapon Property StaffNatSprRaiseDead Auto
LItemSpellTomes00AllConjuration.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

Why is this:

 

LeveledItem Property LItemSpellTomes00AllConjuration Auto
Weapon Property StaffNatSprRaiseDead Auto
still in the script at all ,,,

 

The part you added:

 

Formlist Property MYLIST auto
ObjectReference Property MYSTAFF Auto
is them - once you add:
LItemSpellTomes00AllConjuration and StaffNatSprRaiseDead
to them from the creation kit.
The part:
Formlist Property MYLIST auto
ObjectReference 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

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

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 up

in 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 up

through the Creation Kit after.

 

like this:

 

Formlist Property LItemSpellTomes00AllConjuration Auto
ObjectReference 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 Hidden
ObjectReference 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 by NexusComa
Link to comment
Share on other sites

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 functions

One 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 what

Sorry, 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 bugged

After 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 should

So 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 by Myst42
Link to comment
Share on other sites

Yes I was wondering about that with ... ObjectReference Property StaffNatSprRaiseDead Auto

We 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

  • Recently Browsing   0 members

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