GetPlayer - Game

From the CreationKit Wiki
Revision as of 12:33, 14 January 2013 by imported>Kahmul (→‎Notes)
Jump to navigation Jump to search

Member of: Game Script

Obtains the actor representing the player.

Syntax

Actor Function GetPlayer() native global

Parameters

None

Return Value

The Actor that represents the player.

Examples

; Print out the player to the log
Debug.Trace("Player is " + Game.GetPlayer())

Notes

Only use this function if you need it once in a script. Otherwise use a property with the player reference as the value, it literally is 1000 times faster. Use this instead:

Actor Property playerRef auto
Debug.Trace("Player is " + playerRef)

If you name the property "playerRef" you can just auto-fill it and the player reference will automatically be assigned.

(Example source [1])

See Also