Difference between revisions of "SetName - Form"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Sagitarius22
imported>JustinOther
m (Argument misnamed. 'k' denotes a Form/Alias, BTW. If going by Beth's argument nomenclature, it would be asName, Added a note about maintaining the edits.)
 
(3 intermediate revisions by one other user not shown)
Line 8: Line 8:
== Syntax ==
== Syntax ==
<source lang="papyrus">
<source lang="papyrus">
Function SetName(String akString) native
Function SetName(String Name) native
</source>
</source>


== Parameters ==
== Parameters ==
*akString: the new name for this form.
*Name: the new name for this form.


== Return Value ==
== Return Value ==
Line 20: Line 20:
<source lang="papyrus">
<source lang="papyrus">
; Set Bob's name to be Bobinsky
; Set Bob's name to be Bobinsky
Bob.GetBaseObject().SetName("Bobinsky")
BobReference.GetBaseObject().SetName("Bobinsky")
; My name's now Bobinsky!
; My name's now Bobinsky!
</source>
</source>
Line 26: Line 26:
<source lang="papyrus">
<source lang="papyrus">
; Set the Bob's name to be Bob + player's name (here, player is named Bobby
; Set the Bob's name to be Bob + player's name (here, player is named Bobby
Bob.GetBaseObject().SetName("Bob "+Game.GetPlayer().GetBaseObject().GetName())
BobReference.GetBaseObject().SetName("Bob "+Game.GetPlayer().GetBaseObject().GetName())
; Bob is now named Bob Bobby!
; Bob is now named Bob Bobby!
endif
endif
</source>
<br>
<source lang="papyrus">
; Set the form's name to be Sam, through a Reference Alias.
VillagerAlias.GetReference().GetBaseObject().SetName("Sam")
</source>
</source>


== Notes ==
== Notes ==
*This function does not work on actors or object references, use the actor base or base object instead.
* This function does not work on actors or object references, use the actor base or base object instead.
* This will affect all instances of the passed form. It's better to be used on a unique actor.
* This will affect all instances of the passed form. It's better to be used on a unique actor.
* Name changes will not be saved and must be maintained via a [[Complete_Example_Scripts#Maintenance.2Fupdate_code_which_runs_once_per_save_load_and_shows_a_message_when_a_mod_is_updated_or_first_loaded|maintenance setup]] or something similar.


== See Also ==
== See Also ==
*[[Form Script]]
*[[Form Script]]
*[[GetName - Form]]
*[[GetName - Form]]
*[[GetBaseObject - ObjectReference]]

Latest revision as of 02:03, 1 September 2012

SKSE Member of: Form Script

Sets the name of the form. (This function requires SKSE)

Syntax[edit | edit source]

Function SetName(String Name) native

Parameters[edit | edit source]

  • Name: the new name for this form.

Return Value[edit | edit source]

  • none

Examples[edit | edit source]

; Set Bob's name to be Bobinsky
BobReference.GetBaseObject().SetName("Bobinsky")
; My name's now Bobinsky!


; Set the Bob's name to be Bob + player's name (here, player is named Bobby
BobReference.GetBaseObject().SetName("Bob "+Game.GetPlayer().GetBaseObject().GetName())
; Bob is now named Bob Bobby!
endif


; Set the form's name to be Sam, through a Reference Alias.
VillagerAlias.GetReference().GetBaseObject().SetName("Sam")

Notes[edit | edit source]

  • This function does not work on actors or object references, use the actor base or base object instead.
  • This will affect all instances of the passed form. It's better to be used on a unique actor.
  • Name changes will not be saved and must be maintained via a maintenance setup or something similar.

See Also[edit | edit source]