Open main menu
Home
Random
Log in
Settings
About the CreationKit Wiki
Disclaimers
the CreationKit Wiki
Search
Editing
Complete Example Scripts
(section)
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!
=A Trigger That Detects When The Player Enters= <syntaxhighlight lang="papyrus"> ScriptName ExampleTrigger Extends ObjectReference Actor Property PlayerREF Auto ; Least 'costly' way to refer to the player Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerREF ; This condition ensures that only the player will trigger this code Debug.MessageBox("Yippee!") EndIf EndEvent </syntaxhighlight> '''To Make This Script Work''' Select an existing object in your cell Click on the Trigger Volume button, the box with a T inside of it. * A orange box should appear around the object you selected. * Now edit the new orange box you created and add the script above. * Then go in-game and walk into the space where this invisible box is. '''Uses:''' * Create events that depend on player positioning * You could eliminate the player if statement above and have other actors like draugr or companions activate things as well * Non-player triggers can be used by changing the == to a != in the script above, to do things to other actors like restoring their health or moving them around (but not affecting player if player walks through the trigger)
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)