Difference between revisions of "OnPackageEnd - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Terra Nova2
m (Changed wording in the notes section for clarification.)
(This page previously indicated that the package "stopped running" when this event is fired. That is not the case. This event just means the completion conditions have been met, but that does not stop the actor from running the package.)
 
Line 12: Line 12:


== Parameters ==
== Parameters ==
*akOldPackage: The [[Package Script|Package]] that just stopped running.
*akOldPackage: The [[Package Script|Package]] that just completed.


== Examples ==
== Examples ==
<source lang="papyrus">
<source lang="papyrus">
Event OnPackageEnd(Package akOldPackage)
Event OnPackageEnd(Package akOldPackage)
   Debug.Trace("We just stopped running the " + akOldPackage + " package")
   Debug.Trace("We just completed the " + akOldPackage + " package")
endEvent
endEvent
</source>
</source>
Line 23: Line 23:


== Notes ==
== Notes ==
* This event only occurs for packages that have completion conditions, and it '''does not''' mean the actor is no longer running the package. For example, an actor running a package based on the <code>Travel</code> template will receive this event upon reaching the package's destination, but the actor will continue running the package for as long as it is the highest priority package whose conditions are met. To find out when an actor is no longer running the package, use [[OnPackageChange - Actor|OnPackageChange]].
*This can be used in a ReferenceAlias script attached to the player that is currently controlled via [[SetPlayerAIDriven_-_Game|SetPlayerAIDriven]], and has finished a package.
*This can be used in a ReferenceAlias script attached to the player that is currently controlled via [[SetPlayerAIDriven_-_Game|SetPlayerAIDriven]], and has finished a package.



Latest revision as of 15:07, 22 November 2023

Member of: Actor Script

Event called when the actor finishes a package.

Syntax[edit | edit source]

Event OnPackageEnd(Package akOldPackage)

Parameters[edit | edit source]

  • akOldPackage: The Package that just completed.

Examples[edit | edit source]

Event OnPackageEnd(Package akOldPackage)
  Debug.Trace("We just completed the " + akOldPackage + " package")
endEvent


Notes[edit | edit source]

  • This event only occurs for packages that have completion conditions, and it does not mean the actor is no longer running the package. For example, an actor running a package based on the Travel template will receive this event upon reaching the package's destination, but the actor will continue running the package for as long as it is the highest priority package whose conditions are met. To find out when an actor is no longer running the package, use OnPackageChange.
  • This can be used in a ReferenceAlias script attached to the player that is currently controlled via SetPlayerAIDriven, and has finished a package.

See Also[edit | edit source]