Hello guys!
I am trying to implement local multiplayer with splitscreen on my game, I got the barebones working already, just the most basic stuff:
However, I am having a problem for changing the player mesh. I want to control everything by Kismet, because it is faster, and easier.
I have used this custom Kismet Sequence Action: https://unrealxeditor.wordpress.com/…sh-via-kismet/
It works perfectly, but only for player 1 mesh (Player Index 0). I want to be able to change aswell the player 2 mesh (Player Index 1).
By looking at the source code of other Kismet Sequence Action Nodes, I tried to add a target input to this node, so I can in kismet link that input to the second player variable. However, I think I have done some mistake, because it is not compiling correctly (Unrecognized Member ‘Target’ in class ‘UTPlayerController’):
class SeqAct_ChangePlayerMesh extends SequenceAction;
var() SkeletalMesh newMesh;
var MaterialInterface defaultMaterial0;
var() AnimTree newAnimTree;
var() array<AnimSet> newAnimSet;
var() PhysicsAsset newPhysicsAsset;
event Activated()
{
local int i;
//this will allow us to select player index
local SeqVar_Object ObjVar;
local Pawn Target;
local UTPlayerController PC;
PC = UTPlayerController(GetWorldInfo().GetALocalPlayerController());
//this will allow us to select player index
foreach LinkedVariables(class'SeqVar_Object', ObjVar, "Target")
{
Target = GetPawn(Actor(ObjVar.GetObjectValue()));
if (Target != None)
{
PC.Target.Mesh.SetSkeletalMesh(newMesh);
PC.Target.Mesh.SetPhysicsAsset(newPhysicsAsset);
PC.Target.Mesh.AnimSets=newAnimSet;
PC.Target.Mesh.SetAnimTreeTemplate(newAnimTree);
for (i = 0; i < PC.Target.Mesh.SkeletalMesh.Materials.length; i++)
{
PC.Target.Mesh.SetMaterial( i, defaultMaterial0 );
}
}
}
}
defaultproperties
{
ObjName="ChangePlayerMesh"
ObjCategory="Change Player Mesh"
VariableLinks.empty;
}
And the 2nd error, I think @**Nathaniel3W **can help me, as he got too much experience with Scaleform. Whenever I run these functions on my custom ViewportClient (to add 2nd player and split the screen):
exec function DebugCreatePlayer(int ControllerId)
{
local string Error;
if(GamePlayers.Length < 2)
CreatePlayer(ControllerId, Error, TRUE);
}
event LocalPlayer CreatePlayer(int ControllerId, out string OutError, bool bSpawnActor)
{
return super.CreatePlayer(ControllerId,OutError,bSpawnActor);
}
It works, however, my custom Scaleform HUD is replaced by UT3 Canvas HUD. How to fix this aswell?
Cheers and thanks for all.