Code viewer
mcu8_SeqAct_GetPlayerName
#Kismet
Kismet node for setting the Steam player name into a ConversationTree string variable!
Take note: this works only on the Steam release of the game. Also, it doesn't work in the editor (because of OnlineSubsystem is not available here)
Variable reference:
ConversationStringName
enter your conversation tree variable name here, for example playername, then just enter the [playername] in the conversation tree message
ValueOnFail
here you can enter the default value - it will be used where OnlineSubsystem is not available
class mcu8_SeqAct_GetPlayerName extends SequenceAction; defaultproperties { ObjName="GetPlayerName" ObjCategory="Steam" bCallHandler=false VariableLinks.Empty } var() string ConversationStringName<autocomment=true>; var() string ValueOnFail<autocomment=true>; // if user is non-steam event Activated() { SetConversationString(ConversationStringName, GetMySteamNickname(), 0); } function string GetMySteamNickname() { local OnlineSubsystem OnlineSubsystem; local String Nickname; OnlineSubsystem = class'GameEngine'.static.GetOnlineSubsystem(); if (OnlineSubsystem == None) return ValueOnFail; Nickname = OnlineSubsystemCommonImpl(OnlineSubsystem).GetPlayerNicknameFromIndex(0); return Nickname; } function SetConversationString(string varname, string value, int lifetime) { local Worldinfo w; local Hat_GameManager g; w = GetWorldInfo(); if (w != None && w.game != None) { g = Hat_GameManager(w.game); if (g != None) { g.SetConversationString(varname, value, lifetime); } } }