Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Shooter side

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Shooter side Page: [1]
Login
Message << Older Topic   Newer Topic >>
Shooter side - 11/13/2021 7:05:02 AM   
nukkxx5058


Posts: 2903
Joined: 2/3/2005
From: France
Status: offline
Hi, when a civilian/neutral unit is destroyed (trigger= unit destroyed) I want to create an Action to negatively impact the shooter's side score. I know how to get info about the triggering unit (ie the destroyed civilian unit in my example) with ScenEditUnitX() but how do I get the same unit wrapper for the shooter so that I can determine the side of the shooter and apply the penalty ?
Thx

< Message edited by nukkxx5058 -- 11/13/2021 9:08:39 AM >
Post #: 1
RE: Shooter side - 11/13/2021 8:59:54 PM   
KnightHawk75

 

Posts: 1412
Joined: 11/15/2018
Status: online
Since there is no UnitY for Unit-Destroyed, you may have to track it by grabbing UnitY on Unit-Damaged trigger > XX (such as 99), where UnitY does exist and you can pull the side from that munition unit which in vast majority of cases should be the side you need. I suppose you might run into some edge cases if multiple sides munitions are impacting at exactly the same time for the final blow for a unit, but that should be pretty rare i think. Other edges would be a munition damaging a ship unit to something like 96%, sets it ablaze and flooding and it sinks a few minutes later, then there is less of a direct correlation between last munition impact and the actual destruction, unless you are independently tracking last impacts for units one cares about, and firing off a check on destruction for who last hit it (can be done).




< Message edited by KnightHawk75 -- 11/13/2021 9:00:23 PM >

(in reply to nukkxx5058)
Post #: 2
RE: Shooter side - 11/13/2021 9:34:08 PM   
nukkxx5058


Posts: 2903
Joined: 2/3/2005
From: France
Status: offline
Ok. I found the way. I didn't realise that this was dependent on the side I'm switched on. Problem solved.

*EDIT: oops I thought I found the way but won't work ... :-(


< Message edited by nukkxx5058 -- 11/13/2021 9:52:28 PM >

(in reply to nukkxx5058)
Post #: 3
RE: Shooter side - 11/13/2021 9:55:16 PM   
nukkxx5058


Posts: 2903
Joined: 2/3/2005
From: France
Status: offline

quote:

ORIGINAL: KnightHawk75

Since there is no UnitY for Unit-Destroyed, you may have to track it by grabbing UnitY on Unit-Damaged trigger > XX (such as 99), where UnitY does exist and you can pull the side from that munition unit which in vast majority of cases should be the side you need. I suppose you might run into some edge cases if multiple sides munitions are impacting at exactly the same time for the final blow for a unit, but that should be pretty rare i think. Other edges would be a munition damaging a ship unit to something like 96%, sets it ablaze and flooding and it sinks a few minutes later, then there is less of a direct correlation between last munition impact and the actual destruction, unless you are independently tracking last impacts for units one cares about, and firing off a check on destruction for who last hit it (can be done).





Thanks. Will require some thinking ...

(in reply to KnightHawk75)
Post #: 4
RE: Shooter side - 11/15/2021 7:17:07 AM   
nukkxx5058


Posts: 2903
Joined: 2/3/2005
From: France
Status: offline

quote:

ORIGINAL: KnightHawk75

Since there is no UnitY for Unit-Destroyed, you may have to track it by grabbing UnitY on Unit-Damaged trigger > XX (such as 99), where UnitY does exist and you can pull the side from that munition unit which in vast majority of cases should be the side you need. I suppose you might run into some edge cases if multiple sides munitions are impacting at exactly the same time for the final blow for a unit, but that should be pretty rare i think. Other edges would be a munition damaging a ship unit to something like 96%, sets it ablaze and flooding and it sinks a few minutes later, then there is less of a direct correlation between last munition impact and the actual destruction, unless you are independently tracking last impacts for units one cares about, and firing off a check on destruction for who last hit it (can be done).





So you are right, this seems to be the solution ! Took me a while to figure out because I'm a total beginner with events and lua. I haven't had it work yet but I think I will. But I already can get the shooter's side with your method. In fact, I wanted to give a huge penalty for destroying a civilian unit but just causing damage (e.g. > 5%) to a civilian unit should be enough to get the penalty (i.e. shooting at it without necessarly killing it).

Brilliant ! Thanks

(in reply to KnightHawk75)
Post #: 5
RE: Shooter side - 11/15/2021 8:24:32 PM   
nukkxx5058


Posts: 2903
Joined: 2/3/2005
From: France
Status: offline
So I think it works. Hope there's no bug ...
But I didn't have to use the "unit damaged" trigger


