-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added mission Wrapper/Group/503-NTTR-Route-at-waypoint-to-random-point
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
...NTTR-Route-at-waypoint-to-random-point/GRP-503-NTTR-Route-at-waypoint-to-random-point.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
-- Author: FlightControl | ||
-- Created: 08.08.2017 | ||
-- Contributors: kaltokri | ||
-- Modified: 24.02.2024 | ||
-- | ||
-- # Documentation: | ||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Wrapper.Group.html | ||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html | ||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Point.html | ||
-- | ||
-- # Description: | ||
-- In this mission a vehicle drive (endless) to random zones when a waypoint has been reached. | ||
|
||
-- Create a list of all zones in the mission. | ||
local ZoneList = { | ||
ZONE:New( "ZONE1" ), | ||
ZONE:New( "ZONE2" ), | ||
ZONE:New( "ZONE3" ), | ||
ZONE:New( "ZONE4" ), | ||
ZONE:New( "ZONE5" ), | ||
} | ||
|
||
-- Get object of the APC. | ||
VehicleGroup = GROUP:FindByName( "APC" ) | ||
|
||
--- Function to ReRoute the APC to another zone. | ||
-- @param Wrapper.Group#GROUP RoutedGroup | ||
function ReRoute( VehicleGroup ) | ||
local ZoneNumber = math.random( 1, #ZoneList ) | ||
|
||
-- Write informations to the log. | ||
VehicleGroup:E( "Routing" ) | ||
VehicleGroup:E( ZoneNumber ) | ||
-- Print informations on the screen | ||
VehicleGroup:MessageToAll( "Routing to Zone" .. tostring( ZoneNumber ),30 ) | ||
|
||
-- Create Waypoints. | ||
local FromCoord = VehicleGroup:GetCoordinate() -- Core.Point#COORDINATE | ||
local FromWP = FromCoord:WaypointGround() | ||
|
||
local ZoneTo = ZoneList[ ZoneNumber ] -- Core.Zone#ZONE | ||
local ToCoord = ZoneTo:GetCoordinate() | ||
local ToWP = ToCoord:WaypointGround( 72, "Vee" ) -- Speed 72 km/h, formation Vee. | ||
|
||
-- Create a Task, which will be executed if the waypoint is reached. | ||
-- It will call this function again and because of that the APC will drive endless from one random point to antoher. | ||
local TaskReRoute = VehicleGroup:TaskFunction( "ReRoute" ) | ||
VehicleGroup:SetTaskWaypoint( ToWP, TaskReRoute ) | ||
|
||
VehicleGroup:Route( { FromWP, ToWP }, 1 ) | ||
end | ||
|
||
ReRoute( VehicleGroup ) |
Binary file added
BIN
+726 KB
...NTTR-Route-at-waypoint-to-random-point/GRP-503-NTTR-Route-at-waypoint-to-random-point.miz
Binary file not shown.