Unassigning and Reassigning AI units to missions

Post new mods and scenarios here.

Moderator: MOD_Command

Post Reply
User avatar
BHughes
Posts: 22
Joined: Tue May 12, 2020 3:23 pm

Unassigning and Reassigning AI units to missions

Post by BHughes »

Hi there - a scenario designing query.

Is there any way to have a computer-controlled unit unassigned from a mission by a given trigger to then be available to be reassigned to a different mission? Query applies to both CMO and CMNAO. I'm trying to make the AI opponents behave in a bit more sophisticated manner over a multi-day scenario where certain assets need to perform both strike and CAP missions.

And whilst I'm at it, any methods of adjusting the fuel levels of surface/subsurface units? One workaround I can think of is to let the scenario run in editor and have the ships charge around for a few days and then reposition them to start locations and times, with suitably depleted fuel levels, but I was hoping to find a less onerous way of doing it! LAU scripts?
thewood1
Posts: 10131
Joined: Sun Nov 27, 2005 6:24 pm
Location: Boston

RE: Unassigning and Reassigning AI units to missions

Post by thewood1 »

Probably should ask here:

https://www.matrixgames.com/forums/tt.asp?forumid=1681

This subforum is more for technical issues.
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Unassigning and Reassigning AI units to missions

Post by KnightHawk75 »

So on the first without LUA... idk maybe not, with Lua definitely, only a matter of what you want to do and what trigger fits what you're trying to accomplish. Post in LUA Legion area about the specifics and I'm sure you'll get pointed in the right direction.

On the second when it comes to setting ship fuel via gui, you can't.
However attached is a script, copy\paste the contents of SA_RefuelSelectedUnitsAskUser.lua into a Special Action, call it whatever you want and mark it active and repeatable, let you scenario editor environment move forward for ~1 second, the Special Action icon should appear, if was not already available.

To use, select any number of ships, grouped or not doesn't matter and then run the special action.
You will be shown the current contents of the ship's fuel stores, there can be more than 1.
Enter the type number you want to change.
Image
Enter the amount you want that type set too.
Image
..if you selected more than 1 unit it will repeat this process for each of them.
..if you hit cancel or a clearly invalid number or entry like not a number etc.. that unit will be skipped and you'll have to select it again and try again:
Image

When it's done you should get a count of how many it actually touched (ie skipped are not counted).
Image

Downsides at the moment is you can only change 1 type per unit at a time. Sorry I threw this together pretty fast.
You can also select aircraft, but if has more than 1 drop tank I skip it to avoid a problem, use the gui instead for those. I included another in the zip that refuels anything you select to max on all types, in case you need it as well, or if not no harm done.


Attachments
SA_RefuelS..sAskUser.zip
(2.56 KiB) Downloaded 16 times
User avatar
BHughes
Posts: 22
Joined: Tue May 12, 2020 3:23 pm

RE: Unassigning and Reassigning AI units to missions

Post by BHughes »

Thanks very much for the feedback, and sorry for the delay in responding! I'll be putting this to work in the next scenario!
Post Reply

Return to “Mods and Scenarios”