Complete Example Scripts: Difference between revisions

Jump to navigation Jump to search
m
imported>JustinOther
imported>JustinOther
m (→‎Cycle Through a List of Objects and Perform an Action on Each Object(Linked Ref Chain): GetPlayer swapped with PlayerREF property for consistency)
Line 171: Line 171:
This script will cycle through all the references in a linked ref chain and perform an action on each of them.  In this example, the action would be to move each reference up by 16 units when you activate any one of them.  Basically, it's the same thing as the FormList version, except you create a linked ref chain instead of a FormList.
This script will cycle through all the references in a linked ref chain and perform an action on each of them.  In this example, the action would be to move each reference up by 16 units when you activate any one of them.  Basically, it's the same thing as the FormList version, except you create a linked ref chain instead of a FormList.


<source lang="papyrus">Scriptname LinkRefChainExample extends ObjectReference
<source lang="papyrus">ScriptName LinkRefChainExample Extends ObjectReference
 
Actor Property PlayerREF Auto ; Most efficient way to refer to the player


Event OnActivate(ObjectReference akActionRef)
Event OnActivate(ObjectReference akActionRef)
if (akActionRef == Game.GetPlayer())
if akActionRef == PlayerREF
PerformActionOn(Self)
PerformActionOn(Self)
ObjectReference TempRef = GetLinkedRef()
ObjectReference TempRef = GetLinkedRef()
Anonymous user

Navigation menu