Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

UnitY() is nil inside of a Target Detected event

 
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 >> Tech Support >> UnitY() is nil inside of a Target Detected event Page: [1]
Login
Message << Older Topic   Newer Topic >>
UnitY() is nil inside of a Target Detected event - 5/30/2018 3:23:48 AM   
NimrodX


Posts: 82
Joined: 5/12/2018
Status: offline
I have an event of the "target detected" sort. There is one single "Unit is Detected" trigger.

I need it to fire only when a specific unit detects the target, so I need a Lua condition that uses ScenEdit_UnitY() to get the detecting unit. I have one single Lua condition for this purpose.

So I have this code for the Lua condition:

quote:


local by = ScenEdit_UnitY()
return by.unit.guid == 'XiaoZhanMa-GUID'


This was working perfectly fine earlier but at some point, for no apparent reason, 'by' is coming up as either nil or empty string every time it runs.

Shoulnd't ScenEdit_UnitY() get set to the detecting unit for both conditions and actions?

< Message edited by NimrodX -- 6/12/2018 6:12:32 AM >
Post #: 1
RE: UnitY() is nil inside of a Target Detected event - 6/11/2018 9:08:58 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
Found an edge case. If no sensor 'made' the contact, then UnitY() will fail. Updated to pass back UnitY() even if no sensor table.

_____________________________

Michael

(in reply to NimrodX)
Post #: 2
RE: UnitY() is nil inside of a Target Detected event - 6/12/2018 6:14:38 AM   
NimrodX


Posts: 82
Joined: 5/12/2018
Status: offline
Woohoo! Thanks. This will come in handy.

But I am confused as to how a "Unit is Detected" trigger could trigger if no sensor detected the unit?

(in reply to michaelm75au)
Post #: 3
RE: UnitY() is nil inside of a Target Detected event - 6/12/2018 6:27:59 AM   
Dimitris

 

Posts: 13282
Joined: 7/31/2005
Status: offline
There are cases where a "presumed" contact is generated, for example if you detect a torpedo or a missile breaks off the sea surface in an otherwise empty area then a "possible sub contact" is automatically created.

_____________________________


(in reply to NimrodX)
Post #: 4
RE: UnitY() is nil inside of a Target Detected event - 6/12/2018 6:40:20 AM   
NimrodX


Posts: 82
Joined: 5/12/2018
Status: offline
Ok, but in this case there's a "spy" who spots an aircraft with eyeballs/binoculars. The aircraft didn't fire weapons or do anything to imply that an aircraft should be there. Unless I missed something it's just flying around and should either be seen or not seen by eyeballs/binoculars?

I understand what you mean about the implied existence of something that launches a missile for example, and it makes sense to have no sensors for that case since the contact is essentially an intellectual inference based on the idea that missiles/torpedoes can't come from nowhere. But it doesn't seem like it applies to this case where there's just an airplane flying around not releasing weapons?

< Message edited by NimrodX -- 6/12/2018 6:41:05 AM >

(in reply to Dimitris)
Post #: 5
RE: UnitY() is nil inside of a Target Detected event - 6/13/2018 8:36:21 AM   
michaelm75au


Posts: 13500
Joined: 5/5/2001
From: Melbourne, Australia
Status: offline
In this case, the sensor was sometimes 'visual' but more often nothing; I was replaying with the new code and about 3 out of 5 times I got the sensor list with the 'visual' in it with nothing the rest of the time.
This may explain why you say sometimes it was working and others not. Not sure why sometimes the event is being triggered, but by the time the condition kicks in, something has cleared the sensor list.

_____________________________

Michael

(in reply to NimrodX)
Post #: 6
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Tech Support >> UnitY() is nil inside of a Target Detected event 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

1.000