UE2 - UT2kX Pawn Control Swap on a server

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Parapeplum

New Member
Jun 5, 2013
4
0
0
Hi,

I'm trying to make a weapon which spawn a xpawn the 'lure' and give the control to the player owning the gun.
The player will control the original pawn is made when:

-the lure auto-destroys as I want the control time limited.
I used the lifespan parameter in my modified xpawn class to avoid using a timer() or tick().

-the lure is killed.
The process of possesssing/unpossessing works offline but i have an issue when unpossesing the pawn on a server.

In my xpawn subclass i modified :

Code:
simulated function Destroyed()
{
   ...
	
    RelinquishController();
    Super.Destroyed();
}

State Dying
{
   simulated function BeginState()
	{
               ...
		RelinquishController();
		Super.BeginState();
 	}
}
and I added:
Code:
function RelinquishController()
{
	if ( Controller == None )
		return;
	Controller.Pawn = None;
	if ( !Controller.IsInState('GameEnded') )
	{
		if ( (OldPawn != None) && (OldPawn.Health > 0) )
		{
			Controller.Possess(OldPawn);
			log("possessing oldpawn");
		}	
		else
		{
			 if ( OldPawn != None )
				 Controller.Pawn = OldPawn;
 			else
 				Controller.Pawn = self;
			Controller.PawnDied(Controller.Pawn);
		}
	}
	Instigator = OldPawn;
	Controller = None;
}
(Taken from the redeemer warhead code.)

I suspect several things to cause the issue but I can't clearly point out what:

-revelancy: the xpawn cannot auto destroy because a controller (client) is controlling it

-replication:

  • the destruction function isn't replicated/called/executed on the client

  • the pawn itself isn't replicated