LUA to set points after target ID (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion



Message


AdmiralSteve -> LUA to set points after target ID (8/15/2021 6:01:56 PM)

Hello,

Is their a way (Lua or otherwise) to set points for a hostile target only after the target has been deemed hostile?

Example, a Goblin has been sighted by an ASW platform but cannot fire because of Doctrine and ROE. Once the Goblin has been ID as hostile can Lua script be used to set the points for when the now ID submarine is destroyed?

Thank you,

Steve




KnightHawk75 -> RE: LUA to set points after target ID (8/16/2021 2:52:04 PM)

Absolutely. Couple ways depending on needs, and what specifics are involved.

1. Detection based on classification level 2 or 3+ I believe will include side (and assuming side is already hostile it'll auto flag it hostile). Careful though I've found classification change detentions can skip levels or otherwise not work as expected as time, reported it long ago. Can try it though, in your action for then grab the unit via UnitX() (if needed for filtering) and the contactwrapper via UnitC() Then check the .posture state on that contact wrapper. If H you award points, if not you don't. Keep in mind though detection events even when they're working right, only fire on classification change not posture (it's just that posture can change at basically at the same time).


2. A more guaranteed but less performant way assuming it's a not just a particular unit, but class of unit, or subclass etc is do the following on a regular timer such as 15seconds or more. Pull the side wrapper for the detecting side, then grab the sides contacts pre-filtered by basic type. Sidewrapper:contactsBy("Submarine"), run through that entire list filtering for the unit or types or subtypes, classification,area ...whatever it is filters down to the underlying unit(s) you're interested in. Keep in mind to do some of that you'll want to GetUnit on each of them as you run each 'contact', you can do that via the unit guid provided by contactwrapper.actualunitid. When you find a unit that is one of the ones interested in, check the contactwrapper.posture and act accordingly. If you're only searching for a single unit and it does match remember to break; as there is no need to check the rest.

3. You could do the reverse of sorts, if you had a unit(s) list, or type of units, whatever the filtering criteria, just polling all those units say every 15seconds, checking their .ascontact entries for that match for the detecting side involved. Then grab the associated contact guid, and GetContact that contactwrapper on the detecting side, then interrogate posture on the wrapper. If H award-points, if not move on to the next or done.

4. Probably other ways depending different circumstances that could be involved.

Which I would chose would be highly dependent on the scene and what (and how many) I would be looking to constantly check. If just had a couple of specific units I was monitoring and I tested option 1 first and felt it was working reliably enough for my circumstances. Then I would use that. Now if that didn't work for my needs and say I was going to be doing it for only sub contacts, and there were not hundreds of subs in the scene then I might chose option 2. On the other hand if I wanted to do it to 4 specific aircraft, any sub of a particular list of 3 dbids, 2 specific aircraft, and 1 facility in 1800+ AU scene, I would probably use a variant of option 3. If I only cared about one or two specific subs but there were potentially a couple dozens but there were 4 sides and I'd be doing this for each side, I'd probably also just use 3 and run through a list of units (either dynamic or hardcoded via list\table stored globally).




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
2.78125