SetHasCharGenSkeleton - Actor

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: Actor Script

Flags this actor as having a fully char gen editable skeleton or not.

Syntax[edit | edit source]

Function SetHasCharGenSkeleton(bool abCharGen = true) native

Parameters[edit | edit source]

  • abCharGen: True to set actor for full char gen editing, false to restore them to normal.
    • Default: True

Return Value[edit | edit source]

None.

Examples[edit | edit source]

; Set player spouse up for editing in char gen menu
PlayerSpouse.SetHasCharGenSkeleton(true)


Notes[edit | edit source]

  • The CharGenSkeleton is incompatible with Power Armor, so don't set it on an actor that could be in Power Armor while you need him to have the CharGenSkeleton.
  • Adding or removing the CharGenSkeleton causes the Actor's animation graph to be deleted and re-initialized. That means that any animation events you register on the actor beforehand will become unregistered.
  • This function does not wait for the Actor to be fully re-initialized before the script moves on. If you need to know that when the Actor has finished re-initializing (for example: because you don't want the player to be able to switch to third person when his third person animations aren't loaded) then see the following example below.

Example: When is the CharGenSkeleton reset done?[edit | edit source]

Function SomeFunction()
  ;register for this event before adding/removing the CharGenSkeleton. We want to know when it unregisters, which means
  ;the CharGenSkeleton has finished deleting the graph
  RegisterForAnimationEvent(Game.GetPlayer(), "FirstPersonInitialized")

  ;now add or remove the CharGenSkeleton. In this example, we're removing it
  PlayerREF.SetHasCharGenSkeleton(False)
EndFunction

;we registered for the FirstPersonIntitialized event, but what we really want to know is when it unregisters
Event OnAnimationEventUnregistered(ObjectReference akSource, string asEventName)
  If asEventName == "FirstPersonInitialized"
    ;now register for the event that fires when the third person graph is fully available
    RegisterForAnimationEvent(Game.GetPlayer(), "initiateStart")		
  EndIf
EndEvent

Event OnAnimationEvent(ObjectReference akSource, string asEventName)
  ;CharGenSkeleton has finished being removed or added, third person animations are now available
  If (asEventName == "initiateStart")
    ;whatever scripting you want when the graph is available, such as enabling third person controls
  EndIf
EndEvent

See Also[edit | edit source]