Difference between revisions of "OnPlayerLoadGame - Actor"

Jump to navigation Jump to search
972 bytes added ,  07:43, 22 June 2012
→‎Examples: Added second example
imported>JLundin
imported>JustinOther
(→‎Examples: Added second example)
Line 15: Line 15:


== Examples ==
== Examples ==
*Syntax
<source lang="papyrus">
<source lang="papyrus">
; Event is only sent to the player actor. This would probably be on a magic effect or alias script
; Event is only sent to the player actor. This would probably be on a magic effect or alias script
Line 20: Line 21:
   Debug.Trace("player loaded a save, do some fancy stuff")
   Debug.Trace("player loaded a save, do some fancy stuff")
endEvent
endEvent
</source>
*Say you need something to happen every time a save is loaded ''including'' the first and you're using a ReferenceAlias filled with the Player. In the below example, we maintain a variable such that it will invariably reflect the version loaded. Use an OnInit event in the quest's script to catch the first save load...
<source lang="papyrus">ScriptName YourQuestScript extends Quest
Float fVersion
Event OnInit()
Maintenance()
EndEvent
Function Maintenance()
If fVersion < 1.23 ; Current version
If fVersion
Debug.Trace("Updating from version " + fVersion)
Else
Debug.Trace("Initializing for the first time")
EndIf
fVersion = 1.23
EndIf
EndFunction</source>
...and your player alias' OnPlayerLoadGame event to catch each consecutive save load...
<source lang="papyrus">ScriptName YourPlayerAliasScript extends ReferenceAlias
YourQuestScript Property QuestScript Auto
Event OnPlayerLoadGame()
QuestScript.Maintenance()
EndEvent
</source>
</source>


Anonymous user

Navigation menu