Code: Select all
//=============================================================================
// mprojtest.
//=============================================================================
class mprojtest expands SpawnNotify;
var vector ROffset;
var BruteProjectile bp;
Replication
{
Reliable if(Role==ROLE_Authority) ROffset, bp;
}
Simulated Function PostBeginPlay()
{
local actor A;
ActorClass=Class'Actor';
Super.PostBeginPlay();
if( Level.NetMode != NM_DedicatedServer )
Enable('Tick');
// SetTimer(0.1,false);
foreach allactors(Class'Actor',A)
{
if(Mercenary(A)!=None)
{
Mercenary(A).ProjectileSpeed=Mercenary(A).ProjectileSpeed*1.5;
}
if(Brute(A)!=None)
{
Brute(A).ProjectileSpeed=Brute(A).ProjectileSpeed*1.5;
}
if(Krall(A)!=None)
{
Krall(A).ProjectileSpeed=Krall(A).ProjectileSpeed*2;
}
if(Titan(A)!=None)
{
Titan(A).ProjectileSpeed=Titan(A).ProjectileSpeed*2;
}
}
}
simulated event Actor SpawnNotification(Actor A)
{
if(Rocket(A)!=None)
{
Rocket(A).Velocity=Rocket(A).Velocity*2;
}
if(Chunk(A)!=None)
{
Chunk(A).SetPhysics(PHYS_Falling);
}
if(StingerProjectile(A)!=None)
{
StingerProjectile(A).Velocity=StingerProjectile(A).Velocity*3;
StingerProjectile(A).SetPhysics(PHYS_Falling);
}
if(TentacleProjectile(A)!=None)
{
//TentacleProjectile(A).Speed=100;
//TentacleProjectile(A).MaxSpeed=100;
TentacleProjectile(A).Velocity=TentacleProjectile(A).Velocity*4;
TentacleProjectile(A).Velocity.Z=TentacleProjectile(A).Velocity.Z+=350;
TentacleProjectile(A).SetPhysics(PHYS_Falling);
}
if(Mercenary(A)!=None)
{
Mercenary(A).ProjectileSpeed=Mercenary(A).ProjectileSpeed*1.5;
}
if(Brute(A)!=None)
{
Brute(A).ProjectileSpeed=Brute(A).ProjectileSpeed*1.5;
}
if(BruteProjectile(A)!=None)
{
BruteProjectile(A).MaxSpeed=BruteProjectile(A).MaxSpeed*1.5;
}
if(SlithProjectile(A)!=None)
{
//TentacleProjectile(A).Speed=100;
//TentacleProjectile(A).MaxSpeed=100;
SlithProjectile(A).Velocity=SlithProjectile(A).Velocity*2;
SlithProjectile(A).Velocity.Z=SlithProjectile(A).Velocity.Z+=150;
SlithProjectile(A).SetPhysics(PHYS_Falling);
}
if(Krall(A)!=None)
{
Krall(A).ProjectileSpeed=Krall(A).ProjectileSpeed*2;
}
if(KraalBolt(A)!=None)
{
KraalBolt(A).MaxSpeed=KraalBolt(A).MaxSpeed*2;
}
if(Titan(A)!=None)
{
Titan(A).ProjectileSpeed=Titan(A).ProjectileSpeed*2;
}
if(BigRock(A)!=None)
{
BigRock(A).Velocity=BigRock(A).Velocity*1.5;
BigRock(A).Velocity.Z=BigRock(A).Velocity.Z+=200;
SetTimer(0.1,False,'RockFall');
}
return A;
}
function tick(float delta)
{
local actor a;
if(Level.NetMode!=NM_Client) ROffset=1000*VRand();
if(!bool(ROffset)) return;
ROffset.X=int(ROffset.X);
ROffset.Y=int(ROffset.Y);
ROffset.Z=int(ROffset.Z);
foreach allactors(Class'Actor',A)
{
if(bp!=None) bp.Acceleration=ROffset;
if(Rocket(A)!=None) Rocket(A).Acceleration=ROffset;
}
ROffset=vect(0,0,0);
}
/*simulated function tick(float delta)
{
local actor a;
foreach allactors(Class'Actor',A)
{
if(BruteProjectile(A)!=None)
{
BruteProjectile(A).Acceleration.X=Randrange(1000,-1000);
BruteProjectile(A).Acceleration.Y=Randrange(1000,-1000);
BruteProjectile(A).Acceleration.Z=Randrange(1000,-1000);
}
if(Rocket(A)!=None)
{
Rocket(A).Acceleration.X=Randrange(1000,-1000);
Rocket(A).Acceleration.Y=Randrange(1000,-1000);
Rocket(A).Acceleration.Z=Randrange(1000,-1000);
}
}
}*/
simulated function RockFall()
{
local actor a;
foreach allactors(Class'Actor',A)
{
if(BigRock(A)!=None)
{
BigRock(A).SetPhysics(PHYS_Falling);
}
}
}
Now anything that gets set as PHYS_Falling works just fine, I can then adjust velocity, and no problem there. The trouble is other projectiles that are still PHYS_Projectile don't replicate online. It works perfectly in single player, but online the projectiles still look slow on your client, but end up hitting you well before they visually reach you, since server side the projectile changes are working.
If there's a better way to go about this or to get replication for this working online, would appreciate the help. My goal is to try and do this without having to make custom projectile classes for everything I want to change.