Jump to content

How to check the Player's Name?


Recommended Posts

I have some events in my Quest where I want to have some Easter Egg dialogue based on the player's name. Nothing really more than what Codsworth does.

But. however it works with Codsworth doesn't actually seem to be visible in the CK, so I can't find any examples of how to do it.

 

For the first instance, I have an Initially Disabled Trigger that the player has to walk through which sets up an alternate Scene with modified dialogue. My goal was to script the Trigger so that when the cell loads, it checks what the player's name is, and either stays disabled or enables, allowing the easter egg to occur.

 

F4SE seems to have a Getname function, but I can't seem to get it to do anything.

 

Any advice?

Link to comment
Share on other sites

GetName normally doesn't work for Forms that don't have a name in the name column in the CK. The Player character does not have a CK defined name for obvious reasons. In order to use GetName on the player and actors, you need to call it on the base object.

PlayerRef.GetBaseObject().GetName()

Just tested, this works.

You can make it a little performance friendly by calling GetBaseObject() on the PlayerRef property, instead of on Game.GetPlayer(). Whichever you prefer.

Edited by TheDungeonDweller
Link to comment
Share on other sites

  • 1 year later...

GetName normally doesn't work for Forms that don't have a name in the name column in the CK. The Player character does not have a CK defined name for obvious reasons. In order to use GetName on the player and actors, you need to call it on the base object.

 

PlayerRef.GetBaseObject().GetName()

Just tested, this works.

 

You can make it a little performance friendly by calling GetBaseObject() on the PlayerRef property, instead of on Game.GetPlayer(). Whichever you prefer.

 

 

GetName() is F4SE function.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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