modded class ERR_HunterService { bool ProbePatrol(ERR_HunterVehicle unit) { vector destination, angles; bool found = OpeningPatrolPoint(unit, destination, angles); PrintFormat("ERR RADIUS PATROL: truck=%1 found=%2 homeDistance=%3 travel=%4", unit.TroopTransport, found, vector.DistanceXZ(destination, unit.PatrolHome), vector.DistanceXZ(destination, unit.Entity.GetOrigin())); return found && vector.DistanceXZ(destination, unit.PatrolHome) <= 500 && vector.DistanceXZ(destination, unit.Entity.GetOrigin()) >= 100; } } modded class ArmaReforgerScripted { protected ref ERR_HunterOpeningPlan m_RadiusPlan; protected ref ERR_HunterService m_RadiusService; protected int m_RadiusStage; protected float m_RadiusNext; override void OnUpdate(BaseWorld world, float timeslice) { super.OnUpdate(world, timeslice); ERR_GameMode mode = ERR_GameMode.Get(); if (!mode || mode.Phase() < ERR_Phase.PRISON || m_RadiusStage >= 2) return; float now = world.GetWorldTime(); if (now < m_RadiusNext) return; m_RadiusNext = now + 1000; int radius = 1000; if (m_RadiusStage == 1) radius = 1800; if (!m_RadiusPlan) m_RadiusPlan = new ERR_HunterOpeningPlan(mode.PrisonPosition(), radius); array players = {}; m_RadiusPlan.Step(players); if (!m_RadiusPlan.Done()) return; bool valid = m_RadiusPlan.Ready(); foreach (vector point : m_RadiusPlan.Positions) { bool band = ERR_HunterOpeningRules.InBand(m_RadiusPlan.Center, point, radius); valid = valid && band; PrintFormat("ERR RADIUS POSITION: target=%1 actual=%2 band=%3", radius, vector.DistanceXZ(point, m_RadiusPlan.Center), band); } if (valid) { m_RadiusService = new ERR_HunterService(mode, null); ERR_HunterVehicle unit = new ERR_HunterVehicle(); unit.PatrolHome = m_RadiusPlan.Positions[0]; unit.Entity = Vehicle.Cast(ERR_Actors.Spawn(ERR_HunterFleetRules.VehiclePrefab(0), unit.PatrolHome, m_RadiusPlan.Angles[0])); if (!unit.Entity) valid = false; else { valid = m_RadiusService.ProbePatrol(unit) && valid; unit.TroopTransport = true; valid = m_RadiusService.ProbePatrol(unit) && valid; ERR_Actors.DeleteSpawned(unit.Entity); } } PrintFormat("ERR RADIUS RESULT: radius=%1 valid=%2 positions=%3", radius, valid, m_RadiusPlan.Positions.Count()); m_RadiusStage++; m_RadiusPlan = null; if (m_RadiusStage == 2) Print("ERR RADIUS COMPLETE"); } }