I've been picking brains on the Epic Games forums about this and I thought I'd try here too.
First I've got a weapon that has an iron-sights function like the Call of Duty games. When I zoom (go into iron sights mode) the weapon's Spread is set to a smaller value called SpreadScoped for better accuracy and then reverts to a larger value called SpreadNoScoped when I zoom out (leave iron sights mode).
When you play an Instant Action game or host a multiplayer game this functions absolutely correctly, but if you join a game it gets ignored (the game uses whatever Spread is set to in default properties).
I also modify the GroundSpeed of the player when you zoom in or out with the same results (fine on host, ignored on join).
At the moment the code relevant to spread changing looks like this:
This has been tried in various guises including putting "Spread(0) = SpreadScoped" in the zoom in function and "Spread(0) = SpreadNoScoped" in the zoom out function but it still only works on the host.
The speed changing code looks like this:
I also have a set of weapons which change the groundspeed of the player when you equip them, this does the exact opposite and works when you join a game but not when you host one.
The code for that looks like this:
Is it possible this is just down to my network (I'm running two PCs on a wired LAN via a router, one has ZoneAlarm on and one is just running Windows Firewall. They connect and you can play games fine but I'm not sure the firewall settings would let everything through)?
If not can anyone contribute a possible solution?
First I've got a weapon that has an iron-sights function like the Call of Duty games. When I zoom (go into iron sights mode) the weapon's Spread is set to a smaller value called SpreadScoped for better accuracy and then reverts to a larger value called SpreadNoScoped when I zoom out (leave iron sights mode).
When you play an Instant Action game or host a multiplayer game this functions absolutely correctly, but if you join a game it gets ignored (the game uses whatever Spread is set to in default properties).
I also modify the GroundSpeed of the player when you zoom in or out with the same results (fine on host, ignored on join).
At the moment the code relevant to spread changing looks like this:
Code:
/** New spread values for Scoped or Not */
var float SpreadScoped;
var float SpreadNoScoped;
simulated function rotator AddSpread(rotator BaseAim)
{
if(GetZoomedState() == ZST_NotZoomed)
{
Spread[0] = FMin(Spread[0]+0.045,0.045);
Spread[1] = FMin(Spread[1]+0.045,0.045);
}
else
{
Spread[0] = FMin(Spread[0]+0.0025,0.0025);
Spread[1] = FMin(Spread[1]+0.0025,0.0025);
}
return Super.AddSpread(BaseAim);
}
defaultproperties
{
Spread(0)=0.045
SpreadScoped=0.0025
SpreadNoScoped=0.045
}
The speed changing code looks like this:
Code:
/** Original values to revert to after zooming out */
var float BaseGroundSpeed;
var float BaseAirSpeed;
var float BaseWaterSpeed;
var float BaseJumpZ;
/** New values to switch to after zooming in */
var float ZoomGroundSpeed;
var float ZoomAirSpeed;
var float ZoomWaterSpeed;
var float ZoomJumpZ;
simulated function StartZoom(UTPlayerController PC)
{
Local Pawn P;
P = Pawn(owner);
P.GroundSpeed = Default.ZoomGroundSpeed;
P.AirSpeed = Default.ZoomAirSpeed;
P.WaterSpeed = Default.ZoomWaterSpeed;
P.JumpZ = Default.ZoomJumpZ;
ZoomCount++;
if (ZoomCount == 1 && !IsTimerActive('Gotozoom') && IsActiveWeapon() && HasAmmo(0) && Instigator.IsFirstPerson())
{
bDisplayCrosshair = false;
PlayWeaponAnimation('WeaponZoomIn',0.2);
PlayArmAnimation('WeaponZoomIn',0.2);
bAbortZoom = false;
SetTimer(0.2, false, 'Gotozoom');
SetTimer(0.2,false,'PlayMyZoomIdle');
Spread[CurrentFireMode] = Default.SpreadScoped;
MaxYawLag = Default.MaxYawLagZoom;
MaxPitchLag = Default.MaxPitchLagZoom;
}
Super.StartZoom(PC);
}
defaultproperties
{
BaseGroundSpeed=440.0
BaseAirSpeed=440.0
BaseWaterSpeed=220.0
BaseJumpZ=322.0
ZoomGroundSpeed=240.0
ZoomAirSpeed=340.0
ZoomWaterSpeed=110.0
ZoomJumpZ=256.0
}
I also have a set of weapons which change the groundspeed of the player when you equip them, this does the exact opposite and works when you join a game but not when you host one.
The code for that looks like this:
Code:
/** Absolute Ground Speed for this weapon */
var float NewGroundSpeed;
simulated function Activate()
{
Local Pawn P;
P = Pawn(owner);
P.GroundSpeed = Default.NewGroundSpeed;
super.Activate();
}
defaultproperties
{
NewGroundSpeed=280.000000
}
Is it possible this is just down to my network (I'm running two PCs on a wired LAN via a router, one has ZoneAlarm on and one is just running Windows Firewall. They connect and you can play games fine but I'm not sure the firewall settings would let everything through)?
If not can anyone contribute a possible solution?
Last edited: