Kitchens Sink -> Lua Script Question: Changing Weapons Doctrine based on Distance to enemy unit (2/11/2017 11:07:47 PM)
|
Hope some Lua gurus can help me. I'm trying to change the Weapons Doctrine of a friendly Task Force from "Surface Weapons Hold" to "Surface Weapons Free", but only when a particular enemy surface vessel (part of an enemy Task Force) is within a certain distance from my TF (or a unit of my TF). I know that if the enemy unit is within 100nm, then his whole TF is within range and I can unload a large Anti-ship missile salvo at all the ships at one time, not shoot piecemeal as they come into range. I know how to do the Weapons Doctrine change, but I am not sure how to set up the trigger or condition. What I have come up with so far is: Trigger: Enemy "Unit A" is detected Condition: ?? Action: ScenEdit_SetDoctrine({side="Me", mission="My TF Sea Control"}, {weapon_control_status_surface="0"}) So, how do I set up the Condition that enemy Unit A has to be within 100nm before the Doctrine is changed? Both TF's are moving, so I don't want to use Unit Enters Area because that could vary. Also changing the WRA missile firing distance wouldn't do what I want. Thanks for any help!
|
|
|
|