Jump to content

Getting the player name with a script


JosephRussell

Recommended Posts

Hey all,

 

I'm setting up a little script for an easter egg in my follower mod where a variable is set to 1 if the player has a particular name.

 

So far I've tried:

 

if game.getplayer()=="Joseph"
LucienQuest.CustomName=1
Endif
Debug.Trace("Player is " + Game.GetPlayer())
However, this doesn't seem to work, and my variable seems to remain at 0! I can't seem to find anything helpful online - and I really don't want my players to have to download SKSE64. Does anyone have any ideas?
Thanks!
Link to comment
Share on other sites

That example is misleading. It is correct for the usage of the Trace statement and correct for usage of GetPlayer but it doesn't return the name. What it returns is the game's reference to the player's character and the trace statement would display the FormID. GetPlayer is used to access a wide variety of data from the player's character.

 

With SKSE (for original Skyrim and SSE when it is released as stable) you should be able to use GetName.

Example:

 Debug.Trace("Player name is "+Game.GetPlayer().GetBaseObject().GetName())
Link to comment
Share on other sites

  • 3 years later...

JosephRussell, and it still works? If we consider about the names and how to create different unique nicknames for your game purposes, you may use something like argonian name generator because it's pretty reliable online resource, which allows anyone to get the most relevant nickname, without any kind of registrations.

Edited by ScottMW
Link to comment
Share on other sites

  • Recently Browsing   0 members

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