Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Looking for scripting/mission help

 
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 >> Looking for scripting/mission help Page: [1]
Login
Message << Older Topic   Newer Topic >>
Looking for scripting/mission help - 7/27/2021 2:41:42 PM   
1nutworld


Posts: 335
Joined: 4/13/2014
Status: offline
Hey everyone,

* - If this post needs to be placed under a different topic feel free to move it.

I am working on a testing scenario comparing the F-35 v F-22

There will be an OPFOR CAP that the planes will have to contend with, as well as a ground strike capability. So the F-35's and F-22's will have a strike mission w escorts set up.

What I want to do is add an 59N6 radar that will NOT be emitting until after the inbound flight is detected by the CAP a/c.
Once the inbound strike A/C are detected by the opfor CAP, then the 59N6 will begin emitting to help defensive SAM's engage the escorts/strike F-35 and F-22's.

Thanks in advance.

Scott

_____________________________

USS Dwight D. Eisenhower (CVN-69) 1990-1994.
Post #: 1
RE: Looking for scripting/mission help - 7/27/2021 10:47:49 PM   
tmoilanen

 

Posts: 65
Joined: 10/19/2011
Status: offline
Hi Scott - you should create an event with a "Unit is Detected" trigger on your F-35/F-22.

below is a LUA script that should work as the action for that event...replace myside and myunitname with your OPFOR side and the unitname of the emitter that you want to activate.

Hope this helps...TM

myside = 'PLAN'
myunitname = {'KZLDY'}

for i = 1, #myunitname
do
unitname = myunitname
myunit = ScenEdit_GetUnit({side=myside,name=unitname})
print(myunit)

print(myunit.obeyEMCON)
myunit.obeyEMCON = true
print(myunit.obeyEMCON)
myemcon = 1 -- if you want to add some randomness to it substitute math.random(1,2) for 1
if myemcon == 1 then -- check the random emcon variable
ScenEdit_SetEMCON('Unit',unitname,'Inherit=false;OECM=Active') --if myemcon = 1 activate the radar
else
ScenEdit_SetEMCON('Unit',unitname,'Inherit=false;OECM=Passive') --if myemcon does not equal 1 do nothing
print(myunit.sensors)
end
end

(in reply to 1nutworld)
Post #: 2
RE: Looking for scripting/mission help - 7/27/2021 11:15:40 PM   
thewood1

 

Posts: 6112
Joined: 11/27/2005
Status: online
My knee jerk reaction would have been to put the radar on a mission with radar on but deactivated. Then activate the mission based on entry into a zone or unit detection levels.

_____________________________

You are like puss filled boil on nice of ass of bikini model. You are nasty to everybody but then try to sweeten things up with a nice post somewhere else. That's nice but you're still a boil on a beautiful thing! - BDukes

(in reply to tmoilanen)
Post #: 3
RE: Looking for scripting/mission help - 7/27/2021 11:20:42 PM   
1nutworld


Posts: 335
Joined: 4/13/2014
Status: offline

quote:

ORIGINAL: tmoilanen

Hi Scott - you should create an event with a "Unit is Detected" trigger on your F-35/F-22.

below is a LUA script that should work as the action for that event...replace myside and myunitname with your OPFOR side and the unitname of the emitter that you want to activate.

Hope this helps...TM

myside = 'PLAN'
myunitname = {'KZLDY'}

for i = 1, #myunitname
do
unitname = myunitname
myunit = ScenEdit_GetUnit({side=myside,name=unitname})
print(myunit)

print(myunit.obeyEMCON)
myunit.obeyEMCON = true
print(myunit.obeyEMCON)
myemcon = 1 -- if you want to add some randomness to it substitute math.random(1,2) for 1
if myemcon == 1 then -- check the random emcon variable
ScenEdit_SetEMCON('Unit',unitname,'Inherit=false;OECM=Active') --if myemcon = 1 activate the radar
else
ScenEdit_SetEMCON('Unit',unitname,'Inherit=false;OECM=Passive') --if myemcon does not equal 1 do nothing
print(myunit.sensors)
end
end



I'm, not getting the script to run properly....I guarantee you it is something to do with my typing.

mind if I send you PM to help figure out the issue? I'm sure it's something simple


_____________________________

USS Dwight D. Eisenhower (CVN-69) 1990-1994.

(in reply to tmoilanen)
Post #: 4
RE: Looking for scripting/mission help - 7/27/2021 11:21:57 PM   
tmoilanen

 

Posts: 65
Joined: 10/19/2011
Status: offline
Sure no problem

(in reply to 1nutworld)
Post #: 5
RE: Looking for scripting/mission help - 7/27/2021 11:29:30 PM   
1nutworld


Posts: 335
Joined: 4/13/2014
Status: offline

quote:

ORIGINAL: thewood1

My knee jerk reaction would have been to put the radar on a mission with radar on but deactivated. Then activate the mission based on entry into a zone or unit detection levels.


that sounds like a simple solution, but I'm not a scripter...though I can cut and paste. LOL.

Seriously, though, that might be something I try. I can run the scenario in editor and do the activation myself I suppose, but I'd like to have computer controlled side run it for me

_____________________________

USS Dwight D. Eisenhower (CVN-69) 1990-1994.

(in reply to thewood1)
Post #: 6
RE: Looking for scripting/mission help - 7/27/2021 11:30:35 PM   
tmoilanen

 

Posts: 65
Joined: 10/19/2011
Status: offline
Actually the error was in the original script I shared.

You can either remove the brackets from myunitname = {'KZLDY'}

myunitname = 'KZLDY'


or

change unitname = myunitname to the following

unitname = myunitname[i]


Either should fix the issue.

< Message edited by tmoilanen -- 7/27/2021 11:33:14 PM >

(in reply to tmoilanen)
Post #: 7
RE: Looking for scripting/mission help - 7/27/2021 11:44:41 PM   
thewood1

 

Posts: 6112
Joined: 11/27/2005
Status: online
quote:

ORIGINAL: 1nutworld


quote:

ORIGINAL: thewood1

My knee jerk reaction would have been to put the radar on a mission with radar on but deactivated. Then activate the mission based on entry into a zone or unit detection levels.


that sounds like a simple solution, but I'm not a scripter...though I can cut and paste. LOL.

Seriously, though, that might be something I try. I can run the scenario in editor and do the activation myself I suppose, but I'd like to have computer controlled side run it for me


I don't see the difference in doing what I suggested vs. lua. But whatever works for you.

btw, there's zero scripting involved in my possible solution. Its just an event, a trigger, an action, and a mission. No lua and no scripting. I tend to exhaust all solutions before resorting to lua. Lua scripts tend to complicate modding scenarios if you didn't write the original scripts. Using events and missions like this has always seemed an easier.

And my suggestion is for the AI. No manual intervention needed.

< Message edited by thewood1 -- 7/28/2021 12:01:45 AM >


_____________________________

You are like puss filled boil on nice of ass of bikini model. You are nasty to everybody but then try to sweeten things up with a nice post somewhere else. That's nice but you're still a boil on a beautiful thing! - BDukes

(in reply to 1nutworld)
Post #: 8
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Looking for scripting/mission help 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.219