Difference between revisions of "PushActorAway - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Rhavlovick
m (1 revision: Clobber re-import by Henning)
 
(→‎Notes: Add a note about weird behavior you can trigger combining PushActorAway with played idles such as kill moves.)
 
(5 intermediate revisions by 4 users not shown)
Line 20: Line 20:
<source lang="papyrus">
<source lang="papyrus">
ExplosionMarker.PushActorAway(Bill, 10.0)
ExplosionMarker.PushActorAway(Bill, 10.0)
</source>
== Notes ==
* Use an XMarkerHeading object to control the exact direction in which the actor will be pushed.
* The force argument can be negative to pull actors toward your ObjectReference. (Before you ask, yes, someone beat you to it and made a Katamari mod out of this.)
* The push is applied via an explosion, and as such is affected by the fMagicExplosion* game settings.
* Running PushActorAway on the target of an idle animation started with a function such as [[PlayIdleWithTarget - Actor|PlayIdleWithTarget]] can cause unusual behavior. For example, after targeting an actor with a kill move, the actor may stand back up, wait a few moments, and then collapse again.
* Running PushActorAway on newly spawned Actor can lead to a crash to desktop. To prevent this, check that the 3D is loaded on the Actor with [[Is3DLoaded - ObjectReference|MyActor.Is3DLoaded()]] before doing PushActorAway.
<source lang="papyrus">
ObjectReference MyActor = XmarkerkRef.PlaceAtMe(MyActorBase)
If (MyActor.Is3DLoaded())
    XmarkerRef.PushActorAway(MyActor as Actor, 50.0)
EndIf
</source>
</source>


== See Also ==
== See Also ==
*[[ObjectReference Script]]
*[[ObjectReference Script]]

Latest revision as of 18:29, 26 November 2023

Member of: ObjectReference Script

Knocks back the specified actor away from this object with the specified amount of force, as if an explosion had gone off.

Syntax[edit | edit source]

Function PushActorAway(Actor akActorToPush, float afKnockbackForce) native

Parameters[edit | edit source]

  • akActorToPush: The actor to push away.
  • afKnockbackForce: The amount of force to apply to the target actor.

Return Value[edit | edit source]

None.

Examples[edit | edit source]

ExplosionMarker.PushActorAway(Bill, 10.0)

Notes[edit | edit source]

  • Use an XMarkerHeading object to control the exact direction in which the actor will be pushed.
  • The force argument can be negative to pull actors toward your ObjectReference. (Before you ask, yes, someone beat you to it and made a Katamari mod out of this.)
  • The push is applied via an explosion, and as such is affected by the fMagicExplosion* game settings.
  • Running PushActorAway on the target of an idle animation started with a function such as PlayIdleWithTarget can cause unusual behavior. For example, after targeting an actor with a kill move, the actor may stand back up, wait a few moments, and then collapse again.
  • Running PushActorAway on newly spawned Actor can lead to a crash to desktop. To prevent this, check that the 3D is loaded on the Actor with MyActor.Is3DLoaded() before doing PushActorAway.
ObjectReference MyActor = XmarkerkRef.PlaceAtMe(MyActorBase)
If (MyActor.Is3DLoaded())
    XmarkerRef.PushActorAway(MyActor as Actor, 50.0)
EndIf

See Also[edit | edit source]