Difference between revisions of "Talk:SetName - Form"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>JustinOther
imported>JustinOther
m (Simplified example.)
Line 13: Line 13:


Event OnInit()
Event OnInit()
Maintenance()
EndEvent
Function Maintenance()
If MorthalAlvaAndHroggarsHouseLocation.GetName() != sDesiredName
If MorthalAlvaAndHroggarsHouseLocation.GetName() != sDesiredName
MorthalAlvaAndHroggarsHouseLocation.SetName(sDesiredName)
MorthalAlvaAndHroggarsHouseLocation.SetName(sDesiredName)
EndIf
EndIf
EndFunction
EndEvent
</source>
</source>


Line 28: Line 24:


Event OnPlayerLoadGame()
Event OnPlayerLoadGame()
QuestScript.Maintenance()
QuestScript.OnInit()
EndEvent
EndEvent
</source>
</source>
::============================================================ -[[User:JustinOther| JustinOther]] ([[User talk:JustinOther|talk]])
::============================================================ -[[User:JustinOther| JustinOther]] ([[User talk:JustinOther|talk]])

Revision as of 00:12, 26 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)