Jump to content

[LE] Cannot add form to form list with formList.addform(form)


corrado33

Recommended Posts

I don't understand....

Scriptname chestActivatorScript extends ObjectReference  
FormList Property kTestFormList Auto

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
	kTestFormList.AddForm(akBaseItem)
	debug.notification("FormListLength: " + kTestFormList.GetSize())
endevent

The addform page says that addform accepts a form, and akBaseItem is a form...

 

However, even IF I populate the form list in CK and just run the 2nd line (displaying the length of the form list) it still doesn't work. Even IF I use a form list that exists in the game (say, "rubies") the "GetSize()" still doesn't work.

 

I have to be doing something wrong.

 

EDIT: Turns out you actually have to... you know... pick the property in the... properties dialog...I'm an idiot.

Edited by corrado33
Link to comment
Share on other sites

https://www.creationkit.com/index.php?title=AddForm_-_FormList

"A created reference does not become persistent by virtue of being added to a FormList.

If you try to retrieve the reference from the FormList when it is not loaded and not persistent, you will get an incorrect result or no result."

 

This should explain your issue.

 

 

About the next, maybe it works for you.

Scriptname chestActivatorScript extends ObjectReference  
; https://forums.nexusmods.com/index.php?/topic/6993011-cannot-add-form-to-form-list-with-formlistaddformform/
; corrado33 wrote:

    FormList PROPERTY kTestFormList auto Hidden        ; empty formlist, do not prefill by CK

; -- EVENT --

EVENT OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
    kTestFormList.AddForm(akBaseItem)
    Utility.Wait(0.25)                                ; wait a bit here, mabye it works

    int i = kTestFormList.GetSize()
    Debug.Notification("FormLL is " +i)
ENDEVENT
Link to comment
Share on other sites

ReDragon: Not relevant in this case, since corrado said they were working with base forms and not references at all, and even if it were a created reference I do not believe that being loaded or not would impact GetSize(), though it may impact anything you tried to do if you tried to manipulate that particular form. It's entirely unnecessary to call a Wait() after AddForm(), since AddForm() will fully complete and update the formlist before allowing the next script instruction to proceed.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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