Difference between revisions of "OnPlayerLoadGame - Actor"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
(added additional syntax and edited example from HC_ManagerScript - original text written prior to Survival Mode implementation?)
imported>Scrivener07
(→‎Notes: wont fire for the first time on the first load.)
Line 42: Line 42:
*This event is only sent to the player actor. It is recommended that you handle this event via an alias the player is forced into, or a magic effect on the player.
*This event is only sent to the player actor. It is recommended that you handle this event via an alias the player is forced into, or a magic effect on the player.
*After Patch 1.5, event is also handled via quest.
*After Patch 1.5, event is also handled via quest.
*This event will fire for the '''first time''' on the next load.


== See Also ==
== See Also ==
*[[Actor Script]]
*[[Actor Script]]

Revision as of 15:23, 1 December 2018

Member of: Actor Script

Event called when the player loads a save game. This event is only sent to the player actor.

Syntax

Event OnPlayerLoadGame()

After Patch 1.5:

Event Actor.OnPlayerLoadGame(actor aSender)

Parameters

  • aSender: The actor sending the event.

Examples

; Event is only sent to the player actor. This would probably be on a magic effect or alias script
Event OnPlayerLoadGame()
  Debug.Trace("player loaded a save, do some fancy stuff")
endEvent

After Patch 1.5:

;This event is on a quest (like HC_ManagerScript)
Event Actor.OnPlayerLoadGame(actor aSender)
  Debug.Trace("player loaded a save, do some fancy stuff")
	if false == Game.GetPlayer().HasPerk(myCoolPerk) ; Let's check to see if the player has the cool new perk.
		Game.GetPlayer().AddPerk(myCoolPerk) ; If they don't, then add it.
		Debug.Trace("Player now has" +myCoolPerk)
	endif
endEvent

Notes

  • This event is only sent to the player actor. It is recommended that you handle this event via an alias the player is forced into, or a magic effect on the player.
  • After Patch 1.5, event is also handled via quest.
  • This event will fire for the first time on the next load.

See Also