UE2 - UT2kX Mutator problem

  • 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.

EvilT-ModZ

Un-Gravitify
Aug 3, 2011
42
0
6
30
Russia
www.set-games.ru
Hello, I made mutator that spawns pawn's shadows
So, it succesfully working on non-dediacate, on client it doesn't work (shadows doesn't spawns)

Mutator code:
Code:
class ShadowMutator extends Mutator;

var ModernShadowProjector MSP;

///////////////////////////////////////////////////////////////////////////////
// Get players to spawn shadows
///////////////////////////////////////////////////////////////////////////////
function ModifyPlayer(Pawn Other)
{
	if(Other != None)
	{
		SpawnShadow(Other);
		MSP.SetShadowMap();
	}
	else
	{
		if(MSP != None)
		{
			MSP.ClearShadowMap();
			MSP.RenderShadow = False;
			MSP.ShadowActor = None;
			MSP.Destroy();
		}
	}
	if ( NextMutator != None )
		NextMutator.ModifyPlayer(Other);
}

///////////////////////////////////////////////////////////////////////////////
// Spawn shadow
///////////////////////////////////////////////////////////////////////////////
function SpawnShadow(Pawn ShadowPawn)
{
	MSP = spawn(class'ModernShadowProjector', ShadowPawn,,
                                         ShadowPawn.Location);
	MSP.ShadowActor = ShadowPawn;
	MSP.LightDirection = Normal(vect(1,1,3));
	MSP.LightDistance = 380;
	MSP.MaxTraceDistance = 350;
	MSP.RenderShadow = True;
	MSP.UpdateShadow();
}
 

EvilT-ModZ

Un-Gravitify
Aug 3, 2011
42
0
6
30
Russia
www.set-games.ru
ModifyPlayer() only happens server-side and (shadow)projectors are not replicated.
Code:
replication
{
	reliable if( Role == ROLE_Authority )
		MSP, SpawnShadow;
}
Anyway doesn't work
Probably my replication isn't correct or PlayerModify can't call spawn function for client?
 
Last edited:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
While variables can be replicated to all clients, function calls can't.
You might want to read a replication tutorial before attempting to blindly fire random code at the problem. Feel free to try the one in my signature or find others via Google.
 
Last edited: