Difference between revisions of "SetAlpha - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>JustinOther
m (→‎Notes: Formatting)
(→‎Notes: Added a note about ForceGreets packages)
 
Line 35: Line 35:


*This function cannot be called on a dead or disabled actor. You will get an error that the actor has no AI process.
*This function cannot be called on a dead or disabled actor. You will get an error that the actor has no AI process.
*Actors with an alpha value less than 1 will not be able to ForceGreet the player, ''unless'' they are flagged as a ghost (either on the base actor or via the SetGhost command). Their package will run and they will approach the player when in range, but will not initiate dialogue.
**Note that setting an NPC as a ghost will make them immune to all damage, and all weapons pass through them without playing hit effects or triggering hit events.
**You can temporarily set an NPC as a ghost for the sake of a ForceGreet package through a package fragment script. Call akActor.SetGhost(true) when the package begins and akActor.SetGhost(false) when the package ends.


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

Latest revision as of 00:00, 12 July 2022

Member of: Actor Script

Sets this actor's alpha value, optionally fading them to that value rather then popping.

Syntax[edit | edit source]

Function SetAlpha(float afTargetAlpha, bool abFade = false) native

Parameters[edit | edit source]

  • afTargetAlpha: The target alpha value, clamped to the 0 to 1 range. 0 is completely transparent, 1 is completely visible.
  • abFade: If true, the actor will fade over time - otherwise they will pop to the value.
    • Default: False

Return Value[edit | edit source]

None.

Examples[edit | edit source]

; Pop the ghost to half-transparent
Ghost.SetAlpha(0.5)


; Fade the ghost to mostly visible
Ghost.SetAlpha(0.9, true)

Notes[edit | edit source]

  • The player cannot be faded completely out and will always remain partially visible.
  • The fade boolean does not work if you set the alpha to (0.0). If you wish to fade to zero, then it must be set to (0.1) and then use Utility.Wait(0.3) (or any equally small number), calling the function afterwards to set to (0.0).
  • This function cannot be called on a dead or disabled actor. You will get an error that the actor has no AI process.
  • Actors with an alpha value less than 1 will not be able to ForceGreet the player, unless they are flagged as a ghost (either on the base actor or via the SetGhost command). Their package will run and they will approach the player when in range, but will not initiate dialogue.
    • Note that setting an NPC as a ghost will make them immune to all damage, and all weapons pass through them without playing hit effects or triggering hit events.
    • You can temporarily set an NPC as a ghost for the sake of a ForceGreet package through a package fragment script. Call akActor.SetGhost(true) when the package begins and akActor.SetGhost(false) when the package ends.

See Also[edit | edit source]