Attachment (1)

< Message edited by nukkxx5058 -- 11/15/2021 8:43:49 PM >

(in reply to nukkxx5058)
Post #: 6
RE: Shooter side - 11/15/2021 9:37:16 PM   
musurca

 

Posts: 114
Joined: 7/16/2020
Status: online
quote:

Since there is no UnitY for Unit-Destroyed,


They actually changed this sometime earlier this year, and now there is a reliable UnitY, which returns the weapon that killed the unit (and includes things like unguided projectiles not usually tracked as units). I make use of it in the PBEM mod to track kills for the off-turn.

On a Unit-Destroyed trigger, you should be able to do something like this in a script:

local killed = ScenEdit_UnitX()
local killer = ScenEdit_UnitY()
if killer then
if killer.unit then
print("Killed by "..killer.unit.side)
end
end

(in reply to KnightHawk75)
Post #: 7
RE: Shooter side - 11/16/2021 12:20:17 AM   
KnightHawk75

 

Posts: 1412
Joined: 11/15/2018
Status: online
quote:

ORIGINAL: musurca

quote:

Since there is no UnitY for Unit-Destroyed,


They actually changed this sometime earlier this year, and now there is a reliable UnitY, which returns the weapon that killed the unit (and includes things like unguided projectiles not usually tracked as units). I make use of it in the PBEM mod to track kills for the off-turn.

On a Unit-Destroyed trigger, you should be able to do something like this in a script:

local killed = ScenEdit_UnitX()
local killer = ScenEdit_UnitY()
if killer then
if killer.unit then
print("Killed by "..killer.unit.side)
end
end


Interesting cause I tried tested UnitY before posting that in 1147.32 (non-pro) on a Destroyed unit and it came up nil on Unit-Destroyed in my test (and showed the weapon on Unit-Damaged), I'll try it some more (maybe I fubar'd something in my test- are there cases where it can still be nil? like delayed sinkings etc?), if so it's a great change and thank you for alerting me, as it's by far the simple and easy answer.



< Message edited by KnightHawk75 -- 11/16/2021 12:22:45 AM >

(in reply to musurca)
Post #: 8
RE: Shooter side - 11/16/2021 5:54:18 AM   
nukkxx5058


Posts: 2903
Joined: 2/3/2005
From: France
Status: offline
quote:

ORIGINAL: musurca

quote:

Since there is no UnitY for Unit-Destroyed,


They actually changed this sometime earlier this year, and now there is a reliable UnitY, which returns the weapon that killed the unit (and includes things like unguided projectiles not usually tracked as units). I make use of it in the PBEM mod to track kills for the off-turn.

On a Unit-Destroyed trigger, you should be able to do something like this in a script:

local killed = ScenEdit_UnitX()
local killer = ScenEdit_UnitY()
if killer then
if killer.unit then
print("Killed by "..killer.unit.side)
end
end


Ok, this is why I didn't have to use the damaged unit trigger ! unitY worked in my code (see save above). I defacto used the same code as proposed by musurca. Good to know !

< Message edited by nukkxx5058 -- 11/16/2021 5:59:52 AM >

(in reply to musurca)
Post #: 9
RE: Shooter side - 11/17/2021 2:20:21 PM   
KnightHawk75

 

Posts: 1412
Joined: 11/15/2018
Status: online
Just fyi UnitY is always nil for certain surface ships when destroyed. (Testing with with a 'Light Amphibious Warship' or old 11m RHIB)
Does seem to works for:
Aircraft (all i tried)
Buoy's (hmm.. guess it has to do with subtype?)
Subs (couple of subs units I tried)
Land facilities (cars, and other typical structures)

I'll post this as a bug in tech support later today.



< Message edited by KnightHawk75 -- 11/17/2021 2:27:29 PM >

(in reply to nukkxx5058)
Post #: 10
RE: Shooter side - 11/17/2021 8:23:50 PM   
nukkxx5058


Posts: 2903
Joined: 2/3/2005
From: France
Status: offline

quote:

ORIGINAL: KnightHawk75

Just fyi UnitY is always nil for certain surface ships when destroyed. (Testing with with a 'Light Amphibious Warship' or old 11m RHIB)
Does seem to works for:
Aircraft (all i tried)
Buoy's (hmm.. guess it has to do with subtype?)
Subs (couple of subs units I tried)
Land facilities (cars, and other typical structures)

I'll post this as a bug in tech support later today.




Good to know, thanks.

(in reply to KnightHawk75)
Post #: 11
RE: Shooter side - 11/17/2021 8:44:08 PM   
musurca

 

