Difference between revisions of "Talk:SetName - Form"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>JustinOther
(Answer)
imported>CraftySentinel
 
(5 intermediate revisions by 4 users not shown)
Line 2: Line 2:


:: Yes. SetName is a member of Form and Cell extends Form, thus SetName is inherited by Cell and applicable for Cell forms. -[[User:JustinOther| JustinOther]] ([[User talk:JustinOther|talk]])
:: Yes. SetName is a member of Form and Cell extends Form, thus SetName is inherited by Cell and applicable for Cell forms. -[[User:JustinOther| JustinOther]] ([[User talk:JustinOther|talk]])
So how would it be written? GetCell? [[User:GetTheJojDone|GetTheJojDone]] ([[User talk:GetTheJojDone|talk]]) 2013-07-25T12:30:43 (EDT)
::Actually, it appears the name is given by its location, MorthalAlvaAndHroggarsHouseLocation "Alva's House" [LCTN:0001EB8E]. SetName should work on LCTN forms, but changes won't persist across game loads. Using 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]], you can see to it the name sticks.
::==========================================================================
Quest<source lang="papyrus">ScriptName YourQuestScript Extends Quest
String Property sDesiredName = "Hroggar's House" Auto
Location Property MorthalAlvaAndHroggarsHouseLocation Auto
Event OnInit()
If MorthalAlvaAndHroggarsHouseLocation.GetName() != sDesiredName
MorthalAlvaAndHroggarsHouseLocation.SetName(sDesiredName)
EndIf
EndEvent
</source>
Player<source lang="papyrus">ScriptName YourPlayerScript Extends ReferenceAlias
YourQuestScript Property QuestScript Auto
Event OnPlayerLoadGame()
QuestScript.OnInit()
EndEvent
</source>
::============================================================ -[[User:JustinOther| JustinOther]] ([[User talk:JustinOther|talk]])
::OnInit() fires just fine in the alias script. Why use an extra quest script? [[User:Thingy Person|Thingy Person]] ([[User talk:Thingy Person|talk]]) 2013-07-26T07:08:19 (EDT)
== Name Persistence ==
While Form name changes are not saved they can still sometimes be carried over to another game instance(save) as long as the game has not closed, I am assuming this is due to the form being kept in memory and not reset when loading a new game (Note: Only some form types do this in my case it was Message Forms but when I attempted to replicate this on an ActorBase Form it did not carry over ever). It's just something nice to be aware of as it can cause some inconsistencies. --[[User:CraftySentinel|CraftySentinel]] ([[User talk:CraftySentinel|talk]]) 2013-07-31T04:00:17 (EDT)

Latest revision as of 03:02, 31 July 2013

Would this script work on cells? For example I want Alva's House to become Hroggar's House after Laid To Rest. GetTheJojDone (talk) 2013-07-17T10:28:15 (EDT)

Yes. SetName is a member of Form and Cell extends Form, thus SetName is inherited by Cell and applicable for Cell forms. - JustinOther (talk)

So how would it be written? GetCell? GetTheJojDone (talk) 2013-07-25T12:30:43 (EDT)

Actually, it appears the name is given by its location, MorthalAlvaAndHroggarsHouseLocation "Alva's House" [LCTN:0001EB8E]. SetName should work on LCTN forms, but changes won't persist across game loads. Using a maintenance setup, you can see to it the name sticks.
==========================================================================

Quest

ScriptName YourQuestScript Extends Quest

String Property sDesiredName = "Hroggar's House" Auto
Location Property MorthalAlvaAndHroggarsHouseLocation Auto

Event OnInit()
	If MorthalAlvaAndHroggarsHouseLocation.GetName() != sDesiredName
		MorthalAlvaAndHroggarsHouseLocation.SetName(sDesiredName)
	EndIf
EndEvent

Player

ScriptName YourPlayerScript Extends ReferenceAlias

YourQuestScript Property QuestScript Auto

Event OnPlayerLoadGame()
	QuestScript.OnInit()
EndEvent
============================================================ - JustinOther (talk)
OnInit() fires just fine in the alias script. Why use an extra quest script? Thingy Person (talk) 2013-07-26T07:08:19 (EDT)


Name Persistence[edit source]

While Form name changes are not saved they can still sometimes be carried over to another game instance(save) as long as the game has not closed, I am assuming this is due to the form being kept in memory and not reset when loading a new game (Note: Only some form types do this in my case it was Message Forms but when I attempted to replicate this on an ActorBase Form it did not carry over ever). It's just something nice to be aware of as it can cause some inconsistencies. --CraftySentinel (talk) 2013-07-31T04:00:17 (EDT)