Skip to content

Instantly share code, notes, and snippets.

@mcu8
Last active September 7, 2019 20:31
Show Gist options
  • Save mcu8/a2a6a4f057f52c7de566009ea7746b2b to your computer and use it in GitHub Desktop.
Save mcu8/a2a6a4f057f52c7de566009ea7746b2b to your computer and use it in GitHub Desktop.
Script for joining Online Party using Kismet in A Hat in Time
class mcu8_SeqAct_JoinOnlineParty extends SequenceAction;
var() string LobbyName<Tooltip=Lobby name>;
var() bool bDebug<Tooltip=Debug.>;
defaultproperties
{
ObjName="JoinOnlineParty"
ObjCategory="Misc"
VariableLinks.Empty
VariableLinks(0)=(ExpectedType=class'SeqVar_String',LinkDesc="Lobby name",bWriteable=false,PropertyName=LobbyName)
bDebug = false
}
event Activated()
{
local OnlineSubsystem OnlineSubsystem;
OnlineSubsystem = class'GameEngine'.static.GetOnlineSubsystem();
if (OnlineSubsystem != None) {
class'Hat_GhostPartyPlayerStateBase'.static.ConfigSetUseOnlineFunctionality(True);
class'Hat_GhostPartyPlayerStateBase'.static.ConfigSetLobbyName(LobbyName);
if (LobbyName != "")
{
DebugPrint("Joining lobby '" $ LobbyName $ "'");
class'Hat_GhostPartyPlayerStateBase'.static.LobbyJoinByName(LobbyName);
}
else
{
DebugPrint("Leaving lobby because input is empty or none");
class'Hat_GhostPartyPlayerStateBase'.static.LobbyJoinPublic();
}
}
else {
DebugPrint("Unable to join lobby '" $ LobbyName $ "' because OnlineSubsystem is None");
}
}
function DebugPrint(string v) {
if (bDebug) Hat_PlayerController(class'Engine'.static.GetEngine().GamePlayers[0].Actor).ClientMessage(v);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment