diff --git a/Wrapper/Group/100-IsAlive/GRP-100-IsAlive.lua b/Wrapper/Group/100-IsAlive/GRP-100-IsAlive.lua new file mode 100644 index 0000000..f08c210 --- /dev/null +++ b/Wrapper/Group/100-IsAlive/GRP-100-IsAlive.lua @@ -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 +) diff --git a/Wrapper/Group/100-IsAlive/GRP-100-IsAlive.miz b/Wrapper/Group/100-IsAlive/GRP-100-IsAlive.miz new file mode 100644 index 0000000..12813ea Binary files /dev/null and b/Wrapper/Group/100-IsAlive/GRP-100-IsAlive.miz differ