LUA to Assign Points When a Unit Arrives at a Location
Posted: Fri Dec 18, 2020 5:39 pm
I want to build an Event where I assign points to a side as aircraft arrive at an airbase. Is there an easy way to do this via LUA scripting?
In my scenario, I am deploying a SAM battery to an airfield aboard an airlift of 8 C-5 Galaxy's.
I created a "Unit Remains in Area" Event Trigger for the C-5 aircraft that assigns 5 points to a non-player side whenever the aircraft has remained within the Reference Point area for a period of time. Once the side reaches 40 points (8 C-5s x 5 points each), I trigger a script that adds the SAM battery.
The problem that I am encountering is with the points trigger. It never seems to capture all of the C-5s on the airfield.
I can get to the points trigger by creating a "Unit Remains in Area" trigger for each individual aircraft, but that seems a bit unwieldy. I can get to the points trigger with only C-5M's as the Target Class for the "Unit Remains in Area" trigger if I stagger the arrivals such that only one C-5 is located within the area at a time. Again, that seems a bit unwieldy.
Can anybody suggest a method of doing this via LUA script?
In my scenario, I am deploying a SAM battery to an airfield aboard an airlift of 8 C-5 Galaxy's.
I created a "Unit Remains in Area" Event Trigger for the C-5 aircraft that assigns 5 points to a non-player side whenever the aircraft has remained within the Reference Point area for a period of time. Once the side reaches 40 points (8 C-5s x 5 points each), I trigger a script that adds the SAM battery.
The problem that I am encountering is with the points trigger. It never seems to capture all of the C-5s on the airfield.
I can get to the points trigger by creating a "Unit Remains in Area" trigger for each individual aircraft, but that seems a bit unwieldy. I can get to the points trigger with only C-5M's as the Target Class for the "Unit Remains in Area" trigger if I stagger the arrivals such that only one C-5 is located within the area at a time. Again, that seems a bit unwieldy.
Can anybody suggest a method of doing this via LUA script?