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:
/** 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 }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:
/** 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:
/** 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?
Edit:
I added
replication { if ( Role == ROLE_Authority ) ZoomGroundSpeed, ZoomAirSpeed, ZoomWaterSpeed, ZoomJumpZ, BaseGroundSpeed, BaseAirSpeed, BaseWaterSpeed, BaseJumpZ, SpreadScoped, SpreadNoScoped; }Which covers the things that were only working on the Host and not the Client and had no effect.
I added
replication { if ( Role == ROLE_Authority ) NewGroundSpeed; }Which covers the thing that was working on the Client and not the Host and appears to have fixed it.
Edited by Daz, 01 March 2009 - 10:51 AM.