Posts: 114
Joined: 7/16/2020
Status: online
quote:

Just fyi UnitY is always nil for certain surface ships when destroyed. (Testing with with a 'Light Amphibious Warship' or old 11m RHIB)


Interesting! I would imagine that this is probably a reversion. If not, perhaps it's related to the gap in time between when a ship is last damaged and when it sinks? Regardless, the weapon which got the last 'whack' in should still probably be the destroying weapon for the sake of simplicity. I might also vote for an weapon coded as 'FIRE' or 'FLOOD' with the killer's side, in the same way that unguided projectiles are handled for other units.

Here's the original thread from when I first reported it, if it's helpful as a reference when you log it again: https://www.matrixgames.com/forums/tm.asp?m=4959907&mpage=1&key=�

(in reply to KnightHawk75)
Post #: 12
RE: Shooter side - 11/18/2021 1:09:39 AM   
KnightHawk75

 

Posts: 1412
Joined: 11/15/2018
Status: online
quote:


Interesting! I would imagine that this is probably a reversion. If not, perhaps it's related to the gap in time between when a ship is last damaged and when it sinks?


I thought that, but the thing is in the cases I was testing the RHIB and the LAW were destroyed instantly (or nearly so), I would think it would keep a record of last impacting munition for those cases just like others, the buoy that worked actually seemed to be delayed the most when getting destroyed more than the others. I gotta play around more with targeting all different surface ships with different subtypes and if that munition used plays a part (I was using agm-158c and some 109i-j's..basically all guided munitions), see what's common among ones I can find that fail\don't fail. Then work up a good sample for TS from all I find for a TS post, today got away from me a bit, maybe tomorrow.

Thank you for the link to the post first bringing this up.







< Message edited by KnightHawk75 -- 11/18/2021 1:11:51 AM >

(in reply to musurca)
Post #: 13
RE: Shooter side - 11/18/2021 5:39:46 AM   
michaelm75au


Posts: 13472
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Funny. I thought I had 'exposed' the last weapon hit in the unit wrapper, but looks like it was a 'thought' and not a done deal.
It is recorded as part of the unit damage, so it would make sense to add it to table that comes out of 'unit.damage'.

_____________________________

Michael

(in reply to KnightHawk75)
Post #: 14
RE: Shooter side - 11/18/2021 5:56:02 AM   
michaelm75au


Posts: 13472
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline

quote:

ORIGINAL: nukkxx5058


quote:

ORIGINAL: KnightHawk75

Just fyi UnitY is always nil for certain surface ships when destroyed. (Testing with with a 'Light Amphibious Warship' or old 11m RHIB)
Does seem to works for:
Aircraft (all i tried)
Buoy's (hmm.. guess it has to do with subtype?)
Subs (couple of subs units I tried)
Land facilities (cars, and other typical structures)

I'll post this as a bug in tech support later today.




Good to know, thanks.


The recorded weapon is a hit. Blast or such damage doesn't get recorded from memory.

_____________________________

Michael

(in reply to nukkxx5058)
Post #: 15
RE: Shooter side - 11/18/2021 6:19:54 PM   
KnightHawk75

 

Posts: 1412
Joined: 11/15/2018
Status: online
quote:

The recorded weapon is a hit.

So then it's actually up in the air if UnitY will be populated (non-nil) on any given unit-destroyed? or Did you just mean the population is always the last known 'hit', vs say blast damage/fire/flooding etc that might have actually pushed something over the edge to destruction?

(in reply to michaelm75au)
Post #: 16
RE: Shooter side - 11/19/2021 8:36:38 AM   
michaelm75au


Posts: 13472
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
From memory, this was put in to track the actual weapon hits sometime back but not the damage that might be sustained by blast/frag from a near miss. That blast/frag could result in the eventual destruction of the unit BUT it wasn't destroyed by an actual weapon hit.

I'll have to look at this to refresh my aging memory on what it is actually.

_____________________________

Michael

(in reply to KnightHawk75)
Post #: 17
RE: Shooter side - 11/21/2021 2:50:26 PM   
KnightHawk75

 

Posts: 1412
Joined: 11/15/2018
Status: online
Filed in Tech Support, I think I found some issues, and yes some of it revolves around impact vs 'hit but missed + blastdmg', but it's weird in that the problem doesn't happen universally, just 'mostly'. lol

See the details here:
https://www.matrixgames.com/forums/tm.asp?m=5104622

That said I'm not going to be relying on UnitY() data when ships are involved and it's damage OR destroyed, even if not-nil for the time being, as the data can be varying degrees of bad I've found.

(in reply to michaelm75au)
Post #: 18
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Shooter side Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.176