Difference between revisions of "Cast Reference"

637 bytes added ,  17:10, 29 December 2016
m
Fixed misspelled "papyrus" to prevent script code parse fail
imported>Plplecuyer
 
imported>00HOTSPOTSHIELD
m (Fixed misspelled "papyrus" to prevent script code parse fail)
 
(3 intermediate revisions by one other user not shown)
Line 137: Line 137:
; x gets the child object if it is one, otherwise None
; x gets the child object if it is one, otherwise None
x = ParentVariable as ChildObject
x = ParentVariable as ChildObject
</source>
<br>
<source lang="papyrus">
; If the alias is an actual actor, you can cast the alias to actor to with functions like [[StartCombat()]]. (Functions that expect actors to be called on them.)
MyAlias.GetReference() as Actor
</source>
<br>
<source lang="papyrus">
; When needing to cast a Quest to its quest script, first make a property.
Quest property MyQuest auto
; Then use this line:
MyQuest as MyQuestScript
</source>
<br>
<source lang="papyrus">
; Same can be done with GetOwningQuest() for objects directly attached to the Quest.
GetOwningQuest() as MyQuestScript
; When calling them, they must be placed in parenthesis.
</source>
</source>