Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

EMCON inherit question

 
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 >> EMCON inherit question Page: [1]
Login
Message << Older Topic   Newer Topic >>
EMCON inherit question - 12/29/2020 2:50:54 PM   
Gunner98

 

Posts: 5470
Joined: 4/29/2005
From: The Great White North!
Status: online
I believe that this is related to EMCON inherit.

I want to bring on a radar and turn it to active:

ScenEdit_AddUnit({type ='Facility', unitname ='R1/798 Msl Regt', dbid =1651, side ='WP', latitude='68.7562226777923', longitude='27.557318553208'})
ScenEdit_SetEMCON('Unit','R1/798 Msl Regt','Inherit=false;Radar=Active')

The problem is that the side doctrine is passive and I want to override this for this unit only. The script above was a stab, played around with it a bit but it doesn't work.

I see some scripts on this forum that allow turning radars on and off on timers and such but this one is pretty simple I think. Any ideas?

Tx

_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
Post #: 1
RE: EMCON inherit question - 12/29/2020 3:28:31 PM   
boogabooga

 

Posts: 439
Joined: 7/18/2018
Status: offline
http://www.matrixgames.com/forums/fb.asp?m=4926627

(in reply to Gunner98)
Post #: 2
RE: EMCON inherit question - 12/29/2020 5:40:19 PM   
Gunner98

 

Posts: 5470
Joined: 4/29/2005
From: The Great White North!
Status: online
Yeah, looking to uncheck the box via lua on a unit that has just been added.

Tx

_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/

(in reply to boogabooga)
Post #: 3
RE: EMCON inherit question - 12/29/2020 10:43:42 PM   
KnightHawk75

 

Posts: 1417
Joined: 11/15/2018
Status: offline
quote:

ORIGINAL: Gunner98
Yeah, looking to uncheck the box via lua on a unit that has just been added.
Tx

Which?

Your sample should do that on the unit object, uncheck the inherit parent and activate all radars. It does for me (I have red and blue sides). Are you sure you have the side name correct and no naming conflicts.
local u = ScenEdit_AddUnit({type ='Facility', unitname ='R1/798 Msl Regt', dbid =1651, side ='Red', latitude='68.7562226777923', longitude='27.557318553208'})
ScenEdit_SetEMCON('Unit',u.guid,'Inherit=false;Radar=Active')

Or do you mean uncheck the 'obey emcon' and manual modify specific sensors?

local uObj = SE_GetUnit({guid=xyzabc-123xxxxxxxx});
uObj.obeyEMCON = true; --checked
uObj.obeyEMCON = false; --unchecked, make sure it's done before you attempt to actually modify an individual sensor(s)




< Message edited by KnightHawk75 -- 12/29/2020 10:46:44 PM >

(in reply to Gunner98)
Post #: 4
RE: EMCON inherit question - 12/29/2020 10:53:38 PM   
Gunner98

 

Posts: 5470
Joined: 4/29/2005
From: The Great White North!
Status: online
quote:

local uObj = SE_GetUnit({guid=xyzabc-123xxxxxxxx});
uObj.obeyEMCON = true; --checked
uObj.obeyEMCON = false; --unchecked, make sure it's done before you attempt to actually modify an individual sensor(s)


OK I think this is what I need. Will give it a shot.

I did try the obeyEMCON as a paramater in the ScenEdit_AddUnit command but that did not seem to work.

Thanks

B

_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/

(in reply to KnightHawk75)
Post #: 5
RE: EMCON inherit question - 12/29/2020 11:14:59 PM   
Gunner98

 

Posts: 5470
Joined: 4/29/2005
From: The Great White North!
Status: online
OK that successfully gets the 'obey EMCON' box unchecked

But now the command to set the radar to active is not working..

ScenEdit_AddUnit({type ='Facility', unitname ='R1/798 Msl Regt', dbid =1651, side ='WP', latitude='68.7562226777923', longitude='27.557318553208'})
local uObj = SE_GetUnit({side = 'WP', name='R1/798 Msl Regt'});
uObj.obeyEMCON = false;
ScenEdit_SetEMCON('Unit', 'R1/798 Msl Regt','Radar=Active')


