Mav87th Posted March 4 Posted March 4 Hi - been having a little trouble with flags inside a moving zone, and i was not sure the zone actually moved. So after some time with Grok I actually succeded in creating this script that will draw a circle with the radius of your zone in question in the mission (if its a square zone it just draws a circle with radius 100 meters). The script will then leave the drawing for 3 seconds, delete it and then redraw it with a new center on where the unit it moves with is now. You can alter the time between the updates to what ever you like. The script is not dependent on Moose or Mist and i just run it with a Trigger (Once), Time More (5), DoScript and then paste the script below into the textbox. local zoneName = "InitZone" -- Name of the trigger zone you are examining local refreshTime = 3 -- Refresh rate in seconds local baseMarkID = 10000 -- Starting ID for markers local currentMarkID = baseMarkID -- Track the current marker ID local prevMarkID = nil -- Track the previous marker ID to remove local function UpdateMovingZone() -- Log that the function is running env.info("UpdateMovingZone called at time: " .. timer.getTime()) -- Get the zone's current position local ref = trigger.misc.getZone(zoneName) if not ref then env.info("ERROR: Zone not found: " .. zoneName) return timer.getTime() + refreshTime -- Retry after delay end -- Log zone details for debugging env.info("Zone found: " .. zoneName .. " at X: " .. ref.point.x .. ", Y: " .. ref.point.y .. ", Z: " .. ref.point.z) -- Remove the previous marker if it exists if prevMarkID then trigger.action.removeMark(prevMarkID) env.info("Removed previous marker ID: " .. prevMarkID) end -- Define the marker position (Vec3: x, y, z) local pos = ref.point -- {x, y, z} -- Create a new circle marker with a unique ID local text = "Moving Zone: " .. zoneName local radius = ref.radius or 100 -- Use zone radius or default to 100 trigger.action.circleToAll(-1, currentMarkID, pos, radius, {1, 0, 0, 0.5}, {1, 0, 0, 0.5}, 2, true, text) -- Log marker creation env.info("Marker created - ID: " .. currentMarkID .. ", Pos: X=" .. pos.x .. ", Y=" .. pos.y .. ", Z=" .. pos.z .. ", Radius=" .. radius) -- Update IDs for the next iteration prevMarkID = currentMarkID currentMarkID = currentMarkID + 1 -- Increment for the next marker -- Schedule the next update timer.scheduleFunction(UpdateMovingZone, {}, timer.getTime() + refreshTime) end -- Initial execution with a 5-second delay from mission start env.info("Scheduling Moving Zone script to start in 5 seconds") timer.scheduleFunction(UpdateMovingZone, {}, timer.getTime() + 5) 1
Recommended Posts