Jump to content

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua


Recommended Posts

It was in the post you replied to : here

Zip - VEAF :pilotfly:

 

If you want to learn, talk and fly with french-speaking friends, the Virtual European Air Force is here for you ! Meet us on our Discord and our forum

If you're a mission creator, you may want to check the VEAF Mission Creation Tools (and its GitHub repository) a set of open-source scripts and tools that make creating a dynamic mission a breeze !

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

Hello all.

Any ideas why the below script does not work

 

mist.flagFunc.units_LOS(vars)

{

unitset1 = {'Rus EW RDR'},

altoffset1 = 1,

unitset2 = {'[blue][plane]','[blue][helicopter]'},

altoffset2 = 1,

flag = 2,

radius = 240000,

interval = 10,

}

 

I get the following message

 

[string

"C:\Users\PHILIP~1\AppData\Local\Temp\DCS.openbetaV~mis00006221..."]:19:'{'expected (to close '}' at line 1) near '<eof>'

Link to comment
Share on other sites

Could try to enclose it in the function call.

mist.flagFunc.units_LOS[color="red"]({[/color]
unitset1 = {'[u]Rus EW RDR'},
altoffset1 = 1,
unitset2 = {'[blue][plane]','[blue][helicopter]'},
altoffset2 = 1,
flag = 2,
radius = 240000,
interval = 10,
[color="red"]})[/color]

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

Hey all!

Trying to use respawn script but respawned planes appear to spawn without any task and do not engage any enemies (the original group does engage). I'm pretty new to LUA and may easily screw something up. Thath's what I use:

if not Group.getByName('Single FA-18_Guns') then
  mist.respawnGroup('Single FA-18_Guns', true)
end

Is there any way to get this running?

Thanks for help in advance!

Link to comment
Share on other sites

Best guess it is the task itself. Make sure it has at least 10km of a route because the conditions when an AI spawns might not be the same as it was at mission start. For example at mission start the player or another target are directly in front of the AI, the moment they spawn they detect and begin to attack the target. However after it respawns the player/target might not be immediately detected due to location, thus they continue their route until they find a target. If they had a short route then the AI reaches the end of its route and RTB immediately before detecting any target to shoot at. So try making the route longer.

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

Best guess it is the task itself. Make sure it has at least 10km of a route because the conditions when an AI spawns might not be the same as it was at mission start. For example at mission start the player or another target are directly in front of the AI, the moment they spawn they detect and begin to attack the target. However after it respawns the player/target might not be immediately detected due to location, thus they continue their route until they find a target. If they had a short route then the AI reaches the end of its route and RTB immediately before detecting any target to shoot at. So try making the route longer.

Hi Grimes, thanks for the input! The problem is the bots do not engage even if I lock them. They just pasively defend and basically die. I also added orbiting task for them not ot go RTB if they dont see targets. I'll try to increase the route and see what happens. When the AI respawns hte task field in F10 map view is empty though it's CAP when it spawns the first time.

 

Thanks,

Roman


Edited by Rmnsvn
Link to comment
Share on other sites

Hi, last update (DCS 2.5.6.52196 Open Beta) seems to have messed up something with MIST ?

 

A mission I'm working on now gives a ton of script issues when I spawn in any airframe (ex : 1 in picture) and these issues are not related to the lua scripts loaded with the airframes.

It seems that these issues point to mist-4-3-74.lua ?

 

All was working fine some hours ago (on previous DCS beta version)... I feel a bit bad here...

 

mist.jpg.f23abff9c173a17c352b6231695549a2.jpg

Link to comment
Share on other sites

Didn't replicate on my end. Though I was using the latest 4.4.86

 

Could you attach a mission file with bugged? All I need is for the error to occur, so you can strip out as much as you please as long as the error happens.

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

Thanks for your answer.

 

I tried other missions with mist and they worked. It's this mission/scripts actually that has issue with latest DCS update.

 

I did a roll back to previous DCS version and all is working well. (no script error)

 

I updated again to actual version to try mist 4.4.86 but I get same script error (in fact only one, but the debug box keep coming up when closed).

 

I've no clue why this issue raised with DCS update ?

Link to comment
Share on other sites

Thanks, the mission file was quite helpful.

 

The errors weren't occurring because in the latest open beta ED fixed a bug with how errors in DCS were logged when inside of a scheduledFunction. They simply didn't occur and you had to have extra logging to know if something happened. In effect the errors were occurring in the previous build, you just didn't see them.

 

Since this is a rather important function I will add some code to try and prevent the errors from stacking.

 

 

That said I think the issue might be in your code. Looking at the F-18 script you call this to respawn the group. Which is fine and expected.

 

mist.respawnGroup('Al Minhad DEF', true) 

 

However after you respawn some of the groups, you then deactivate them:

local group = Group.getByName('Al Minhad DEF')
trigger.action.deactivateGroup(group)

 

