Added mission GRP-100-IsAlive

This commit is contained in:
kaltokri 2024-02-24 09:45:49 +01:00
parent c5db5f32f5
commit f2ddf2a1fe
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
---
-- Author: FlightControl
-- Created: 21.02.2017
-- Contributors: kaltokri
-- Modified: 24.02.2024
--
-- # Documentation:
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Zone.html
--
-- # Description:
--
-- In this demo mission we will show how to use the method IsAlive() on group level.
-- Two ground forces GROUPS are shooting each other (T-80 vs M2A2).
--
-- # Guide:
--
-- 1. Run the mission and check the messages.
-- 2. If a unit is dead the returned value will be nil
-- Create Spawn Groups:
local GroupBlue = GROUP:FindByName( "Blue" )
local GroupRed = GROUP:FindByName( "Red" )
local GroupObserver = GROUP:FindByName( "Observer" )
-- Start a scheduler to test every second if the groups are alive and post a status message.
local Schedule, ScheduleID = SCHEDULER:New( nil,
function( GroupBlue, GroupRed )
local IsAliveBlue = GroupBlue:IsAlive()
local IsAliveRed = GroupRed:IsAlive()
GroupObserver:MessageToAll( "IsAliveBlue=" .. tostring(IsAliveBlue) .. " ----- IsAliveRed=" .. tostring(IsAliveRed), 1 )
end, { GroupBlue, GroupRed }, 1, 1
)

Binary file not shown.