apache85
Posts: 1631
Joined: 12/18/2014 From: Melbourne, Australia Status: offline
|
Hey guys, sorry for the delay in getting these instructions out. Now that 1115.8 is out, here is a quick guide to using the C:MO 'disable AI' Lua functionality. You will need C:MO build 1115.8 or above to do this. First we need to retrieve the unit wrapper and assign it to a variable. This example is from the Brother Against Brother standalone scenario: quote:
unit = ScenEdit_GetUnit({name='S 31 Sabalo', guid='8813afed-2d28-4f14-ae3b-3e0c6bb3f780'}) Once we have the unit wrapper assigned to a variable, we can turn on the AI evaluation of targets by setting them to true (on) or false (off). quote:
unit.AI_DeterminePrimaryTarget_enabled = false unit.AI_EvaluateTargets_enabled = false SPOILER for Brother Against Brother If you open Brother Against Brother in the editor, switch to the Venezuelan side, select the S 31 Sabalo and clear its current target by pressing Ctrl+E. Run the scenario, and note that after a couple of seconds of game time the Sabalo automatically selects the nearest appropriate target and goes 'engaged offensive'. Immediately pause the sim, delete any weapons that were fired, and again clear the target list for Sabalo by pressing Ctrl+E. Now run the code above in the console, which should look like this: quote:
local unit = ScenEdit_GetUnit({name='S 31 Sabalo', guid='8813afed-2d28-4f14-ae3b-3e0c6bb3f780'}) unit.AI_DeterminePrimaryTarget_enabled = false unit.AI_EvaluateTargets_enabled = false Observe that the Sabalo no longer goes 'Engaged Offensive', nor does it fire any weapons despite being assigned to a mission that would otherwise have it do so.
_____________________________
|