Skip to content

Commit

Permalink
Added mission GRP-100-IsAlive
Browse files Browse the repository at this point in the history
  • Loading branch information
kaltokri committed Feb 24, 2024
1 parent c5db5f3 commit f2ddf2a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Wrapper/Group/100-IsAlive/GRP-100-IsAlive.lua
Original file line number Diff line number Diff line change
@@ -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 added Wrapper/Group/100-IsAlive/GRP-100-IsAlive.miz
Binary file not shown.

0 comments on commit f2ddf2a

Please sign in to comment.