This is not expected and is where the mist errors are coming from. Basically it spawns the group, mist gets set to check that group to see if it already exists in the database or not. Your code then despawns the group before mist can get the data. The mist functions assume that since the group had spawned milliseconds earlier that it would still be alive and accessible, but because you deactivate it neither of those are true. Hence the errors.

 

I'm not sure what the purpose of deactivating a group immediately after it got respawned is.

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

Much thanks Grimes for your help.

 

I removed the respawning of groups I want to be deactivated and all is fine. I progress with Mist by trials and errors untill it works(ish). Having error without anything new in code was disturbing - I couldn't find out by myself.

Have a nice day !

Link to comment
Share on other sites

Uploaded a potential fix on the development branch to try and fix the issues that have been occurring due to a error when mist updates the database. If it continues to happen please upload the mission file so I can test with it. For whatever reason me trying to replicate within my own little test mission fails to reproduce the result.

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

Hi Grimes,

Uploaded a potential fix on the development branch to try and fix the issues that have been occurring due to a error when mist updates the database.

Thank for the work, I just tested, and now it works again!

 

 

I didn't even add:

local group = Group.getByName('Al Minhad DEF')
trigger.action.deactivateGroup(group)

 

In the mission, I just remplaced mist_4_3_74.lua by the mist_4_4_87.lua from the dev' branch and it's fine

 

Thank you for the fast fix :thumbup:

My DCS contributions:
- My mods/skins: here
- My server/missions scripts: there
- My Discord bot:
this place
If you want to thank me buying a coffee☕/beer🍺, feel free:
https://www.buymeacoffee.com/Astazou

Link to comment
Share on other sites

Uploaded a potential fix on the development branch to try and fix the issues that have been occurring due to a error when mist updates the database. If it continues to happen please upload the mission file so I can test with it. For whatever reason me trying to replicate within my own little test mission fails to reproduce the result.

 

I started having the same errors as above in the checkSpawnedEventsNew function after DCS update a couple weeks ago in a mission I have been running online for a few months. The only MIST functions I am using in the mission are map object checks with no calls to spawn or respawn through MIST.

 

I just dropped in 4.4.87 into the mission and have it running online.

 

I will try to remember to report back.

 

 

 

 

EDsignaturefleet.jpg

Link to comment
Share on other sites

Dead and damaged units

 

Hello. Im starting to do some lua scripting, im in a very beginner state yet. But im super interested in MIST, awesome work!

I have read almost all pages but a I haven't got a final conclusion about this:

Can I get a list of dead units after a mission ends? Most sure the answer is yes.

But Im not sure how to save that info so I can read it in another mission.

My objective is to be able to run a mission and in the next mission units destroyed or damaged should simply be removed or deactivated, so a very interesting "interactive" scenario would be possible.

Most sure this has already been done? If so can someone point me to an example mission or show me the scripting to do this?

Thanks very much in advance

Link to comment
Share on other sites

My range script using mist does not pick up hits by the SLAM. It is fine with LGB, JDAMs etc. Do I have to add SLAM to the script somehow for it to recognize the hit?

 

I dont think there is anything special about the slam and hit events. Are you checking for just the hit and the weapon name?

 

Can I get a list of dead units after a mission ends? Most sure the answer is yes.

But Im not sure how to save that info so I can read it in another mission.

My objective is to be able to run a mission and in the next mission units destroyed or damaged should simply be removed or deactivated, so a very interesting "interactive" scenario would be possible.

Most sure this has already been done? If so can someone point me to an example mission or show me the scripting to do this?

Thanks very much in advance

 

A lot of people have done something like this. People tend to make their own and use it for specific purposes withing their own missions. The game by default does save all of the events that occur in the debrief.log in your savedgames/DCS/Logs folder. Most modify the game to allow the reading and writing of files.

 

Mist does keep track of all dead objects via the database mist.DBs.deadObjects. So you could periodically write that table to a file. Alternatively you can create your own event handler that updates and writes to a file for whenever certain types of objects die. For instance if you don't want to track world objects or clients you don't have to.

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 dont think there is anything special about the slam and hit events. Are you checking for just the hit and the weapon name?

 

 

 

A lot of people have done something like this. People tend to make their own and use it for specific purposes withing their own missions. The game by default does save all of the events that occur in the debrief.log in your savedgames/DCS/Logs folder. Most modify the game to allow the reading and writing of files.

 

Mist does keep track of all dead objects via the database mist.DBs.deadObjects. So you could periodically write that table to a file. Alternatively you can create your own event handler that updates and writes to a file for whenever certain types of objects die. For instance if you don't want to track world objects or clients you don't have to.

 

 

Thanks for the info. I have tried loking for examples, and found nothing. Do you have any example I can see? im not really skilled in LUA si It would help me a lot to see some examples on how to do this.

Link to comment
Share on other sites

  • 3 weeks later...

