Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Units not in a zone trigger

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Units not in a zone trigger Page: [1]
Login
Message << Older Topic   Newer Topic >>
Units not in a zone trigger - 2/17/2018 7:44:43 PM   
vettim89


Posts: 3507
Joined: 7/14/2007
From: Toledo, Ohio
Status: online
A scenario I am designing involves a hostage rescue. I am trying to figure out a code that will only allow an event if a particular zone is free of OPFOR units.

A SpecOps unit has infiltrated the area where the hostages were being held and neutralized the captors. However, there are other OPFOR units nearby that can interfere with the extraction. Follow on friendly forces are assigned to destroy all OPFOR units in the area before the extraction helo is sent in to pick up the hostages. Basically I want the event to only trigger if the LZ is clear of enemy units. How could I do this?

Second I want an event to end the scenario once the hostages and all friendly units have been exfiltrated, i.e no friendly units left in the AO. Is there a way to trigger this?

Thanks as always for the help

_____________________________

"We have met the enemy and they are ours" - Commodore O.H. Perry
Post #: 1
RE: Units not in a zone trigger - 2/17/2018 8:04:15 PM   
michaelm75au


Posts: 12495
Joined: 5/5/2001
From: Sydney, Australia
Status: offline
Basically for the first, it should be an event on a time or 'unit remains in area' trigger with a condition of no units in the area (there is an inArea() method for unit/contact), and probably should be inactive until some primary event happens as the SpecOps eliminating the captors.
Once I wake up, I'll add some code if no-one else beats me to it.

_____________________________

Michael

(in reply to vettim89)
Post #: 2
RE: Units not in a zone trigger - 2/17/2018 9:23:34 PM   
michaelm75au


Posts: 12495
Joined: 5/5/2001
From: Sydney, Australia
Status: offline
Event condition to check if a area is free of units from a side.
--------------------------------
-- condition assumed to pass. look for cases where not true
local AOclear = true
-- AO area
local area = {'rp-6074','rp-6075','rp-6076','rp-6077'}
-- get units on a side
local side = VP_GetSide({side='china'})
-- side's unit list print(side.units)
-- process the list
for key,value in pairs(side.units)
do
-- get the unit details
local unit = ScenEdit_GetUnit({guid=value.guid})
-- check if unit in the area
if unit:inArea( area ) == true then
-- yes, then condition not true
AOclear = false ; print('AO not clear')
break
end
end
-- return the status
return AOclear

_____________________________

Michael

(in reply to michaelm75au)
Post #: 3
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Units not in a zone trigger Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.242