Complete Example Scripts: Difference between revisions

Jump to navigation Jump to search
→‎A Trigger To Activate When Player Walks Through It: Updated capitalisation and parameter names to make the more in line with documentation
imported>Cipscis
(Tried to make the first section a bit clearer, and added titles to the section containing actual examples)
imported>Cipscis
(→‎A Trigger To Activate When Player Walks Through It: Updated capitalisation and parameter names to make the more in line with documentation)
Line 17: Line 17:




===A Trigger To Activate When Player Walks Through It===
===A Trigger That Detects When The Player Enters===
<source lang="papyrus">
<source lang="papyrus">
Scriptname ExampleTrigger extends ObjectReference
Scriptname ExampleTrigger extends ObjectReference


Event onTriggerEnter(ObjectReference ObjRef)  
Event OnTriggerEnter(ObjectReference akActionRef)
 
if(akActionRef == Game.GetPlayer()) ; This condition ensures that only the player will trigger this code
        ;remove this if statement if you want
        ;other objects to activate the trigger
        ;also
if(ObjRef == game.getplayer())
Debug.MessageBox("Yippee!")
Debug.MessageBox("Yippee!")
endif
endif
 
EndEvent
endEvent


</source>
</source>
Line 58: Line 53:


* 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)
* 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)


===A Fully Functional Dwemer Button===
===A Fully Functional Dwemer Button===
Anonymous user

Navigation menu