SetDisplayName - ObjectReference: Difference between revisions

From the CreationKit Wiki
Jump to navigation Jump to search
(Persistence with save game)
Tags: Mobile edit Mobile web edit
m (Convert source tags to syntaxhighlight)
 
Line 6: Line 6:


== Syntax ==
== Syntax ==
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
Bool Function SetDisplayName(String asName, Bool abForce) native
Bool Function SetDisplayName(String asName, Bool abForce) native
</source>
</syntaxhighlight>


== Parameters ==
== Parameters ==
Line 18: Line 18:


== Examples ==
== Examples ==
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; rename the amulet
; rename the amulet
If myAmuletOfTalos.SetDisplayName("Amulet of the Ninth Divine", False) == False
If myAmuletOfTalos.SetDisplayName("Amulet of the Ninth Divine", False) == False
   Debug.Trace("Failed to rename the amulet. A quest alias may already be renaming it.")
   Debug.Trace("Failed to rename the amulet. A quest alias may already be renaming it.")
EndIf
EndIf
</source>
</syntaxhighlight>


== Notes ==
== Notes ==

Latest revision as of 20:19, 5 September 2026

SKSE Member of: ObjectReference Script

Changes a reference's display name. This is the name seen when aiming at the reference in the game world, and when the reference is placed into an inventory. The change is persistent with save games.

Syntax[edit | edit source]

Bool Function SetDisplayName(String asName, Bool abForce) native

Parameters[edit | edit source]

  • asName: The name to set.
  • abForce: If this argument is True, and the reference already has its name changed by a quest alias, then this function will overwrite that name change. If this argument is False, then this function will only make changes if the reference's current display name doesn't come from a quest alias.

Return Value[edit | edit source]

True if the reference's name was successfully changed, or False otherwise.

Examples[edit | edit source]

; rename the amulet
If myAmuletOfTalos.SetDisplayName("Amulet of the Ninth Divine", False) == False
   Debug.Trace("Failed to rename the amulet. A quest alias may already be renaming it.")
EndIf

Notes[edit | edit source]

  • This function uses the same system that quest aliases use to rename forms ("ExtraTextDisplayData" internally). This is why this function can conflict with quest alias name changes.
    • It is not known whether a newly-applied quest alias would overwrite changes made by this function. Further research is required.

See Also[edit | edit source]