Page 1 of 1
Trigger for Track regained
Posted: Tue Jan 19, 2021 7:11 am
by Parel803
Do apologize if this is not the right place to post this. I do my best in English to try and write it clear, always hard to do.
I made a trigger on detection of a submarine when on PD.
The DE submarine goes comes to PD every xx minutes.
Although the track is lost, it is not a new detection (I think) in the game.
So the trigger is not restarted for detection?
Is this assumption correct?
Could I make a trigger on a regained track?
with regards GJ
RE: Trigger for Track regained
Posted: Tue Jan 19, 2021 8:48 am
by Parel803
To add more of my stuggle and confusion. I cannot share the Scen but I try to duplicate it in another one. Sorry for that.
I initiated the sub at PD and want to dive when Blue detected it:
ScenEdit_SetTrigger({mode='add', type='UnitDetected', name='OpforSubDetected', targetfilter={TargetSide='Redland', TargetType=3}, DetectorSideID='Blue'})
ScenEdit_SetAction({mode='add', type='LuaScript', name='SubDivesAfterDetection', ScriptText= "ScenEdit_GetUnit({Guid='50PVO4-Haitun1'}); \r\n ScenEdit_SetUnit({Guid='50PVO4-Haitun1', depth='200 ft', moveto=true}); \r\n ScenEdit_SetDoctrine({Guid='50PVO4-Haitun1'}, {dive_on_threat = 0}); \r\n" })
ScenEdit_SetEvent('OpforSubDivesOnDetection', {mode='add', IsRepeatable=false})
ScenEdit_SetEventTrigger('OpforSubDivesOnDetection', {mode='add', name='OpforSubDetected'})
ScenEdit_SetEventAction('OpforSubDivesOnDetection', {mode='add', name='SubDivesAfterDetection'})
Sub was detected by a camcopter with an added radar ZPY-1. Sub dives.
Then I tried to get the sub to PD every 5 minutes:
ScenEdit_SetTrigger({mode='add', name='Every5min', type='RegularTime', interval='5'})
ScenEdit_SetAction({mode='add', name='SubToPd', type='LuaScript', ScriptText= "local ChSub= ScenEdit_GetUnit({Guid='50PVO4-Haitun1'}); \r\n ScenEdit_SetUnit({Guid=ChSub.guid, depth='periscope', moveto=true}); \r\n ScenEdit_SetDoctrine({Guid=ChSub.guid}, {dive_on_threat = 0}); \r\n "})
ScenEdit_SetEvent('Sub5minSurf', {mode='add', IsRepeatable=true})
ScenEdit_SetEventTrigger('Sub5minSurf', {mode='add', name='Every5min'})
ScenEdit_SetEventAction('Sub5minSurf', {mode='add', name='SubToPd'})
That worked, after 5 minutes in game she came to PD.
But I thought and hoped she want down because of the doctrine setting: dive_on_threat at 0. She doesn't. I added a GrayEagle with same radar on BLue side. Though it might be caused by DB issue since I added a radar on camcopter.
I realize I have a lot of questions lately and fully understand if there is no time to answer.
With regards
RE: Trigger for Track regained
Posted: Tue Jan 19, 2021 9:18 am
by Parel803
Small scen added, just to add the functions.
Now got on Red side a message that she came up after 5 min and went back under due to threat. Radar did not pick it up.
What I hop to accomplish is that Blue get intermitted radar contact and act accordingly.
I try to think of other ways to make it so, but no luck.
Ideas are very welcome.
with regards
ps hope this make some sense
RE: Trigger for Track regained
Posted: Tue Jan 19, 2021 9:36 am
by Parel803
Not sure what I'm doing, that's for sure. In my original game the sub stays at PD after the 5 min going to PD. Despite having the doctirn on diving when theat. Looks like I getting further and further from want I want to accomplish. Tough stuff
RE: Trigger for Track regained
Posted: Tue Jan 19, 2021 5:27 pm
by KnightHawk75
ORIGINAL: Parel803
Do apologize if this is not the right place to post this. I do my best in English to try and write it clear, always hard to do.
I made a trigger on detection of a submarine when on PD.
The DE submarine goes comes to PD every xx minutes.
Although the track is lost, it is not a new detection (I think) in the game.
So the trigger is not restarted for detection?
Is this assumption correct?
Could I make a trigger on a regained track?
with regards GJ
Yes that assumption is correct, if you still have the contact on your screen with the timer ticking on it then you will not get a new detection trigger for it. You will get another detection if you drop contact, or if it eventually ages out.
Could I make a trigger on a regained track?
You can mostly, but you have to build your own subsystem for generating that 'trigger' yourself.
The outline is something like this.
Standard detection trigger level 1 -> adds contact guid to a list to process.
Standard regular time trigger [@5|30|60 etc]-> kicks off a processing of that list.
You then build your list processing function(s) around the fact you can query contactWrapper.detectedBy's table, and if any of the values there exist you check them for a value of < X >= X, X being the amount of time you want to trigger an active|inactive state and take some action. ie if SonarPassive or SonarActive >= 60 then it's been 1 minute since you've got a sensor hit on a sonar type device, you then take action (or not) depending on the result.
Also if after a certain amount of time you want the contact dropped can do that via code, contact wrapper has both a DropContact() method to drop is from side doing the original reporting, and age field, the latter being the number of seconds it's existed.
I'll have to look at the scene events and stuff for the rest see if can see what's up the PD every 5 thing, that sounds like it ought to be working, but also sounds like maybe you are fighting the dive-on threat feature...while still trying to use it.
RE: Trigger for Track regained
Posted: Tue Jan 19, 2021 6:44 pm
by KnightHawk75
The popping-up to PD issue is as I suspected. You're trying to use it (to cause it to go down) while also telling the sub to slowly move to depth. You can't (unless you're manually tracking depth yourself say every second)...so the solution is to to cheat with moveto=false and something like 60ft so that it magically teleports to 60ft and then is forced to dive which takes a few seconds and give opportunity for detection, it will then dive at normal rate. Also syntax is wrong for setting dive_on_threat. It's a string not a number.
__SubDivesAfterDetection___
ScenEdit_GetUnit({guid='50PVO4-0HM5SB6BM59T2'});
ScenEdit_SetUnit({guid='50PVO4-0HM5SB6BM59T2', depth='200 ft', moveto=true});
ScenEdit_SetDoctrine({unitname='50PVO4-0HM5SB6BM59T2'}, {dive_on_threat ='Yes'}); <-- string value
__SubToPD____
local ChSub= ScenEdit_GetUnit({guid='50PVO4-0HM5SB6BM59T2'});
ScenEdit_SetUnit({Guid=ChSub.guid, depth='20', moveto=false}); -- <---set this; happens instantly and sub get detected for a second or two.
ScenEdit_SetDoctrine({unitname=ChSub.guid}, {dive_on_threat ='Yes_ESM_Only'}); -- <-- before this
RE: Trigger for Track regained
Posted: Wed Jan 20, 2021 12:30 pm
by Parel803
Thx again KnighHawk, I'll study this evening
RE: Trigger for Track regained
Posted: Wed Jan 20, 2021 5:30 pm
by Parel803
KH, I understand and working on it.
For the string versus number in the doctrine, I'm sure you're right, but I got that from the site
https://commandlua.github.io/#ScenEdit_SetDoctrine
Better use the string then, np.
Thanks again
with regards