I'm trying to do the Strike Planner Tutorial "Pealing [sic] the Onion" using missions, the operations planner, phases, and triggers involving Lua.
I am trying to use Lua to determine if two targets have been destroyed. I have based it upon the "Unit(s) destroyed" template included in the operations planner's script editor. I've been trying to extrapolate it from one unit being destroyed to BOTH units needing to be destroyed before the mission is marked as satisfied.
However, the mission immediately gets marked as satisfied before it even takes off. If I manually set the mission to "Waiting for Trigger" it set's it back to "Satisfied" after a short while.
If it matters, the mission also has a Trigger To Start Mission of H-hour plus 5 minutes.
Here is the script I have hacked together. What have I done wrong?
(Mission save attached if interested or needed)
Code: Select all
--TEXT BETWEEN # SHOULD BE REPLACED WITH PROPER VALUES
local Unit = ScenEdit_GetUnit({ guid= '5bb05762-0c60-4fe6-be8c-5a31dd2b137d'})
local Unit2 = ScenEdit_GetUnit({ guid= 'f09627b2-7da3-4662-bd8d-e0d9d932eaf0'})
-- or use : local Unit = ScenEdit_GetUnit({ side='#UNIT'S SIDE#', unitname='#UNIT'S NAME#'})
return ((Unit == nil or Unit.IsDestroyed) and (Unit2 == nil or Unit2.IsDestroyed))