I've tried making the SetEMCON local and referencing 'uObj' but that returns errors.

Tx

_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/

(in reply to KnightHawk75)
Post #: 6
RE: EMCON inherit question - 12/30/2020 1:54:57 AM   
KnightHawk75

 

Posts: 1417
Joined: 11/15/2018
Status: offline
quote:

ORIGINAL: Gunner98

OK that successfully gets the 'obey EMCON' box unchecked

But now the command to set the radar to active is not working..

ScenEdit_AddUnit({type ='Facility', unitname ='R1/798 Msl Regt', dbid =1651, side ='WP', latitude='68.7562226777923', longitude='27.557318553208'})
local uObj = SE_GetUnit({side = 'WP', name='R1/798 Msl Regt'});
uObj.obeyEMCON = false;
ScenEdit_SetEMCON('Unit', 'R1/798 Msl Regt','Radar=Active')


I've tried making the SetEMCON local and referencing 'uObj' but that returns errors.

Tx

Actually it's doing exactly what you told it to do there. Since you told it _not_ to obey the setting you then gave it. ;) Again if all you are trying to do is add a unit and turn it active you're original sample works fine for me so something else is wrong.
local u = ScenEdit_AddUnit({type ='Facility', unitname ='R1/798 Msl Regt', dbid =1651, side ='WP', latitude='68.7562226777923', longitude='27.557318553208'})
ScenEdit_SetEMCON('Unit',u.guid,'Inherit=false;Radar=Active') 

^^ works perfectly fine for me for adding the unit, and turning off inheritance, and turning on all radars on the unit.
(are you letting the scene run for a split second after?, sometimes you need that for the radar to activate)

You didn't answer which it was you were trying to do though, ^ that ^ or manually screwing with specific individual sensors manually (ie the equivalent of unchecking inheritance, unchecking obey-emcon in the sensors window, and then manually flipping certain sensors on and keeping certain sensors off), which it does not sound like you are trying to do. The obeyEMCON part was for if were and there is more to it after that to flip a given sensor on\off, I can get into that but since I don't think that's what you're trying to do I'll pause to avoid confusion.


< Message edited by KnightHawk75 -- 12/30/2020 2:20:47 AM >

(in reply to Gunner98)
Post #: 7
RE: EMCON inherit question - 12/30/2020 3:53:53 PM   
Gunner98

 

Posts: 5470
Joined: 4/29/2005
From: The Great White North!
Status: online
Hmmm

So what I am trying to do is simply bring a unit on and turn on its radar. I did not let the scenario run for a few seconds following the test but will try that next.

I also note that you've made it local and referred to the guid. I'm bringing this radar on with about 28 other units and hadn't thought of using the local command.

This one is easy enough to isolate and perhaps that will make a difference as well.

Thanks

B

_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/

(in reply to KnightHawk75)
Post #: 8
RE: EMCON inherit question - 12/30/2020 4:22:05 PM   
Gunner98

 

Posts: 5470
Joined: 4/29/2005
From: The Great White North!
Status: online
OK thanks....

Letting the scenario run for a couple seconds did it....

Both options - using local or not - work the same.


note to self - test in an isolated scenario not a monster one where you don't want to keep running the timer...

B

_____________________________

Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/

(in reply to Gunner98)
Post #: 9
RE: EMCON inherit question - 12/31/2020 12:17:26 AM   
KnightHawk75

 

Posts: 1417
Joined: 11/15/2018
Status: offline
Glad you got it sorted.

quote:

using local or not

Yes they work the same... (all other things being equal) for this particular thing.

Using u.guid instead of hard-coded name is just habit since so often I'm doing unit adds etc inside loops, avoids a potential issue and one less place to have to change a name or adjust if the name is a sequence, and I'm usually doing other stuff to the unit post creation so it's handy to already already have a handle stored to the unit just created.

(in reply to Gunner98)
Post #: 10
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> EMCON inherit question 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