Difference between revisions of "OnPlayerLoadGame - Actor"
m
Page format mishap.
imported>JustinOther (→Examples: 'Once per save load' simplified via "Run Once") |
imported>JustinOther m (Page format mishap.) |
||
Line 15: | Line 15: | ||
== Examples == | == Examples == | ||
*Normal use | |||
<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 22: | Line 22: | ||
endEvent | endEvent | ||
</source> | </source> | ||
*Do something exactly once per save load | |||
Say you need something to happen '''exactly''' once every time a save is loaded ''including'' the first and you're using a ReferenceAlias filled with the Player. In the below example with a quest flagged as "Start Game Enabled" and set to "Run Once" from within its [[Quest Data Tab]], we maintain a Float Property (valueless in editor) such that it will invariably reflect the version loaded. | Say you need something to happen '''exactly''' once every time a save is loaded ''including'' the first and you're using a ReferenceAlias filled with the Player. In the below example with a quest flagged as "Start Game Enabled" and set to "Run Once" from within its [[Quest Data Tab]], we maintain a Float Property (valueless in editor) 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 | <source lang="papyrus">ScriptName YourQuestScript extends Quest | ||
Line 43: | Line 42: | ||
EndIf | EndIf | ||
EndFunction</source> | EndFunction</source> | ||
...and use your player alias' OnPlayerLoadGame event to catch each consecutive save load. | |||
<source lang="papyrus">ScriptName YourPlayerAliasScript extends ReferenceAlias | <source lang="papyrus">ScriptName YourPlayerAliasScript extends ReferenceAlias | ||