Complete Example Scripts: Difference between revisions
Jump to navigation
Jump to search
m
→Cycle Through a List of Objects and Perform an Action on Each Object(FormLists): Got rid of extraneous var/loop/akReference = ListOfObjectsFLST.GetAt(0) As ObjectReference
imported>JustinOther m (→Cycle Through a List of Objects and Perform an Action on Each Object(FormLists): Condensed to prevent carpel tunnel/standardized capitalization for legibility) |
imported>JustinOther m (→Cycle Through a List of Objects and Perform an Action on Each Object(FormLists): Got rid of extraneous var/loop/akReference = ListOfObjectsFLST.GetAt(0) As ObjectReference) |
||
| Line 128: | Line 128: | ||
<source lang="papyrus">ScriptName RamaFormListExampleScript extends ObjectReference | <source lang="papyrus">ScriptName RamaFormListExampleScript extends ObjectReference | ||
Int | Int iIndex | ||
ObjectReference akReference | |||
FormList Property ListOfObjectsFLST Auto ; see notes after script for more info on this property | FormList Property ListOfObjectsFLST Auto ; see notes after script for more info on this property | ||
Event | Event OnTriggerEnter(ObjectReference akActionRef) | ||
If akActionRef == Game.GetPlayer()) | If akActionRef == Game.GetPlayer()) | ||
akReference = ListOfObjectsFLST.GetAt( | iIndex = ListOfObjectsFLST.GetSize() ; Indices are offset by 1 relative to size | ||
While(iIndex > 0) | |||
iIndex -= 1 | |||
akReference = ListOfObjectsFLST.GetAt(iIndex) as ObjectReference ; Note that you must typecast the entry from the formlist using 'As'. I use ObjectReference so that IsEnabled() becomes accessible. Use Actor if you want to perform actor functions and the formlist contains actors. | |||
If akReference.IsEnabled() | |||
akReference.Disable() | |||
Else ; If akReference.IsDisabled() | |||
akReference.Enable() | |||
EndIf | |||
EndWhile | EndWhile | ||
EndIf | EndIf | ||