TairaNoritsune Posted February 13, 2021 Share Posted February 13, 2021 (edited) Is it possible to use player name as condition? For example "if player character's name is "XXXXX" then dialogue option is available". If yes, then how? Edited February 13, 2021 by TairaNoritsune Link to comment Share on other sites More sharing options...
Evangela Posted February 13, 2021 Share Posted February 13, 2021 SKSE.. If Game.GetPlayer().GetName() == "XXXXX" Link to comment Share on other sites More sharing options...
TairaNoritsune Posted February 13, 2021 Author Share Posted February 13, 2021 Gratitude for answer. Will try. Link to comment Share on other sites More sharing options...
TairaNoritsune Posted February 15, 2021 Author Share Posted February 15, 2021 Took a look at it, it seems it is only usable when writing scripts, but can't add a condition to dialogue option in conversation with NPC. Does anyone have any idea how to do that (I mean block off or enable a conversation branch based on whether player character has a particular name or not)? Link to comment Share on other sites More sharing options...
Evangela Posted February 15, 2021 Share Posted February 15, 2021 (edited) There isn't a condition function to check for the player's actual name. I believe an alternative is to check for the PlayerKeyword via HasKeyword. The player is the ONLY reference that will have that keyword. If you really require name checking, I'm afraid SKSE is all there is for it. Edited February 15, 2021 by Rasikko Link to comment Share on other sites More sharing options...
TairaNoritsune Posted February 15, 2021 Author Share Posted February 15, 2021 I see. Wish there was any better way to make things check if player character is this particular player character, or just random player character. My goal is to make it possible for NPC to "recognize" a player character as specific character and I was thinking, the name would be the best way doable (since there is no way to take into account player character's appearance or anything). Another way to do it, I guess, would be to make a pop-up menu appear asking "Are you this person?" or something like that, store it to variable and use on condition, but I would want to avoid that, because it would not be subtle enough. My goal was to use player character's name as a "password" of sorts, so that if player character would bear a specific name, NPC would recognize him and dialogue would be different than usual. Link to comment Share on other sites More sharing options...
TairaNoritsune Posted February 15, 2021 Author Share Posted February 15, 2021 Well, found a way to go about it with function Thou suggested: made quest to have 2 stages - stage 0 executes script: if player character's name is "XXXX" start stage 20, if not stage 25 and stages have different dialogue. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 15, 2021 Share Posted February 15, 2021 An alternative that might give you a bit more freedom in usage:Using SKSE have a quest with an alias pointing to the player. Assign a script to this alias. Register for the chargen menu and / or tween menu. Using the OnMenuClose event check the player's name. If the correct name, assign a global variable to a specific value. Otherwise give that global variable a value of zero. Then you can use the global variable in any condition statement whether it be an IF block of a script or a condition block for such things as dialog, spells, etc.. Sample script Scriptname SomePlayerAliasScript Extends ReferenceAlias GlobalVariable Property myGlobal Auto String Property TargetName = "" Auto Event OnInit() RegisterForSingleUpdate(1.0) ;quests can send the OnInit event twice under some scenarios ;registering for an update allows OnInit to fire twice but only call the code once ;as a second update registration replaces any previous registrations EndEvent Event OnUpdate() MaintWork() EndEvent Event OnPlayerLoadGame() MaintWork() EndEvent Function MaintWork() UnRegisterForAllMenus() If TargetName != "" ;only register if TargetName property has been assigned valid data RegisterForMenu("RaceSex Menu") ; chargen menu for new games RegisterForMenu("TweenMenu") ;the between menu for magic, inventory, map and leveling for mid-progress games Else ;TargetName has an empty value - make sure global is reset myGlobal.SetValue(0.0) EndIf ;add any other code that might need to be done when initiated or when the game is loaded again EndFunction Event OnMenuClose(String MenuName) If (MenuName == "RaceSex Menu" || MenuName == "TweenMenu") If Game.GetPlayer().GetName() == TargetName myGlobal.SetValue(1.0) Else myGlobal.SetValue(0.0) EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts