Jump to content

Formlist to enable/disable doors


Recommended Posts

Hello Modder Community,

 

I am attempting a Formlist to mass enable/disable a group of doors.

However, when I fire this spell, my debug iIndex returns 0 instead of the expected value of 11 . I have included an image of the Formlist below the code block.

 

So, what am I missing?

Scriptname dw01_MLB_ToggleAllDoorsTo extends activemagiceffect
{Toggle Enable/Disable all the doors to (out of My Basement)}

;||||| Ref Attempt
FormList Property dw01_MLB_DoorToList Auto;

Event OnEffectStart(Actor akTarget, Actor akCaster)
    ;|||||||||||||||||||||||||||||||||||||||||||||||||
    ;Toggle them all!
    ;|||||||||||||||||||||||||||||||||||||||||||||||||
    MyRefAttempt()
    
endEvent

Function MyRefAttempt()
    Debug.Notification("Hello") ;<<<<< This works, and makes me smile
    Int iIndex = dw01_MLB_DoorToList.GetSize()
    Debug.Notification("iIndex=" + iIndex) ;<<<<< This is returning 0, and gives me a frown
    While iIndex
        iIndex -= 1
        ObjectReference kReference = dw01_MLB_DoorToList.GetAt(iIndex) As ObjectReference
        If kReference.IsEnabled()
            kReference.Disable()
        Else ;
            kReference.Enable()
        EndIf
    EndWhile
EndFunction

 

Edited by tamtastic
Link to comment
Share on other sites

Your added picture looks right, because of property set by CK. https://www.creationkit.com/index.php?title=Bethesda_Tutorial_Papyrus_Introduction_to_Properties_and_Functions

 

Did you fill the formlist property?

Yes.

 

Why it is not working?

Sometimes its possible, if you changed the amount of properties for a script, the last property left is not well recognized.

What to do? Remove all properties and add the required properties again. Save your progress.

Link to comment
Share on other sites

Thank you ReDragon2013. It is working now. :cool:

 

I emptied the FormList and refilled it, and no difference. But then I closed the creation kit, reopened, and noticed the FormList did not exist. Huh? :huh: I must have saved this 10's of times.

 

So I recreated the list and saved it immediately. I then added the items, and saved it again. Now it works.

 

Thank you!

Edited by tamtastic
Link to comment
Share on other sites

  • Recently Browsing   0 members

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