Jump to content

Renaming: Creating an unique baseObject


portbash

Recommended Posts

Right now I'm using setName on a current references baseObject:



ActionRef.getBaseObject().setName("Name")

Now, by renaming an object, lets say, the reference is the common bed furniture, all(!) common beds in the world will use that new name.

 

How to create an unique "copy" of this reference to apply the new name to just this reference?

Link to comment
Share on other sites

If you have already placed the reference object...

Edit the reference object

Click on the button that says "Edit Base"

The base form will open up

Change the ID name of the base form

Change the display name of the form to what you want

OK to save the changes

You'll be asked about creating a new form because the ID name changed

Say yes

Your reference will now be pointing to this new base form.

 

If you have multiple references already placed...

Do the above for one of them, then you'll need to replace all the others with references of the new base form.

 

If you have not placed any references...

Go to the location in the Object window that has the pre-existing base forms which are similar to what you want

Edit one

Change the ID name and any other information

Press OK to save the changes

You'll be asked about creating a new form because the ID name was changed

Say Yes

Use this new form to drag-n-drop into the render window for placement of your reference(s)

 

If this is a stock placed reference...

The above still works simply remember that if another mod edits the same reference, the last loaded gets to work in the game.

Link to comment
Share on other sites

Next time, please specify in or out of game so time is not wasted....

 

No, you cannot change the name of just one specific instance using SKSE's SetName. SKSE's SetName changes the name on the base form and thus it will affect all instances.

 

You could in theory use the OnCellAttach event to store the previous name and set the name so that it displays what you want and then use the OnCellDetach event to revert the name. You'd need to toggle a global variable between 0 & 1 so that your OnPlayerLoadGame event can set it to display the correct name. But there may be an issue with that, papyrus is case insensitive and as a result it will store the previous name in all lower case. If you knew that the original base name was always going to be the same (i.e. no other mod changing the name) then you could pre-store the name with the upper case letters.

 

Another possibility would be to create a quest and put the reference into an alias and have the name changed via the alias (Display Name). Downside (and may be beneficial to you) is that the name change is permanent even if the reference is removed from the alias. See Quest Alias Tab for more info.

Link to comment
Share on other sites

SKSE has SetDisplayName that only sets the display name of the object reference and doesn't effect the BaseObject name.

ObjectRef.SetDisplayName("My Bed, Keep Off!")

 

SKSE also has GetDisplayName

So if your using SetDispalyName, use GetDisplayName to retrieve the object reference display name.

 

I'm honestly not sure how persistent the SetDispalyName is, so it may need maintenance code to check or renew the display name on cell loads.

Link to comment
Share on other sites

I only found the SKSE Set/GetDisplayName in someone elses code.

After looking high and low and everywhere but the skse scripts, I thought it must have been a custom user function called from another script.

After scrutinising 11 scripts of someone else code, I slapped my forehead and did what I should have done in the start!

Checked the source of the skse scripts....lol

Link to comment
Share on other sites

  • 3 weeks later...

My Renamer mod has good examples of how to use SetDisplayName to rename individual instances and SetName to rename base objects (all instances that don't otherwise have an instance-specific name).

 

The source code is included in the .BSA

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...