Editing
Complete Example Scripts
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Cycle Through a List of Objects and Perform an Action on Each Object(Linked Ref Chain) = 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. <syntaxhighlight lang="papyrus">ScriptName LinkRefChainExample Extends ObjectReference Actor Property PlayerREF Auto ; Most efficient way to refer to the player Event OnActivate(ObjectReference akActionRef) if akActionRef == PlayerREF PerformActionOn(Self) ObjectReference TempRef = GetLinkedRef() while (TempRef && TempRef != Self) PerformActionOn(TempRef) TempRef = TempRef.GetLinkedRef() endwhile endif EndEvent Function PerformActionOn(ObjectReference Target) Target.MoveTo(Target, 0, 0, 16) EndFunction</syntaxhighlight> '''To Make This Script Work''' * This script runs off an OnActivate event, so you must be able to activate the object this script is attached to. ** You can change the OnActivate to whatever you wish to fire off the action. * You need to create a linked ref chain. ** If you don't know how to create a linked ref to another object, read [[Bethesda_Tutorial_Encounters#Default_Master_Package_and_Linked-Refs|this]]. ** A linked ref chain is basically an object that has a linked ref, which has its own linked ref, which also has its own linked ref, etc. * Remember to attach this script to the first object in the linked ref chain ** If your linked ref chain links back to itself, then you could put this script on each of the objects
Summary:
Please note that all contributions to the CreationKit Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see
CreationKit:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Landing page
Tutorials
Game Systems
Editor Reference
Scripting Reference
Recent changes
Help
Tools
What links here
Related changes
Special pages
Page information
Page values