I have a horse that extends from UDKPawn. The player posesses it to ride and is attached to a socket.
When in MP the client when they mount they are not visible on the horse, their original mesh stays where they climbed on. When they dismount the mesh that stayed where he mounted the horse vanishes but then the player is still invisible to others …
Any suggestions?
In the PC:
simulated reliable server function startMount()
{
activeHorse.Mesh.AttachComponentToSocket(MSPawn(pawn).Mesh, 'Seat');
UnPossess();
Possess(activeHorse, false);
Pawn.SetPhysics( PHYS_Walking );
}
simulated reliable server function disMountHorse()
{
UnPossess();
Possess(playerB4Mount, false);
activeHorse.Mesh.DetachComponent(MSPawn(pawn).Mesh);
SetBase(none);
Pawn.SetPhysics( PHYS_Walking );
}
well your functions are only for the server. I believe you’re missing some logic for the clients
Initially thought the socket attachments would be done for clients. Added code for clients, if testing on a listen server the host (server player) when the player dismounts and does not possess the horse, they are invisible to the clients and if I suicide that player, the game crashes.
The initial calling functions are a bit complex but I added log values and the vars have the correct values.
Also if I ensure none of the client functions are called, the server player will crash with the same error if I suicide the player after they dismount. In this scenario when no client code is run the client player does see the host player after they dismount.
So it appears the invisibilty after the player dismounts is something with the client code and the crash is something on the server code.
Since posting I did another test where I removed the socket attachment/detach and the crash does not occur. Now obviously the player doesn’t attach to the horse, so suggestions as to how I attach the player without crashing ? The crash occurred whether I ran client or server only code.
0062.93] ScriptLog: ************** WEAPON ANIMS2 **********None
[0069.10] Log: InitRagdoll: SkeletalMeshComponent.Owner (0) is not the Pawn (2ceaf000)
[0069.10] Critical: appError called: MSPawn_0 collisioncomponent SkeletalMeshComponent_15 not initialized deleteme 0
[0069.10] Critical: Windows GetLastError: A non-blocking socket operation could not be completed immediately. (10035)
[0072.81] Log: === Critical error: ===
MSPawn_0 collisioncomponent SkeletalMeshComponent_15 not initialized deleteme 0
Address = 0x751bc42d (filename not found) [in C:\Windows\syswow64\KERNELBASE.dll]
Address = 0xdd4381 (filename not found) [in E:\UDK\UDK-2012-07-ZuluFix\Binaries\Win32\UDK.exe]
simulated reliable client function cReadyUpHorseServerPlayer()
{
if (ClimbedAnimalServer != none)
{
ClimbedAnimalServer.Mesh.AttachComponentToSocket(OriginalPlayerServer.Mesh, 'Seat');
// OriginalPlayerServer.controller.SetBase(ClimbedAnimal);
// OriginalPlayerServer.controller.UnPossess();
// OriginalPlayerServer.controller.Possess(ClimbedAnimal, false);
OriginalPlayerServer.Mesh.SetOnlyOwnerSee(false);
OriginalPlayerServer.Mesh.SetOwnerNoSee(true);
}
}
simulated reliable server function sReadyUpHorse()
{
if (ClimbedAnimal != none)
{
ClimbedAnimal.Mesh.AttachComponentToSocket(OriginalPlayer.Mesh, 'Seat');
// SetBase(ClimbedAnimal);
UnPossess();
Possess(ClimbedAnimal, false);
OriginalPlayer.Mesh.SetOnlyOwnerSee(false);
OriginalPlayer.Mesh.SetOwnerNoSee(false);
}
}
simulated reliable server function sGetOffHorse()
{
UnPossess();
Possess(OriginalPlayer, false);
ClimbedAnimal.Mesh.DetachComponent(OriginalPlayer.Mesh);
// OriginalPlayer.controller.SetBase(none);
OriginalPlayer.Mesh.SetOnlyOwnerSee(false);
OriginalPlayer.Mesh.SetOwnerNoSee(true);
}
simulated reliable client function cGetOffHorseServerPlayer()
{
// OriginalPlayerServer.controller.UnPossess();
// OriginalPlayerServer.controller.Possess(OriginalPlayerServer, false);
ClimbedAnimalServer.Mesh.DetachComponent(OriginalPlayerServer.Mesh);
// OriginalPlayerServer.controller.SetBase(none);
OriginalPlayerServer.Mesh.SetOnlyOwnerSee(false);
OriginalPlayerServer.Mesh.SetOwnerNoSee(true);
}
Upshot is I can only think there’s a UDK bug with network games when attaching/detaching the players pawn to a socket on a possessed character.
So now I spawn a similar pawn to the player’s character, update the players pawn and the new pawn’s visibility and leave it attached to the horse. Its not as good as I don’t get a seamless transition from the players pawn to the other pawn but its better then a crash …