Jump to content

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua


Recommended Posts

Truth be told those functions have always confused me. They were among the last functions Speed added to mist. I had to go in and test it to be sure, and even then I was confused so I had to add logging to the mist function to see exactly what was going on.

 

What those functions do is you give it a unitNameTable of units to check and a bearing. It will the find the unit that is most in that direction and if a radius is given, it returns the average position of other units within a radius of that object. It then returns that position and generates a string accordingly. In other words if you give it a degreeHeading of 0 and every blue unit, it should return a string based on the position of the northern most blue unit. I say should because it was returning just fine for north/south units but when I tried east/west directions it wasn't returning what I was expecting.

 

The BRstring function requires a reference position to give the Bearing, Range, Altitude from-to the target. MGRS and LL also have their own unique values required.

 

 

I think what you might be wanting is something like a "pointInPie" where you get the objects that are within a certain bearing of an objects heading. The function mist.getLeadingPos() kind of does that, but you would need to filter out units within a radius of the aircraft first before searching them.

 

 

I think I understood. What I want is a string of all units betewn the teo bearings. I can do the filtering to get a sting of groups and remove duplicated. Ill let you know how is it going.


Edited by ESAc_matador
Link to comment
Share on other sites

  • 2 weeks later...

Am I able to apply the advanced waypoint attributes found in the standard ME to units that are spawned through a mist script?

 

I'm looking to build an accuracy test range, where the pilot can spawn a target which is essentially a ural, with M818s on 4 sides. They would then have to destroy the ural without destroying the M818 (with the M818s being at varying distances from the ural).

 

I can do that part fine, but once the pilot has made an attack run, all the remaining vehicles drive away to defend themselves. I found that in just using the DCS editor the "Hold" command stops them from doing this completely. Any suggestions on how I can implement this into my spawn script?

 

This is a small part of a larger training script, so ideally it would all be handled by the spawn script.

 

Thanks

Link to comment
Share on other sites

To immobilize a ground AI group you have two options. You can either turn the AI off so they can't move or you can change the disperse on attack setting so they won't move if attacked.

 

Group.getByName('whatever'):getController():setOnOff(false)

 

or

 

Group.getByName('whatever'):getContoller():setOption(AI.Option.Ground.id.DISPERSE_ON_ATTACK, false)

 

Generally speaking the game doesn't like it when you assign a new task or change something the moment a group spawns, so you will have to run these functions a little bit after they spawn.

  • Like 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

To immobilize a ground AI group you have two options. You can either turn the AI off so they can't move or you can change the disperse on attack setting so they won't move if attacked.

 

Group.getByName('whatever'):getController():setOnOff(false)

 

or

 

Group.getByName('whatever'):getContoller():setOption(AI.Option.Ground.id.DISPERSE_ON_ATTACK, false)

 

Generally speaking the game doesn't like it when you assign a new task or change something the moment a group spawns, so you will have to run these functions a little bit after they spawn.

 

This was exactly what I needed, thank you!

Link to comment
Share on other sites

  • 2 weeks later...

Hi Grimes, can you confirm that for cloned group the mist.DBs.dynGroupsAdded database won't add the group? it did in 1.5.3 but it's not doing in 1.5.4. Last mist release.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Hi Grimes, can you confirm that for cloned group the mist.DBs.dynGroupsAdded database won't add the group? it did in 1.5.3 but it's not doing in 1.5.4. Last mist release.

 

Working fine for me. What type of group are you cloning?

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Working fine for me. What type of group are you cloning?

 

3x BTR-80, vehicles. They aren't added in the db table that I dump few seconds after the cloning, in a test mission for a corrected DAWS Save Mission version for 1.5.4. DAWS use the spawned table to get data to add units.

 

To be clear: clonegroup will work ok. teleport group also. But clonegroup data isn't added in the mist.DBs.dynGroupsAdded database.

 

 

If you can confirm that it's ok I will recheck the code and maybe send it to you in PM.

 

