Announcement

Collapse
No announcement yet.

Headlight Replication *solved*

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Headlight Replication *solved*

    I've been trying to get working headlights on all my vehicles for my server. So far I have done it 8 different ways. The easiest was to just add a spotlight component to the vehicles weapon default properties. The light worked perfect off line but didn't work at all online. Offline I could see the light & other players headlights. I changed the code several time & finally got it working online but, I can only see my headlight on & offline. Is there anyone here that can help me resolve this problem? I'm completely stumped! Here is the code for my Falcon grav-cycle. The headlight code is highlighted in red.


    Code:
    /**
     * Copyright 2013 Rumple's Labs. All Rights Reserved.
     */
    
    class BSVehicle_GravCycleU extends UTVehicle_Manta;
    
    
    
    /** dynamic light */
    var	SpotLightComponent Headlight;
    var repnotify bool	bLightsOn;
    var repnotify bool	bLightsOff;
    
    
    replication
    {
    
    	if (Role == ROLE_Authority && bNetDirty)
    		bLightsOn, bLightsOff;
    }
    
    
    
    
    /** DriverEnter()
    Make Pawn P the new driver of this vehicle
    */
    function bool DriverEnter(Pawn P)
    {
    	if (Role == ROLE_Authority && bNetDirty)
    
    	if ( super.DriverEnter(P) )
    
    		bLightsOn=True;
    		ActivateLights();
    
    
    
    
    	return true;
    }
    
    
    /**
     * DriverLeft() called by DriverLeave() after the drive has been taken out of the vehicle
     */
    function DriverLeft()
    {
    	local float Dist;
    
    	Super.DriverLeft();
    
    	if (bNeverReset || ParentFactory == None || Occupied())
    	{
    		return;
    	}
    
    	Dist = VSize(Location - ParentFactory.Location);
    	if (Dist >= 2000 && (Dist > 5000 || !FastTrace(ParentFactory.Location, Location)))
    	{
    		ResetTime = WorldInfo.TimeSeconds + (bKeyVehicle ? 15.0 : 30.0);
    	}
    		bLightsOff = True;
    		DeactivateLights();
    }
    
    
    
    simulated event ActivateLights()
    {
    	if (Role == ROLE_Authority && bNetDirty)
    
    
    	if (VehicleEffects[16].EffectRef != none)
    	{
    		VehicleEffects[16].EffectRef.bJustAttached = TRUE;
    	}
    	VehicleEvent( 'EngineStart' );
    
    	if ( PlayerController(Controller) != None )
    	{
    		Mesh.AttachComponentToSocket(HeadLight, VehicleEffects[16].EffectSocket);
    		HeadLight.SetEnabled(TRUE);
    		bLightsOn=True;
    	}
    }
    
    
    simulated event DeactivateLights()
    {
    	if (Role == ROLE_Authority && bNetDirty)
    	{
    		HeadLight.SetEnabled(FALSE);
    		Mesh.DetachComponent(HeadLight);
    		bLightsOff = True;
    	}
    	                    VehicleEvent( 'EngineStop' );
    }
    
    
    simulated event ReplicatedEvent(name VarName)
    {
    
    	if (VarName == 'bLightsOn')
    	{
    		if ( bLightsOn )
    		{
    			ActivateLights();
    		}
    		else if (VarName == 'bLightsOff')
    		{
    			DeactivateLights();
    		}
    	}
    
    	else
    	{
    		Super.ReplicatedEvent(VarName);
    	}
    }
    
    
    
    //=============================================================================================
    //new emp code
    simulated function bool DisableVehicle()
    {
    
    
    	if ( Occupied() )
    	{
    		bIsDisabled = true;
    
    		if (Role == ROLE_Authority)
    		{
    			SetTimer(DisabledTime, false, 'EnableVehicle');
    			SetDriving(false);
    			StopFiringWeapon();
    		}
    
    
    
    
    		if (WorldInfo.NetMode != NM_DedicatedServer)
    		{
    			if (DisabledEffectComponent == None)
    			{
    				DisabledEffectComponent = new(self) class'ParticleSystemComponent';
    				DisabledEffectComponent.SetTemplate(DisabledTemplate);
    				AttachComponent(DisabledEffectComponent);
    			}
    			DisabledEffectComponent.ActivateSystem();
    		}
    		return true;
    	}
    	return false;
    }
    
    simulated function EnableVehicle()
    {
    	bIsDisabled = false;
    
    	if (WorldInfo.NetMode != NM_DedicatedServer && DisabledEffectComponent != None)
    	{
    		DetachComponent(DisabledEffectComponent);
    		DisabledEffectComponent = None;
    	}
    		if ( Controller == None )
    		{
                                                    	SetDriving(false);
    		}
                                             else
                                             {
                                                    	SetDriving(true);
                                              }
    
    }
    
    
    
    
    
    simulated event MantaJumpEffect()
    {
    	PlaySound(JumpSound, true);
    	VehicleEvent('BoostStart');
    }
    
    simulated event MantaDuckEffect()
    {
    	if (bHoldingDuck)
    	{
    		PlaySound(DuckSound, true);
    		VehicleEvent('CrushStart');
    	}
    	else
    	{
    		VehicleEvent('CrushStop');
    	}
    }
    
    simulated function SetVehicleEffectParms(name TriggerName, ParticleSystemComponent PSC)
    {
    	if (TriggerName == 'MantaOnFire')
    	{
    		PSC.SetFloatParameter('smokeamount', 0.95);
    		PSC.SetFloatParameter('fireamount', 0.95);
    	}
    	else
    	{
    		Super.SetVehicleEffectParms(TriggerName, PSC);
    	}
    }
    
    simulated event TakeDamage(int Damage, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
    {
    	// manta is fragile so it takes momentum even from weapons that don't usually impart it
    	if ( (DamageType == class'UTDmgType_Enforcer') && !IsZero(HitLocation) )
    	{
    		Momentum = (Location - HitLocation) * float(Damage) * 20.0;
    	}
    	Super.TakeDamage(Damage, EventInstigator, HitLocation, Momentum, DamageType, HitInfo, DamageCauser);
    }
    
    function bool Died(Controller Killer, class<DamageType> DamageType, vector HitLocation)
    {
    	VehicleEvent('MantaNormal');
    	return Super.Died(Killer,DamageType,HitLocation);
    }
    
    simulated function DrivingStatusChanged()
    {
    	if ( !bDriving )
    	{
    		VehicleEvent('CrushStop');
    	}
    
    	Super.DrivingStatusChanged();
    }
    
    
    
    
    defaultproperties
    {
       Begin Object Class=SpotLightComponent Name=VehLight ObjName=VehLight Archetype=SpotLightComponent'Engine.Default__SpotLightComponent'
          Radius=1536
          Brightness=3
          OuterConeAngle=34.000000
          Translation=(X=0.000000,Y=0.000000,Z=0.000000)
          LightColor=(B=255,G=255,R=255,A=0)
          bEnabled=False
          CastShadows=False
          Name="VehLight"
          ObjectArchetype=SpotLightComponent'Engine.Default__SpotLightComponent'
       End Object
       HeadLight=VehLight
    
       HornIndex=1
       HornSounds(1)=SoundCue'VH_GravCycle.Vehicle.Vehicle_Horn_SmallHuman01Cue'
       DisabledTime=5.000000
       CrushedDamageType=Class'BS_Vehicles.UTDmgType_GCPancake'
       RanOverDamageType=Class'BS_Vehicles.UTDmgType_GCRanOver'
       COMOffset=(X=-10.000000,Y=0.000000,Z=0.000000)
       JumpForceMag=7000.000000
       MaxJumpZVel=900.000000
       JumpCheckTraceDist=175.000000
       JumpDelay=3.000000
       DuckForceMag=10.000000  //0
       FullWheelSuspensionTravel=145.000000
       CrouchedWheelSuspensionTravel=100.000000  //100
       SuspensionTravelAdjustSpeed=100.000000
       FullWheelSuspensionStiffness=40.000000
       CrouchedWheelSuspensionStiffness=40.000000
       BoneOffsetZAdjust=45.000000  //45
    
       CrouchedAirSpeed=2000.000000  //1000
       CustomGravityScaling=1.000000
       FullAirSpeed=1500.000000  //1800
       GroundSpeed=1500.000000  //1300
       AirSpeed=1500.000000  //1500
    
       DrivingAnim="viper_idle_sitting"
       JumpSound=SoundCue'VH_GravCycle.Sounds.A_Vehicle_Manta_JumpCue'
       DuckSound=SoundCue'VH_GravCycle.Sounds.A_Vehicle_Manta_CrouchCue'
       FlameJetEffectParameterName="Jet"
       GroundEffectIndices(0)=12
       GroundEffectIndices(1)=13
       WaterGroundEffect=ParticleSystem'Envy_Level_Effects_2.Vehicle_Water_Effects.PS_Manta_Water_Effects'
       bHasEnemyVehicleSound=True
       Seats(0)=(GunClass=Class'BS_Vehicles.BSVWeap_PassAGC',GunSocket=("Gun_Socket_01","Gun_Socket_02"),WeaponEffects=((SocketName="Gun_Socket_01",Offset=(X=-35.000000,Y=-3.000000,Z=0.000000),Scale3D=(X=3.000000,Y=6.000000,Z=6.000000)),(SocketName="Gun_Socket_02",Offset=(X=-35.000000,Y=-3.000000,Z=0.000000),Scale3D=(X=3.000000,Y=6.000000,Z=6.000000))),TurretControls=("gun_rotate_lt","gun_rotate_rt"),CameraTag="ViewSocket",CameraBaseOffset=(X=-20.000000,Y=0.000000,Z=10.000000),CameraOffset=-180.000000,bSeatVisible=True,SeatOffset=(X=-50.000000,Y=0.000000,Z=25.000000),DriverDamageMult=0.750000,SeatIconPOS=(X=0.460000,Y=0.450000))
       Seats(1)=(GunClass=Class'BS_Vehicles.BSVWeap_PassAGCP',CameraTag="ViewSocket",CameraBaseOffset=(X=-100.000000,Y=0.000000,Z=40.000000),CameraOffset=-180.000000,bSeatVisible=True,SeatBone="Engine",SeatOffset=(X=-90.000000,Y=0.000000,Z=25.000000),SeatIconPOS=(X=0.440000,Y=0.880000))
       VehicleEffects(0)=(EffectStartTag="EngineStart",EffectEndTag="EngineStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.P_VH_Hover_Jet',EffectSocket="Wing_Lft_Socket")
       VehicleEffects(1)=(EffectStartTag="EngineStart",EffectEndTag="EngineStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.P_VH_Hover_Jet',EffectSocket="Wing_Rt_Socket")
       VehicleEffects(2)=(EffectStartTag="BoostStart",EffectEndTag="BoostStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.PS_Manta_Up_Boost_Jump',EffectSocket="Wing_Lft_Socket")
       VehicleEffects(3)=(EffectStartTag="BoostStart",EffectEndTag="BoostStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.PS_Manta_Up_Boost_Jump',EffectSocket="Wing_Rt_Socket")
       VehicleEffects(4)=(EffectStartTag="CrushStart",EffectEndTag="CrushStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.P_VH_Hover_JetB',EffectSocket="Wing_Lft_Socket")
       VehicleEffects(5)=(EffectStartTag="CrushStart",EffectEndTag="CrushStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.P_VH_Hover_JetB',EffectSocket="Wing_Rt_Socket")
       VehicleEffects(6)=(EffectStartTag="MantaWeapon01",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_Manta.Effects.PS_Manta_Gun_MuzzleFlash',EffectSocket="Gun_Socket_02")
       VehicleEffects(7)=(EffectStartTag="MantaWeapon02",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_Manta.Effects.PS_Manta_Gun_MuzzleFlash',EffectSocket="Gun_Socket_01")
       VehicleEffects(8)=(EffectStartTag="BoostStart",EffectEndTag="BoostStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.PS_Manta_Up_Boost_JumpFlash',EffectSocket="Wing_Lft_Socket")
       VehicleEffects(9)=(EffectStartTag="BoostStart",EffectEndTag="BoostStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.PS_Manta_Up_Boost_JumpFlash',EffectSocket="Wing_Rt_Socket")
       VehicleEffects(10)=(EffectStartTag="DamageSmoke",EffectEndTag="NoDamageSmoke",EffectTemplate=ParticleSystem'Envy_Effects.Vehicle_Damage.P_Vehicle_Damage_1_Manta',EffectSocket="DamageSmoke01")
       VehicleEffects(11)=(EffectStartTag="MantaOnFire",EffectEndTag="MantaNormal",bRestartRunning=True,EffectTemplate=ParticleSystem'Envy_Effects.Tests.Effects.P_Vehicle_Damage_1',EffectSocket="Gun_Socket_01")
       VehicleEffects(12)=(EffectStartTag="MantaOnFire",EffectEndTag="MantaNormal",bRestartRunning=True,EffectTemplate=ParticleSystem'Envy_Effects.Tests.Effects.P_Vehicle_Damage_1',EffectSocket="Gun_Socket_02")
       VehicleEffects(13)=(EffectStartTag="MantaOnFire",EffectEndTag="MantaNormal",bRestartRunning=True,EffectTemplate=ParticleSystem'Envy_Effects.Tests.Effects.P_Vehicle_Damage_1',EffectSocket="ExhaustPort")
       VehicleEffects(14)=(EffectStartTag="EngineStart",EffectEndTag="EngineStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Smoke.P_Hover_Ground_Dust_Blue',EffectSocket="Wing_Lft_Socket")
       VehicleEffects(15)=(EffectStartTag="EngineStart",EffectEndTag="EngineStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Smoke.P_Hover_Ground_Dust_Blue',EffectSocket="Wing_Rt_Socket")
       VehicleEffects(16)=(EffectStartTag="EngineStart",EffectEndTag="EngineStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.Headlight_B',EffectSocket="Headlights")
       DamageParamScaleLevels(0)=(DamageParamName="Damage1",Scale=1.000000)
       DamageParamScaleLevels(1)=(DamageParamName="Damage2",Scale=1.500000)
       DamageParamScaleLevels(2)=(DamageParamName="Damage3",Scale=1.500000)
    
       TeamMaterials(0)=MaterialInstanceConstant'VH_GravCycle.Materials.MI_VH_GC_Red'
       TeamMaterials(1)=MaterialInstanceConstant'VH_GravCycle.Materials.MI_VH_GC_Blue'
       BigExplosionTemplates(0)=(Template=ParticleSystem'Envy_Effects.VH_Deaths.P_VH_Death_SMALL_Far',MinDistance=350.000000)
       BigExplosionTemplates(1)=(Template=ParticleSystem'Envy_Effects.VH_Deaths.P_VH_Death_SMALL_Near')
       BigExplosionSocket="VH_Death"
       ExplosionSound=SoundCue'A_Vehicle_Manta.SoundCues.A_Vehicle_Manta_Explode'
       Begin Object Class=AudioComponent Name=BaseScrapeSound ObjName=BaseScrapeSound Archetype=AudioComponent'Engine.Default__AudioComponent'
          SoundCue=SoundCue'A_Gameplay.A_Gameplay_Onslaught_MetalScrape01Cue'
          Name="BaseScrapeSound"
          ObjectArchetype=AudioComponent'Engine.Default__AudioComponent'
       End Object
       ScrapeSound=BaseScrapeSound
       IconCoords=(U=859.000000,V=0.000000,UL=36.000000,VL=27.000000)
       SpawnMaterialLists(0)=(Materials=(MaterialInstanceConstant'VH_GravCycle.Materials.MI_VH_GC_Spawn_Red'))
       SpawnMaterialLists(1)=(Materials=(MaterialInstanceConstant'VH_GravCycle.Materials.MI_VH_GC_Spawn_Blue'))
       BurnOutMaterial(0)=MaterialInstanceTimeVarying'VH_GravCycle.Materials.MITV_VH_GC_Red_BO'
       BurnOutMaterial(1)=MaterialInstanceTimeVarying'VH_GravCycle.Materials.MITV_VH_GC_Blue_BO'
       HoverBoardAttachSockets(0)="HoverAttach00"
       EnemyVehicleSound(0)=SoundNodeWave'A_Character_Reaper.BotStatus.A_BotStatus_Reaper_EnemyManta'
       EnemyVehicleSound(1)=SoundNodeWave'A_Character_Jester.BotStatus.A_BotStatus_Jester_EnemyManta'
       HudCoords=(U=228.000000,V=143.000000,UL=-119.000000,VL=106.000000)
       Begin Object Name=SimObject ObjName=SimObject Archetype=UTVehicleSimHover'UTGame.Default__UTVehicleSimHover'
          MaxThrustForce=425.000000//325
          MaxReverseForce=250.000000
          LongDamping=0.300000
          MaxStrafeForce=260.000000
          LatDamping=0.300000
          DirectionChangeForce=375.000000
          TurnTorqueFactor=2500.000000
          TurnTorqueMax=1000.000000
          TurnDamping=0.250000
          MaxYawRate=100000.000000
          PitchTorqueFactor=300.000000  //200
          PitchTorqueMax=28.000000  //18
          PitchDamping=0.100000  //0.1
          RollTorqueTurnFactor=1200.000000  //1000
          RollTorqueStrafeFactor=210.000000  //110
          RollTorqueMax=600.000000  //500
          RollDamping=0.200000  //0.2
          MaxRandForce=20.000000
          RandForceInterval=0.400000
          WheelSuspensionStiffness=80.000000  //40
          WheelSuspensionDamping=0.800000  //0.8
          Name="SimObject"
          ObjectArchetype=UTVehicleSimHover'UTGame.Default__UTVehicleSimHover'
       End Object
       SimObj=SimObject
    
       Begin Object Name=RThruster ObjName=RThruster Archetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
          bHoverWheel=True
          SteerFactor=1.000000
          BoneName="Engine"
          BoneOffset=(X=-50.000000,Y=10.000000,Z=-120.000000)
          WheelRadius=30.000000
          SuspensionTravel=145.000000
          LongSlipFactor=0.000000
          LatSlipFactor=0.000000
          HandbrakeLongSlipFactor=0.000000
          HandbrakeLatSlipFactor=0.000000
          Name="RThruster"
          ObjectArchetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
       End Object
       Wheels(0)=RThruster
       Begin Object Name=LThruster ObjName=LThruster Archetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
          bHoverWheel=True
          SteerFactor=1.000000
          BoneName="Engine"
          BoneOffset=(X=-50.000000,Y=-10.000000,Z=-120.000000)
          WheelRadius=30.000000
          SuspensionTravel=145.000000
          LongSlipFactor=0.000000
          LatSlipFactor=0.000000
          HandbrakeLongSlipFactor=0.000000
          HandbrakeLatSlipFactor=0.000000
          Name="LThruster"
          ObjectArchetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
       End Object
       Wheels(1)=LThruster
       Begin Object Name=FThruster ObjName=FThruster Archetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
          bHoverWheel=True
          SteerFactor=1.000000
          BoneName="Engine"
          BoneOffset=(X=100.000000,Y=0.000000,Z=-120.000000)
          WheelRadius=30.000000
          SuspensionTravel=145.000000
          LongSlipFactor=0.000000
          LatSlipFactor=0.000000
          HandbrakeLongSlipFactor=0.000000
          HandbrakeLatSlipFactor=0.000000
          Name="FThruster"
          ObjectArchetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
       End Object
       Wheels(2)=FThruster
    
       Begin Object Name=MyStayUprightSetup_4 ObjName=MyStayUprightSetup_4 Archetype=RB_StayUprightSetup'UTGame.Default__UTVehicle_Manta:MyStayUprightSetup_4'
          ObjectArchetype=RB_StayUprightSetup'UTGame.Default__UTVehicle_Manta:MyStayUprightSetup_4'
       End Object
       StayUprightConstraintSetup=RB_StayUprightSetup'UTGameContent.Default__UTVehicle_Manta_Content:MyStayUprightSetup_4'
       Begin Object Name=MyStayUprightConstraintInstance_4 ObjName=MyStayUprightConstraintInstance_4 Archetype=RB_ConstraintInstance'UTGame.Default__UTVehicle_Manta:MyStayUprightConstraintInstance_4'
          ObjectArchetype=RB_ConstraintInstance'UTGame.Default__UTVehicle_Manta:MyStayUprightConstraintInstance_4'
       End Object
       StayUprightConstraintInstance=RB_ConstraintInstance'UTGameContent.Default__UTVehicle_Manta_Content:MyStayUprightConstraintInstance_4'
    
       UprightLiftStrength=30.000000  //30
       UprightTorqueStrength=30.000000  //30
       bDriverIsVisible=True
       bTurnInPlace=True
       bFollowLookDir=True
       bScriptedRise=True
       ExitRadius=140.000000
       MomentumMult=3.200000
       bCanStrafe=True
       bCanBeBaseForPawns=True
       MeleeRange=-100.000000
       BaseEyeHeight=110.000000
       EyeHeight=110.000000
       Health=300
    
       Begin Object Class=AudioComponent Name=MantaEngineSound ObjName=MantaEngineSound Archetype=AudioComponent'Engine.Default__AudioComponent'
          SoundCue=SoundCue'VH_GravCycle.SoundCues.A_Vehicle_Manta_EngineLoop'
          Name="MantaEngineSound"
          ObjectArchetype=AudioComponent'Engine.Default__AudioComponent'
       End Object
       EngineSound=MantaEngineSound
       CollisionSound=SoundCue'A_Vehicle_Manta.SoundCues.A_Vehicle_Manta_Collide'
       EnterVehicleSound=SoundCue'A_Vehicle_Manta.SoundCues.A_Vehicle_Manta_Start'
       ExitVehicleSound=SoundCue'A_Vehicle_Manta.SoundCues.A_Vehicle_Manta_Stop'
       EngineStartOffsetSecs=0.500000
       Begin Object Name=SVehicleMesh ObjName=SVehicleMesh Archetype=SkeletalMeshComponent'UTGame.Default__UTVehicle_Manta:SVehicleMesh'
          SkeletalMesh=SkeletalMesh'VH_GravCycle.Mesh.SK_VH_Manta'
          AnimTreeTemplate=AnimTree'VH_GravCycle.Anims.AT_Manta'
          PhysicsAsset=PhysicsAsset'VH_GravCycle.Mesh.SK_VH_Manta_Physics'
          //MorphSets(0)=MorphTargetSet'VH_Manta.Mesh.VH_Manta_MorphTargets'
          ObjectArchetype=SkeletalMeshComponent'UTGame.Default__UTVehicle_Manta:SVehicleMesh'
       End Object
       Mesh=SVehicleMesh
       Begin Object Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'UTGame.Default__UTVehicle_Manta:CollisionCylinder'
          CollisionHeight=40.000000
          CollisionRadius=100.000000
          Translation=(X=-40.000000,Y=0.000000,Z=40.000000)
          ObjectArchetype=CylinderComponent'UTGame.Default__UTVehicle_Manta:CollisionCylinder'
       End Object
       CylinderComponent=CollisionCylinder
       Components(0)=CollisionCylinder
       Components(1)=SVehicleMesh
       Components(2)=MyLightEnvironment
       Components(3)=SimObject
       Components(4)=MantaEngineSound
       Components(5)=BaseScrapeSound
       CollisionComponent=SVehicleMesh
       DrawScale=0.800000
       Name="Default__BSVehicle_GravCycleU"
    }

    #2
    For proper physics, you should attach the light component to a socket of the skeletal mesh no matter if the light should be enabled or not.
    Code:
    simulated function PostBeginPlay()
    {
        super.PostBeginPlay();
        Mesh.AttachComponentToSocket(HeadLight, 'Headlights');
    }
    The light switching can be done completely clientsided
    Code:
    // DrivingStatusChanged is called when bDriving is replicated.
    // This will also start several Particle effects and engine sounds
    //
    // In this case, we use it to re-enable or disable the light
    simulated function DrivingStatusChanged()
    {
        super.DrivingStatusChanged();
    
        SetHeadLights(bDriving && !bIsDisabled);
    }
    
    simulated function SetHeadLights(bool bOn)
    {
        HeadLight.SetEnabled(bOn);
    }

    Comment


      #3
      Thanks! I just did that same thing a few minutes ago. I'm uploading so I can test now! Cross your fingers!

      Comment


        #4
        My code was slightly different than yours & it worked online but the lights wouldn't shut off. I tried your code & it works offline perfectly. As soon as my server is empty I'll upload it & give it a try. Thanks mang!

        Comment


          #5
          WORKS PERFECTLY! Thanks again mang!

          Comment


            #6
            Good. But there is one thing. The spotlight is not added to the compoments array so the headlight might be garbage collected. The defaultporperties code is also exported and should be stripped from these additional stuff.

            Red=Remove
            Green=Add

            Code:
            defaultproperties
            {
               Begin Object Class=SpotLightComponent Name=VehLight ObjName=VehLight Archetype=SpotLightComponent'Engine.Default__SpotLightComponent'
                  Radius=1536
                  Brightness=3
                  OuterConeAngle=34.000000
                  Translation=(X=0.000000,Y=0.000000,Z=0.000000)
                  LightColor=(B=255,G=255,R=255,A=0)
                  bEnabled=False
                  CastShadows=False
                  Name="VehLight"
                  ObjectArchetype=SpotLightComponent'Engine.Default__SpotLightComponent'
               End Object
               HeadLight=VehLight
               Components.Add(VehLight)
            
               HornIndex=1
               HornSounds(1)=SoundCue'VH_GravCycle.Vehicle.Vehicle_Horn_SmallHuman01Cue'
               DisabledTime=5.000000
               CrushedDamageType=Class'BS_Vehicles.UTDmgType_GCPancake'
               RanOverDamageType=Class'BS_Vehicles.UTDmgType_GCRanOver'
               COMOffset=(X=-10.000000,Y=0.000000,Z=0.000000)
               JumpForceMag=7000.000000
               MaxJumpZVel=900.000000
               JumpCheckTraceDist=175.000000
               JumpDelay=3.000000
               DuckForceMag=10.000000  //0
               FullWheelSuspensionTravel=145.000000
               CrouchedWheelSuspensionTravel=100.000000  //100
               SuspensionTravelAdjustSpeed=100.000000
               FullWheelSuspensionStiffness=40.000000
               CrouchedWheelSuspensionStiffness=40.000000
               BoneOffsetZAdjust=45.000000  //45
            
               CrouchedAirSpeed=2000.000000  //1000
               CustomGravityScaling=1.000000
               FullAirSpeed=1500.000000  //1800
               GroundSpeed=1500.000000  //1300
               AirSpeed=1500.000000  //1500
            
               DrivingAnim="viper_idle_sitting"
               JumpSound=SoundCue'VH_GravCycle.Sounds.A_Vehicle_Manta_JumpCue'
               DuckSound=SoundCue'VH_GravCycle.Sounds.A_Vehicle_Manta_CrouchCue'
               FlameJetEffectParameterName="Jet"
               GroundEffectIndices(0)=12
               GroundEffectIndices(1)=13
               WaterGroundEffect=ParticleSystem'Envy_Level_Effects_2.Vehicle_Water_Effects.PS_Manta_Water_Effects'
               bHasEnemyVehicleSound=True
               Seats(0)=(GunClass=Class'BS_Vehicles.BSVWeap_PassAGC',GunSocket=("Gun_Socket_01","Gun_Socket_02"),WeaponEffects=((SocketName="Gun_Socket_01",Offset=(X=-35.000000,Y=-3.000000,Z=0.000000),Scale3D=(X=3.000000,Y=6.000000,Z=6.000000)),(SocketName="Gun_Socket_02",Offset=(X=-35.000000,Y=-3.000000,Z=0.000000),Scale3D=(X=3.000000,Y=6.000000,Z=6.000000))),TurretControls=("gun_rotate_lt","gun_rotate_rt"),CameraTag="ViewSocket",CameraBaseOffset=(X=-20.000000,Y=0.000000,Z=10.000000),CameraOffset=-180.000000,bSeatVisible=True,SeatOffset=(X=-50.000000,Y=0.000000,Z=25.000000),DriverDamageMult=0.750000,SeatIconPOS=(X=0.460000,Y=0.450000))
               Seats(1)=(GunClass=Class'BS_Vehicles.BSVWeap_PassAGCP',CameraTag="ViewSocket",CameraBaseOffset=(X=-100.000000,Y=0.000000,Z=40.000000),CameraOffset=-180.000000,bSeatVisible=True,SeatBone="Engine",SeatOffset=(X=-90.000000,Y=0.000000,Z=25.000000),SeatIconPOS=(X=0.440000,Y=0.880000))
               VehicleEffects(0)=(EffectStartTag="EngineStart",EffectEndTag="EngineStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.P_VH_Hover_Jet',EffectSocket="Wing_Lft_Socket")
               VehicleEffects(1)=(EffectStartTag="EngineStart",EffectEndTag="EngineStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.P_VH_Hover_Jet',EffectSocket="Wing_Rt_Socket")
               VehicleEffects(2)=(EffectStartTag="BoostStart",EffectEndTag="BoostStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.PS_Manta_Up_Boost_Jump',EffectSocket="Wing_Lft_Socket")
               VehicleEffects(3)=(EffectStartTag="BoostStart",EffectEndTag="BoostStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.PS_Manta_Up_Boost_Jump',EffectSocket="Wing_Rt_Socket")
               VehicleEffects(4)=(EffectStartTag="CrushStart",EffectEndTag="CrushStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.P_VH_Hover_JetB',EffectSocket="Wing_Lft_Socket")
               VehicleEffects(5)=(EffectStartTag="CrushStart",EffectEndTag="CrushStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.P_VH_Hover_JetB',EffectSocket="Wing_Rt_Socket")
               VehicleEffects(6)=(EffectStartTag="MantaWeapon01",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_Manta.Effects.PS_Manta_Gun_MuzzleFlash',EffectSocket="Gun_Socket_02")
               VehicleEffects(7)=(EffectStartTag="MantaWeapon02",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_Manta.Effects.PS_Manta_Gun_MuzzleFlash',EffectSocket="Gun_Socket_01")
               VehicleEffects(8)=(EffectStartTag="BoostStart",EffectEndTag="BoostStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.PS_Manta_Up_Boost_JumpFlash',EffectSocket="Wing_Lft_Socket")
               VehicleEffects(9)=(EffectStartTag="BoostStart",EffectEndTag="BoostStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.PS_Manta_Up_Boost_JumpFlash',EffectSocket="Wing_Rt_Socket")
               VehicleEffects(10)=(EffectStartTag="DamageSmoke",EffectEndTag="NoDamageSmoke",EffectTemplate=ParticleSystem'Envy_Effects.Vehicle_Damage.P_Vehicle_Damage_1_Manta',EffectSocket="DamageSmoke01")
               VehicleEffects(11)=(EffectStartTag="MantaOnFire",EffectEndTag="MantaNormal",bRestartRunning=True,EffectTemplate=ParticleSystem'Envy_Effects.Tests.Effects.P_Vehicle_Damage_1',EffectSocket="Gun_Socket_01")
               VehicleEffects(12)=(EffectStartTag="MantaOnFire",EffectEndTag="MantaNormal",bRestartRunning=True,EffectTemplate=ParticleSystem'Envy_Effects.Tests.Effects.P_Vehicle_Damage_1',EffectSocket="Gun_Socket_02")
               VehicleEffects(13)=(EffectStartTag="MantaOnFire",EffectEndTag="MantaNormal",bRestartRunning=True,EffectTemplate=ParticleSystem'Envy_Effects.Tests.Effects.P_Vehicle_Damage_1',EffectSocket="ExhaustPort")
               VehicleEffects(14)=(EffectStartTag="EngineStart",EffectEndTag="EngineStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Smoke.P_Hover_Ground_Dust_Blue',EffectSocket="Wing_Lft_Socket")
               VehicleEffects(15)=(EffectStartTag="EngineStart",EffectEndTag="EngineStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Smoke.P_Hover_Ground_Dust_Blue',EffectSocket="Wing_Rt_Socket")
               VehicleEffects(16)=(EffectStartTag="EngineStart",EffectEndTag="EngineStop",bRestartRunning=True,EffectTemplate=ParticleSystem'VH_GravCycle.Effects.Headlight_B',EffectSocket="Headlights")
               DamageParamScaleLevels(0)=(DamageParamName="Damage1",Scale=1.000000)
               DamageParamScaleLevels(1)=(DamageParamName="Damage2",Scale=1.500000)
               DamageParamScaleLevels(2)=(DamageParamName="Damage3",Scale=1.500000)
            
               TeamMaterials(0)=MaterialInstanceConstant'VH_GravCycle.Materials.MI_VH_GC_Red'
               TeamMaterials(1)=MaterialInstanceConstant'VH_GravCycle.Materials.MI_VH_GC_Blue'
               BigExplosionTemplates(0)=(Template=ParticleSystem'Envy_Effects.VH_Deaths.P_VH_Death_SMALL_Far',MinDistance=350.000000)
               BigExplosionTemplates(1)=(Template=ParticleSystem'Envy_Effects.VH_Deaths.P_VH_Death_SMALL_Near')
               BigExplosionSocket="VH_Death"
               ExplosionSound=SoundCue'A_Vehicle_Manta.SoundCues.A_Vehicle_Manta_Explode'
               Begin Object Class=AudioComponent Name=BaseScrapeSound ObjName=BaseScrapeSound Archetype=AudioComponent'Engine.Default__AudioComponent'
                  SoundCue=SoundCue'A_Gameplay.A_Gameplay_Onslaught_MetalScrape01Cue'
                  Name="BaseScrapeSound"
                  ObjectArchetype=AudioComponent'Engine.Default__AudioComponent'
               End Object
               ScrapeSound=BaseScrapeSound
               Components.Add(BaseScrapeSound)
            
               IconCoords=(U=859.000000,V=0.000000,UL=36.000000,VL=27.000000)
               SpawnMaterialLists(0)=(Materials=(MaterialInstanceConstant'VH_GravCycle.Materials.MI_VH_GC_Spawn_Red'))
               SpawnMaterialLists(1)=(Materials=(MaterialInstanceConstant'VH_GravCycle.Materials.MI_VH_GC_Spawn_Blue'))
               BurnOutMaterial(0)=MaterialInstanceTimeVarying'VH_GravCycle.Materials.MITV_VH_GC_Red_BO'
               BurnOutMaterial(1)=MaterialInstanceTimeVarying'VH_GravCycle.Materials.MITV_VH_GC_Blue_BO'
               HoverBoardAttachSockets(0)="HoverAttach00"
               EnemyVehicleSound(0)=SoundNodeWave'A_Character_Reaper.BotStatus.A_BotStatus_Reaper_EnemyManta'
               EnemyVehicleSound(1)=SoundNodeWave'A_Character_Jester.BotStatus.A_BotStatus_Jester_EnemyManta'
               HudCoords=(U=228.000000,V=143.000000,UL=-119.000000,VL=106.000000)
               Begin Object Name=SimObject ObjName=SimObject Archetype=UTVehicleSimHover'UTGame.Default__UTVehicleSimHover'
                  MaxThrustForce=425.000000//325
                  MaxReverseForce=250.000000
                  LongDamping=0.300000
                  MaxStrafeForce=260.000000
                  LatDamping=0.300000
                  DirectionChangeForce=375.000000
                  TurnTorqueFactor=2500.000000
                  TurnTorqueMax=1000.000000
                  TurnDamping=0.250000
                  MaxYawRate=100000.000000
                  PitchTorqueFactor=300.000000  //200
                  PitchTorqueMax=28.000000  //18
                  PitchDamping=0.100000  //0.1
                  RollTorqueTurnFactor=1200.000000  //1000
                  RollTorqueStrafeFactor=210.000000  //110
                  RollTorqueMax=600.000000  //500
                  RollDamping=0.200000  //0.2
                  MaxRandForce=20.000000
                  RandForceInterval=0.400000
                  WheelSuspensionStiffness=80.000000  //40
                  WheelSuspensionDamping=0.800000  //0.8
                  Name="SimObject"
                  ObjectArchetype=UTVehicleSimHover'UTGame.Default__UTVehicleSimHover'
               End Object
               SimObj=SimObject
            
               Begin Object Name=RThruster ObjName=RThruster Archetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
                  bHoverWheel=True
                  SteerFactor=1.000000
                  BoneName="Engine"
                  BoneOffset=(X=-50.000000,Y=10.000000,Z=-120.000000)
                  WheelRadius=30.000000
                  SuspensionTravel=145.000000
                  LongSlipFactor=0.000000
                  LatSlipFactor=0.000000
                  HandbrakeLongSlipFactor=0.000000
                  HandbrakeLatSlipFactor=0.000000
                  Name="RThruster"
                  ObjectArchetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
               End Object
               Wheels(0)=RThruster
               Begin Object Name=LThruster ObjName=LThruster Archetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
                  bHoverWheel=True
                  SteerFactor=1.000000
                  BoneName="Engine"
                  BoneOffset=(X=-50.000000,Y=-10.000000,Z=-120.000000)
                  WheelRadius=30.000000
                  SuspensionTravel=145.000000
                  LongSlipFactor=0.000000
                  LatSlipFactor=0.000000
                  HandbrakeLongSlipFactor=0.000000
                  HandbrakeLatSlipFactor=0.000000
                  Name="LThruster"
                  ObjectArchetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
               End Object
               Wheels(1)=LThruster
               Begin Object Name=FThruster ObjName=FThruster Archetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
                  bHoverWheel=True
                  SteerFactor=1.000000
                  BoneName="Engine"
                  BoneOffset=(X=100.000000,Y=0.000000,Z=-120.000000)
                  WheelRadius=30.000000
                  SuspensionTravel=145.000000
                  LongSlipFactor=0.000000
                  LatSlipFactor=0.000000
                  HandbrakeLongSlipFactor=0.000000
                  HandbrakeLatSlipFactor=0.000000
                  Name="FThruster"
                  ObjectArchetype=UTHoverWheel'UTGame.Default__UTHoverWheel'
               End Object
               Wheels(2)=FThruster
            
               Begin Object Name=MyStayUprightSetup_4 ObjName=MyStayUprightSetup_4 Archetype=RB_StayUprightSetup'UTGame.Default__UTVehicle_Manta:MyStayUprightSetup_4'
                  ObjectArchetype=RB_StayUprightSetup'UTGame.Default__UTVehicle_Manta:MyStayUprightSetup_4'
               End Object
               StayUprightConstraintSetup=RB_StayUprightSetup'UTGameContent.Default__UTVehicle_Manta_Content:MyStayUprightSetup_4'
               Begin Object Name=MyStayUprightConstraintInstance_4 ObjName=MyStayUprightConstraintInstance_4 Archetype=RB_ConstraintInstance'UTGame.Default__UTVehicle_Manta:MyStayUprightConstraintInstance_4'
                  ObjectArchetype=RB_ConstraintInstance'UTGame.Default__UTVehicle_Manta:MyStayUprightConstraintInstance_4'
               End Object
               StayUprightConstraintInstance=RB_ConstraintInstance'UTGameContent.Default__UTVehicle_Manta_Content:MyStayUprightConstraintInstance_4'
            
               UprightLiftStrength=30.000000  //30
               UprightTorqueStrength=30.000000  //30
               bDriverIsVisible=True
               bTurnInPlace=True
               bFollowLookDir=True
               bScriptedRise=True
               ExitRadius=140.000000
               MomentumMult=3.200000
               bCanStrafe=True
               bCanBeBaseForPawns=True
               MeleeRange=-100.000000
               BaseEyeHeight=110.000000
               EyeHeight=110.000000
               Health=300
            
               Begin Object Class=AudioComponent Name=MantaEngineSound ObjName=MantaEngineSound Archetype=AudioComponent'Engine.Default__AudioComponent'
                  SoundCue=SoundCue'VH_GravCycle.SoundCues.A_Vehicle_Manta_EngineLoop'
                  Name="MantaEngineSound"
                  ObjectArchetype=AudioComponent'Engine.Default__AudioComponent'
               End Object
               EngineSound=MantaEngineSound
               Components.Add(MantaEngineSound)
            
               CollisionSound=SoundCue'A_Vehicle_Manta.SoundCues.A_Vehicle_Manta_Collide'
               EnterVehicleSound=SoundCue'A_Vehicle_Manta.SoundCues.A_Vehicle_Manta_Start'
               ExitVehicleSound=SoundCue'A_Vehicle_Manta.SoundCues.A_Vehicle_Manta_Stop'
               EngineStartOffsetSecs=0.500000
               Begin Object Name=SVehicleMesh ObjName=SVehicleMesh Archetype=SkeletalMeshComponent'UTGame.Default__UTVehicle_Manta:SVehicleMesh'
                  SkeletalMesh=SkeletalMesh'VH_GravCycle.Mesh.SK_VH_Manta'
                  AnimTreeTemplate=AnimTree'VH_GravCycle.Anims.AT_Manta'
                  PhysicsAsset=PhysicsAsset'VH_GravCycle.Mesh.SK_VH_Manta_Physics'
                  //MorphSets(0)=MorphTargetSet'VH_Manta.Mesh.VH_Manta_MorphTargets'
                  ObjectArchetype=SkeletalMeshComponent'UTGame.Default__UTVehicle_Manta:SVehicleMesh'
               End Object
               Mesh=SVehicleMesh
               Begin Object Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'UTGame.Default__UTVehicle_Manta:CollisionCylinder'
                  CollisionHeight=40.000000
                  CollisionRadius=100.000000
                  Translation=(X=-40.000000,Y=0.000000,Z=40.000000)
                  ObjectArchetype=CylinderComponent'UTGame.Default__UTVehicle_Manta:CollisionCylinder'
               End Object
               CylinderComponent=CollisionCylinder
               Components(0)=CollisionCylinder
               Components(1)=SVehicleMesh
               Components(2)=MyLightEnvironment
               Components(3)=SimObject
               Components(4)=MantaEngineSound
               Components(5)=BaseScrapeSound
               CollisionComponent=SVehicleMesh
               DrawScale=0.800000
               Name="Default__BSVehicle_GravCycleU"
            }
            The assigment of "Components(?)=" is actually a bad way as you might have to fix the index once you change the components. This assigment syntax comes from the exported source code. It also contains the components of the parent class. You don't need to reassign or re-add these components as they are already referenced and added to the components array in the parent classes.

            There could be some duplicated lines from the parent class as well (like UTVehicle_Manta). But I didn't check these. A exported code contains the full properties of the class (not only the ones which are changed based on the parent class).

            Comment


              #7
              It works online the way it is with NO LAG! I was actually surprised that I saw NO performance drops with the lights. I was just going to get on & play for a bit but the janitor at Epic must have tripped over the extension cord to the master server & unplugged it. I told them the janitors closet was a bad place for it!

              Comment

              Working...
              X