modded class ERR_CivilianTraffic { protected ref array m_ProbeCars = {}; void ProbeSpawn() { for (int index = 0; index < 3; index++) { ERR_CivilianCar traffic = new ERR_CivilianCar(); traffic.Number = index; vector position, angles; if (!ERR_SupplyConvoySystem.ApproachDirected(Vector(6500 + index * 400, 0, 3600), position, angles, 500)) { Print("ERR CIVILIAN NATIVE: no road"); continue; } traffic.Car = Vehicle.Cast(ERR_Actors.Spawn(CarPrefab(index), position, angles)); traffic.Group = SCR_AIGroup.Cast(ERR_Actors.Spawn(ERR_ConvoyResources.GroupPrefab(), position)); Faction civilian = GetGame().GetFactionManager().GetFactionByKey("CIV"); traffic.Group.SetFaction(civilian); traffic.Group.SetDeleteWhenEmpty(false); ERR_Actors.SetFaction(traffic.Car, civilian); array seats = {}; ERR_ConvoyRules.CollectSeats(traffic.Car, seats); foreach (BaseCompartmentSlot seat : seats) if (seat.GetType() == ECompartmentType.PILOT) { traffic.Seat = seat; break; } traffic.Group.SetPermanentLOD(AIAgent.GetMaxLOD()); traffic.Group.DeactivateAI(); AIGroup group = traffic.Group; if (index == 0) traffic.Driver = traffic.Seat.SpawnCharacterInCompartment(DriverPrefab(), group, ERR_ConvoyResources.GroupPrefab()); else { traffic.Driver = ERR_Actors.Spawn(DriverPrefab(), position + "2 0 0"); traffic.Group.AddAIEntityToGroup(traffic.Driver); } ERR_Actors.SetFaction(traffic.Driver, civilian); AIControlComponent control = AIControlComponent.Cast(traffic.Driver.FindComponent(AIControlComponent)); AIAgent agent = control.GetControlAIAgent(); agent.SetPermanentLOD(AIAgent.GetMaxLOD()); agent.DeactivateAI(); vector middle, destination, unused; ERR_SupplyConvoySystem.ApproachDirected(position + "250 0 250", middle, unused, 500); ERR_SupplyConvoySystem.ApproachDirected(position + "500 0 500", destination, unused, 500); traffic.Route = {position, middle, destination}; m_ProbeCars.Insert(traffic); } GetGame().GetCallqueue().CallLater(ProbePrepare, 5000, true); } void ProbePrepare() { foreach (ERR_CivilianCar traffic : m_ProbeCars) { bool ready = traffic.Ready; if (!ready) ready = Prepare(traffic); PrintFormat("ERR CIVILIAN NATIVE: car=%1 ready=%2 fit=%3 seated=%4 agents=%5 own=%6 position=%7", traffic.Number, ready, ERR_Actors.CanFight(traffic.Driver), traffic.Seat.GetOccupant() == traffic.Driver, traffic.Group.GetAgentsCount(), ERR_Actors.Group(traffic.Driver) == traffic.Group, traffic.Car.GetOrigin()); } } } modded class ArmaReforgerScripted { protected ref ERR_CivilianTraffic m_ERRCivProbe; protected float m_ERRCivProbeAge; protected bool m_ERRCivProbeDone; override void OnUpdate(BaseWorld world, float timeslice) { super.OnUpdate(world, timeslice); if (!ERR_GameMode.Get() || !ERR_GameMode.Get().EnemyFaction()) return; m_ERRCivProbeAge += timeslice; if (m_ERRCivProbeAge > 60 && !m_ERRCivProbeDone) { m_ERRCivProbeDone = true; Print("ERR CIVILIAN COMPLETE"); } if (m_ERRCivProbe || m_ERRCivProbeAge < 4) return; m_ERRCivProbe = new ERR_CivilianTraffic(ERR_GameMode.Get()); m_ERRCivProbe.ProbeSpawn(); } }