Complete Example Scripts: Difference between revisions

Jump to navigation Jump to search
m
→‎Move an Object to a Specific Location Without Fade: Condensed+Removed extraneous parentheticals
imported>JustinOther
imported>JustinOther
m (→‎Move an Object to a Specific Location Without Fade: Condensed+Removed extraneous parentheticals)
Line 196: Line 196:
=Move an Object to a Specific Location Without Fade=
=Move an Object to a Specific Location Without Fade=


You can use this script to make an activator or actor move without fading out in any way (moveTo and setPosition cause fading to occur).  
You can use this script to make an activator or actor move without fading out in any way (moveTo and setPosition cause fading to occur). Use this to make objects fly around or make the player move continuously to a destination without fade.
 
Use this to make objects fly around or make the player move continuously to a destination without fade.
 


''This example moves the player, for your entertainment.''
''This example moves the player, for your entertainment.''
* To move something other than player, add a property of type ObjectReference and set it to the actor or activator that you want to move (I have not succeeded in moving statics, only activators and actors)
* To move something other than player, add a property of type ObjectReference and set it to the actor or activator that you want to move (I have not succeeded in moving statics, only activators and actors)
* Use different Events freely, this event is used for simplicity and easy demonstration.
* Use different Events freely, this event is used for simplicity and easy demonstration.
 
<source lang="papyrus">ScriptName MoveObjExample extends ObjectReference   
 
<source lang="papyrus">
ScriptName MoveObjExample extends ObjectReference   


ObjectReference property dest auto
ObjectReference property dest auto


Event OnTriggerEnter(ObjectReference akActionRef)
Event OnTriggerEnter(ObjectReference akActionRef)
 
if akActionRef == Game.GetPlayer()
if (akActionRef == Game.GetPlayer())
akActionRef.TranslateToRef(dest,500) ; 500 is the speed value, it's pretty fast
akActionRef.TranslateToRef(dest,500)  
                ;500 is the speed value, it's pretty fast
endif
endif
 
EndEvent </source>
EndEvent  
</source>


'''To Make This Script Work'''
'''To Make This Script Work'''
* Make an XMarkerHeading object (search *All with "xmarker" filter), place it where you want the player to be moved to.
* Make an XMarkerHeading object (search *All with "xmarker" filter), place it where you want the player to be moved to.
* Click on an object in your cell and select the Trigger Volume button, the T with a box around it
* Click on an object in your cell and select the Trigger Volume button, the T with a box around it
* Move the orange box to where you want the player to start their controlled movement to the XMarkerHeading destination.
* Move the orange box to where you want the player to start their controlled movement to the XMarkerHeading destination.
* Add this script above to the orange box/trigger volume that you created.
* Add this script above to the orange box/trigger volume that you created.
* SET THE PROPERTY of the script instance, dest, to be your XMarkerHeading that you just made.
* SET THE PROPERTY of the script instance, dest, to be your XMarkerHeading that you just made.
 
This example will not work if you do not set the property as I mention just above, this is an easy thing to forget in this new and wonderful language. Get used to these basics and you will find Papyrus much more powerful than prior scripting languages.
 
This example will not work if you do not set the property as I mention just above, this is an easy thing to forget in this new and wonderful language.
 
Get used to these basics and you will find Papyrus much more powerful than prior scripting languages.


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

Navigation menu