hi,

mist.goroute for aircraft (helicopter) with AGL/RADIO altitude tips

 

mist.dynAdd a helicopter with waypoint(s) at a scpecified altitude with "RADIO" altitude type is ok - but dynamically adding further waypoints with "RADIO" altitude isn't ok.

 

I've failed since a long time to make it work with mist.heli.buildWP and AGL/RADIO type altitude. The synthax in manual is for exemple :

 

path[#path + 1] = mist.heli.buildWP(startPoint, TurningPoint, 170, 10, 'agl') --means speed 170, altitude 10 above ground level.

 

And it's said that without altitude type specified it defaults to agl/radio. But it doesn't work and without alt.type it defaults to asl/baro in fact.

 

I wanted to use it to build waypoints at specified altitude above a ground group, but impossible to find a working synthax ('agl', "agl", 'radio', "RADIO", etc...) and ASL/BARO altitude doesn't fit (heli will be too high or too low - even crash - relative to ground group's altitude).

I found this synthax that works for me :

 

local dest = mist.getRandPointInCircle(mist.getLeadPos('Red Target Group'), 1000, 200)

local startPoint = mist.getLeadPos('Blue Defender Group ' .. enemyFighterCount)

local path = {}

path[#path + 1] = mist.heli.buildWP(startPoint, TurningPoint, 40, land.getHeight(mist.utils.makeVec2(mist.getLeadPos('Red Target Group')))+500)

path[#path + 1] = mist.heli.buildWP(dest, TurningPoint, 40, land.getHeight(mist.utils.makeVec2(mist.getLeadPos('Red Target Group')))+500)

mist.goRoute('Blue Defender Group ' .. enemyFighterCount, path)

 

This way the heli always get a waypoint at altitude of ground group + 500, with speed 40.

 

1) If someone knows the real working synthax please share. Without the real working synthax be aware that land.getHeight allows a workaround for AGL/radio type altitude.

 

2) I use this, repeating every 60/90s this function that build a waypoint/ give goroute task to heli, so the heli is "escorting" the ground group until it reaches its destination (and engaging air or ground threats with CAS task option set), BECAUSE I fail to make DCS_task_escort (https://wiki.hoggitworld.com/view/DCS_task_escort) to work.

If someone has a working exemple of DCS escort task (heli escorting ground vehicles), I'm interested.

Link to comment
Share on other sites

  • 4 weeks later...

mist.respawn task bug ?

 

Probably known, if bug true, but here two situations (2 tracks) when mist.respawnGroup('GroupName', true) does bug relative to main tasks. (exemple is tanker, but same with AWACS or others)

 

1) if group is late activated, mist.respawn don't keep tasks and tanker can't be contacted.

 

2) if group (no late act.) is respawned 1 time, it's ok (tanker does his task), but if respawned a second time then same issue as 1).

 

It's not a major problem as instead of respawning M.E. groups I can simply mist.dynAdd similar groups (if groups still exist then destroy and dynAdd same group = same as respawn) and then tasks are kept.

But I think there is maybe an issue to fix ?

mist-respawn-late-activ-bug.trk

mist-2-respawn-bug.trk

Link to comment
Share on other sites

Scuze me for being thick here but how do i download the 4.4.88? it only gets me 4.3.74

Supercarrier | Flaming Cliffs 3 | M-2000C | AJS-37 Viggen| MIG-21Bis | L-39 Albatros | Yak-52 | Spitfire LF MK IX | Mig-15Bis | Mig-19P Farmer | P-51D Mustang | F/A-18 | F-14 | F-5E Tiger II | C-101 Aviojet | I-16 | UH-1H Huey | Mil MI-8tv2 | Sa 342M Gazelle | Combined Arms | NS-430 Navigation System | NEVADA | Persian Gulf | Normandy1944 | World war II assets pack | Black Shark 2 | F-5E Agressors ACM campaign |F-5E Agressors BFM Campaign | L-39 Albatros Kursant Campaign | DCS:Syria

Link to comment
Share on other sites

here : https://github.com/mrSkortch/MissionScriptingTools/tree/development

 

Click on green button "code" then "download zip".

 

Thank you!

Supercarrier | Flaming Cliffs 3 | M-2000C | AJS-37 Viggen| MIG-21Bis | L-39 Albatros | Yak-52 | Spitfire LF MK IX | Mig-15Bis | Mig-19P Farmer | P-51D Mustang | F/A-18 | F-14 | F-5E Tiger II | C-101 Aviojet | I-16 | UH-1H Huey | Mil MI-8tv2 | Sa 342M Gazelle | Combined Arms | NS-430 Navigation System | NEVADA | Persian Gulf | Normandy1944 | World war II assets pack | Black Shark 2 | F-5E Agressors ACM campaign |F-5E Agressors BFM Campaign | L-39 Albatros Kursant Campaign | DCS:Syria

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...