Difference between revisions of "OnPlayerLoadGame - Actor"
m
no edit summary
imported>Plplecuyer (Created page with "Category:Scripting Category:Papyrus Category:Events '''Member of:''' Actor Script Event called when the player loads a save game. This event is '''only''' sent t...") |
imported>Qazaaq m |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
'''Member of:''' [[Actor Script]] | '''Member of:''' [[Actor Script]] | ||
Line 12: | Line 9: | ||
== Parameters == | == Parameters == | ||
None | None | ||
== Examples == | == Examples == | ||
The player is unique in that it is almost always bad practice to modify the [[Actor]] form directly. | |||
This is due to compatibily reasons concerning ''The Rule of One''. | |||
There are several techniques to avoid violating this rule. | |||
=== Example === | |||
This example is straight forward but violates ''The Rule of One'' because it requires the player [[Actor]] to be modified. | |||
<source lang="papyrus"> | |||
Scriptname Example extends Actor | |||
Event OnPlayerLoadGame() | |||
Debug.TraceSelf(self, "OnPlayerLoadGame", "The player actor has reloaded the game.") | |||
EndEvent | |||
</source> | |||
=== Alternative === | |||
A [[ReferenceAlias Script|ReferenceAlias]] or [[ActiveMagicEffect Script|ActiveMagicEffect]] will receive events from the [[Actor]] they are attached to. | |||
'''A quest alias pointed at the player''' | |||
<source lang="papyrus"> | <source lang="papyrus"> | ||
Scriptname Example extends ReferenceAlias | |||
Event OnPlayerLoadGame() | Event OnPlayerLoadGame() | ||
Debug.TraceSelf(self, "OnPlayerLoadGame", "The player actor has reloaded the game.") | |||
EndEvent | |||
</source> | </source> | ||
'''A magic effect on the player''' | |||
<source lang="papyrus"> | |||
Scriptname Example extends ActiveMagicEffect | |||
Event OnPlayerLoadGame() | |||
Debug.TraceSelf(self, "OnPlayerLoadGame", "The player actor has reloaded the game.") | |||
EndEvent | |||
</source> | |||
=== Remoting === | |||
With [[Remote Papyrus Event Registration]], this event may also be handled from ''any'' script object. | |||
<source lang="papyrus"> | |||
Scriptname Example extends ScriptObject | |||
Event OnInit() | |||
RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame") | |||
Debug.TraceSelf(self, "Actor.OnPlayerLoadGame", "This script has initialized and is now listening for the 'OnPlayerLoadGame' event.") | |||
EndEvent | |||
Event Actor.OnPlayerLoadGame(Actor akSender) | |||
Debug.TraceSelf(self, "Actor.OnPlayerLoadGame", "The player actor has reloaded.") | |||
EndEvent | |||
</source> | |||
== Notes == | == Notes == | ||
This event | *This event will fire for the '''first time''' on the next load. See also ''OnInit''. | ||
== See Also == | == See Also == | ||
*[[Actor Script]] | *[[Actor]] | ||
*[[OnInit - ScriptObject]] | |||
*[[ReferenceAlias Script]] | |||
*[[ActiveMagicEffect Script]] | |||
*[[Remote Papyrus Event Registration]] | |||
[[Category:Scripting]] | |||
[[Category:Papyrus]] | |||
[[Category:Events]] |