EDIT: added the test mission using only mist function (teleport, clone, dumpDBs). Only need to run for 40 sec after disabling sanitization module... thing that I bet you already know :p

CloneTest1.miz


Edited by chromium

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Enable the dbLog within mist at line 1121 by changing 'warning' to 'info'. Once changed look in your DCS.log for an entry related to "endUpdateTables". As long as you see that before you dumped the DBs, then you should see it. That said its supposed to update the DBs extremely quickly.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Enable the dbLog within mist at line 1121 by changing 'warning' to 'info'. Once changed look in your DCS.log for an entry related to "endUpdateTables". As long as you see that before you dumped the DBs, then you should see it. That said its supposed to update the DBs extremely quickly.

 

I updated previous post. I will do the test you ask asap.

 

Can't find that entry, log attached (rename .log) :). Thanks for the help.

dcs.txt


Edited by chromium

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Yeah its clearly getting stuck on something and failing to update. Problem is with teleporting and not the clone.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

I saw. Thanks, Hope you can fix it Soon :). Good night

 

Inviato dal mio SM-G850F utilizzando Tapatalk

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Pushed fix to development branch. May make a release later. The fix is the 2nd thing listed. It was checking the wrong type of value, don't know why it might have been working fine in previous releases though. Also noticed getUnitSkill wasn't working in your sample mission, so I had to investigate and fix that one.

 

- fixed mist.time.getDate to account for changes made to the mission file format related to how the mission start time and date are saved. Also added in code to correctly account for leap years.

- fixed issue in DB updating checking an incorrect value

- fixed mist.getUnitSkill. Slightly reworked how the function got the data.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Pushed fix to development branch. May make a release later. The fix is the 2nd thing listed. It was checking the wrong type of value, don't know why it might have been working fine in previous releases though. Also noticed getUnitSkill wasn't working in your sample mission, so I had to investigate and fix that one.

 

- fixed mist.time.getDate to account for changes made to the mission file format related to how the mission start time and date are saved. Also added in code to correctly account for leap years.

- fixed issue in DB updating checking an incorrect value

- fixed mist.getUnitSkill. Slightly reworked how the function got the data.

 

Worked for me. I'll wait the release to officially update DAWS Save Mission :)

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Worked for me. I'll wait the release to officially update DAWS Save Mission :)

 

Merged fixes to the release branch.

 

https://github.com/mrSkortch/MissionScriptingTools/releases/tag/4.3.73

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

 

you're FTL :thumbup:

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Got an issue with the deadObjects DB, now it is void for the same mission (It's used to create the static dead object in DAWS)

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Got an issue with the deadObjects DB, now it is void for the same mission (It's used to create the static dead object in DAWS)

 

Nothing is destroyed by the time you dump the DB so the table will be empty. I also tested it out in my mission I used to create the DBs and it looked to be displaying dead objects correctly.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

I tried in a different mission dumping the Db after the teleported Group Was destroyed having the issue. I Will Sent you another version tomorrow evening if i can replicate the issue

 

Inviato dal mio SM-G850F utilizzando Tapatalk

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Grimes, this can this be a Mist issue??

 

I am having problems with this. I need that the radius of the funcion getUnitLOS is dependant on the altitude of an aircraft.

 

local Position_vec3 = Unit.getByName('recon1'):getPoint()
local _elevation = land.getHeight({x = Position_vec3.x, y = Position_vec3.z})
local _height = Position_vec3.y - _elevation
_reconradius = math.sin(0.45) * _height

-- this works fine so far, gives you a radius, depending on the height and an angle, simulating a Recon Camera. Estimated camera angle is about 50º so, i did Sin(25º))

 

the problem is that in the function mist. getUnitsLOS does not work with the variable _reconradius. I check the table and it is always empty. It seems a format problem.. Probably due to the function.... any clue??

 

local redunits = mist.makeUnitTable({'[red][vehicle]'})
local blueunits = mist.makeUnitTable({'recon1'})        
LOSData = mist.getUnitsLOS(blueunits,2,redunits,2,_reconradius)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...