Jump to content

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua


Recommended Posts

Yep! And the ME is looking more and more polished. Really unsung in the release notes, but great direction ED! Kudos!

 

Also, I noticed a new start position option for aircraft! Ramp hot. Nice touch! Now you can start on rwy or in parking cold / hot, your choice (I assume, haven't tried it out yet myself, just peeked).

 

Lots of goodies! I continue to support all ME development efforts and hope they continue the trend because the ME is what will keep fresh, rich missions coming out from the community.

 

Again, really positive release! Thanks guys!

"Snipe"

--------------------------------------------------------------------------------

OS => Win7 64-bit Ultimate | MOBO => ASUS M2N-SLI Deluxe | RAM => 8GB | VIDEO CARD => XFX ATI 4850 | CONTROLLER => Saitek X52 | DISPLAY => ASUS 25.5" 1600x1280 | HDD => 150GB WD Raptor (10K RPM)

Link to comment
Share on other sites

Btw, heres a working example:

 

coalition.addGroup(0, Group.Category.GROUND, {
                               ["visible"] = true,
                               ["taskSelected"] = true,
                               ["route"] = 
                               {
                                   ["spans"] = 
                                   {
                                   }, -- end of ["spans"]
                                   ["points"] = 
                                   {
                                       [1] = 
                                       {
                                           ["alt"] = 10,
                                           ["type"] = "Turning Point",
                                           ["ETA"] = 0,
                                           ["alt_type"] = "BARO",
                                           ["formation_template"] = "",
                                           ["y"] = 631114.28571429,
                                           ["x"] = -328142.85714286,
                                           ["ETA_locked"] = true,
                                           ["speed"] = 5.5555555555556,
                                           ["action"] = "Off Road",
                                           ["task"] = 
                                           {
                                               ["id"] = "ComboTask",
                                               ["params"] = 
                                               {
                                                   ["tasks"] = 
                                                   {
                                                   }, -- end of ["tasks"]
                                               }, -- end of ["params"]
                                           }, -- end of ["task"]
                                           ["speed_locked"] = true,
                                       }, -- end of [1]
                                   }, -- end of ["points"]
                               }, -- end of ["route"]
                               ["groupId"] = 1,
                               ["tasks"] = 
                               {
                               }, -- end of ["tasks"]
                               ["hidden"] = false,
                               ["units"] = 
                               {
                                   [1] = 
                                   {
                                       ["y"] = 631114.28571429,
                                       ["type"] = "T-72B",
                                       ["name"] = "Unit #12",
                                       ["unitId"] = 1,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328142.85714286,
                                   }, -- end of [1]
                                   [2] = 
                                   {
                                       ["y"] = 631154.28571429,
                                       ["type"] = "T-72B",
                                       ["name"] = "Unit #13",
                                       ["unitId"] = 13,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328182.85714286,
                                   }, -- end of [2]
                                   [3] = 
                                   {
                                       ["y"] = 631194.28571429,
                                       ["type"] = "T-72B",
                                       ["name"] = "Unit #14",
                                       ["unitId"] = 14,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328222.85714286,
                                   }, -- end of [3]
                                   [4] = 
                                   {
                                       ["y"] = 631134.28571429,
                                       ["type"] = "T-72B",
                                       ["name"] = "Unit #15",
                                       ["unitId"] = 15,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328262.85714286,
                                   }, -- end of [4]
                                   [5] = 
                                   {
                                       ["y"] = 631174.28571429,
                                       ["type"] = "ZSU-23-4 Shilka",
                                       ["name"] = "Unit #16",
                                       ["unitId"] = 16,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328302.85714286,
                                   }, -- end of [5]
                                   [6] = 
                                   {
                                       ["y"] = 631114.28571429,
                                       ["type"] = "BMP-2",
                                       ["name"] = "Unit #17",
                                       ["unitId"] = 17,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328342.85714286,
                                   }, -- end of [6]
                                   [7] = 
                                   {
                                       ["y"] = 631154.28571429,
                                       ["type"] = "BMP-2",
                                       ["name"] = "Unit #18",
                                       ["unitId"] = 18,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328382.85714286,
                                   }, -- end of [7]
                                   [8] = 
                                   {
                                       ["y"] = 631194.28571429,
                                       ["type"] = "BMP-2",
                                       ["name"] = "Unit #19",
                                       ["unitId"] = 19,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328422.85714286,
                                   }, -- end of [8]
                                   [9] = 
                                   {
                                       ["y"] = 631134.28571429,
                                       ["type"] = "BMP-2",
                                       ["name"] = "Unit #20",
                                       ["unitId"] = 20,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328462.85714286,
                                   }, -- end of [9]
                                   [10] = 
                                   {
                                       ["y"] = 631174.28571429,
                                       ["type"] = "MTLB",
                                       ["name"] = "Unit #21",
                                       ["unitId"] = 21,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328502.85714286,
                                   }, -- end of [10]
                                   [11] = 
                                   {
                                       ["y"] = 631114.28571429,
                                       ["type"] = "MTLB",
                                       ["name"] = "Unit #22",
                                       ["unitId"] = 22,
                                       ["heading"] = 0,
                                       ["playerCanDrive"] = true,
                                       ["skill"] = "High",
                                       ["x"] = -328542.85714286,
                                   }, -- end of [11]
                               }, -- end of ["units"]
                               ["y"] = 631114.28571429,
                               ["x"] = -328142.85714286,
                               ["name"] = "New Vehicle Group2",
                               ["start_time"] = 0,
                               ["task"] = "Ground Nothing",
                           })

 

So you have to enter manually the coordinates of the groups that will spawn in the script? Or can the groups spawn in random positions?

 

And one more ( :smartass:) . Can a group spawn in a moving zone (e.g. a Huey) ?

Thanks in advance.

"ARGO" DCS UH-1H DLC SP Campaign

373vFS DCS World squadron (Greece) - www.buddyspike.net

"ARGO 2.0 Project Phoenix" UH-1H DLC Campaign - WIP

Link to comment
Share on other sites

http://forums.eagle.ru/showpost.php?p=1738368&postcount=2

 

See my 2nd example in there. Takes the a zone named "spawnZoneA" and randomly spawns Shilkas inside it. It also generates a random groupId, unitId, and groupName, and unitName which are all required to be unique in order for the unit to spawn and not replace something.

 

I do sort of have a WIP script to respawn groups or to "teleport" them for MIST. However spawning new groups is a little tricky as the databases would need to be updated and we have to figure out an efficient way to do that.

 

We might release Mist 2.0 and then follow it up with several small updates adding assorted new functions which utilize the new scripting engine features.

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

Oh man really? You can just add a new group while the mission is running? Unlimited taskings and persistant world problems begin to get solved!

I would imagine a player bubble wouldnt be too hard to implement now. What would, on the other hand, be hard to implement is a strategic engine/2D world. Modding an existing strategic game, like http://openpanzer.net/ would IMHO be ideal. What do you think?

DCS AJS37 HACKERMAN

 

There will always be bugs. If everything is a priority nothing is.

Link to comment
Share on other sites

Mist 2.0

 

Speed is having finals week, but I feel this needs to get released given the 1.2.4 patch is now out. Speed will update the initial post when he can.

 

Attached is Mist 2.0. We've added quite a bit and honestly should have released it sooner than we have. The changelog is below, but a quick summery is this:

 

New Message System derived from the one I published with the mission Tbilisi Airlift. The message system is capable of displaying several different messages to whichever player aircraft you want. Messages will NOT over-write each other, instead the messages are automatically appended to the currently displayed message.

 

Several functions related to unit conversion and coordinate display

 

Several functions for adding new tasks to AI including "go to random point" and "buildWP" functions for customized paths.

 

 

Changelog

 

 

- added mist.utils.metersToNM

- added mist.utils.metersToFeet

- added mist.utils.NMToMeters

- added mist.utils.feetToMeters

- added mist.utils.mpsToKnots

- added mist.utils.mpsToKmph

- added mist.utils.knotsToMps

- added mist.utils.kmphToMps

- added mist.utils.get2DDist

- added mist.utils.get3DDist

 

- added mist.tostringMGRS

- added mist.tostringLL

- added mist.tostringBR

- added mist.getLeadingLLString

- added mist.getLeadingBRString

- added mist.getRandPointInCircle

- added mist.getAvgPos

- added mist.getLeadPos

- added mist.getMGRSString

- added mist.getLeadingMGRSString

- added mist.getLLString

- added mist.getBRString

 

- added mist.vec.getUnitVec

- added mist.vec.rotateVec2

 

- added Mist Message System

- added mist.message.add

- added mist.message.remove

 

- added mist.goRoute

- added mist.getGroupRoute

- added mist.groupToPoint

- added mist.groupToRandomZone

- added mist.groupRandomDistSelf

- added mist.ground.buildWP

- added mist.fixedWing.buildWP

- added mist.heli.buildWP

- added heading and 'player can drive' to units databases

 

 

 

If I missed anything from the documentation let me know. We do have several scripts related to the new 1.2.4 scripting engine features that we need to add/modify for Mist, however they are currently a WIP. Dynamically spawned AI changes some things. Without having to re-do some of the DB code a "group respawn" or "groupTeleport" functions might be possible. :)

Mist v2_0.rar


Edited by Grimes
  • 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

Yes it can.... but I should probably explain what that init script is used for, in addition to a somewhat undocumented and crazy useful feature.

 

Init Script: Loads before any other script within the mission loads. Specifically its supposed to be used in conjunction with the "condition" box that now appears below a groups name. This is a lua condition that can define whether or not the group will even spawn into the mission. The Init script is the only script file that loads before the condition script, if it even exists, would be run.

The order of execution of scripts is now the following:

1. Init Script

2. Group Condition Script

3. Mission Start Trigger with Script

4. Group Script Tasks on first WP (providing group has spawned)

5. Any script or script file run after the start of the mission.

 

 

The other super cool feature is that scripts used withing a groups waypoint action or triggered action now have a "self" variable. The self variable is a ... and can be used to return a group table. For instance, these two are the same:

local groupTable = ...

local groupTable = Group.getByName('WhateverThisGroupsNameIs')

 

Those are the same. It makes it easier if you have some script you want multiple groups to do when you start a mission. For example, with a new Mist function I used it like this:

local gp = ...
mist.groupToRandomZone(gp, 'zoneA')


Edited by Grimes
  • 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

  • ED Team

Grimes & Speed... thanks for consuming my free time, the wife hates you ;)

 

For the spawning of vehicles, do you think there might be any way to restrict where it spawns, say limit it from spawning in water? I know general you cant place a vehicle in water, but I noticed using the spawn in zone it will spawn where ever it feels like... and if thats a middle of a lake then so be it :)

 

Not a big deal, but just wondering if the restrictions of the ME could be translated to the scripting engine.

64Sig.png
Forum RulesMy YouTube • My Discord - NineLine#0440• **How to Report a Bug**

1146563203_makefg(6).png.82dab0a01be3a361522f3fff75916ba4.png  80141746_makefg(1).png.6fa028f2fe35222644e87c786da1fabb.png  28661714_makefg(2).png.b3816386a8f83b0cceab6cb43ae2477e.png  389390805_makefg(3).png.bca83a238dd2aaf235ea3ce2873b55bc.png  216757889_makefg(4).png.35cb826069cdae5c1a164a94deaff377.png  1359338181_makefg(5).png.e6135dea01fa097e5d841ee5fb3c2dc5.png

Link to comment
Share on other sites

The other super cool feature is that scripts used withing a groups waypoint action or triggered action now have a "self" variable. The self variable is a ... and can be used to return a group table. For instance, these two are the same:

local groupTable = ...

local groupTable = Group.getByName('WhateverThisGroupsNameIs')

 

Those are the same. It makes it easier if you have some script you want multiple groups to do when you start a mission. For example, with a new Mist function I used it like this:

local gp = ...

mist.groupToRandomZone(gp, 'zoneA')

 

(the emoticon to show how much I'm happy to read this have to be created yet) :beer:

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

For the spawning of vehicles, do you think there might be any way to restrict where it spawns, say limit it from spawning in water? I know general you cant place a vehicle in water, but I noticed using the spawn in zone it will spawn where ever it feels like... and if thats a middle of a lake then so be it :)

 

Yes. land.getSurfaceType()

One of the mist WIP functions is to verify a coordinate is of the right type. It might also be useful for finding roads to better script AI navigation. Screen_130116_195527.jpg

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

  • ED Team

Duh, I forgot that was there... ok let me play around with that and see if I cant keep my SAMs out of the water :)

 

Thanks!

 

Yes. land.getSurfaceType()

One of the mist WIP functions is to verify a coordinate is of the right type. It might also be useful for finding roads to better script AI navigation. Screen_130116_195527.jpg

64Sig.png
Forum RulesMy YouTube • My Discord - NineLine#0440• **How to Report a Bug**

1146563203_makefg(6).png.82dab0a01be3a361522f3fff75916ba4.png  80141746_makefg(1).png.6fa028f2fe35222644e87c786da1fabb.png  28661714_makefg(2).png.b3816386a8f83b0cceab6cb43ae2477e.png  389390805_makefg(3).png.bca83a238dd2aaf235ea3ce2873b55bc.png  216757889_makefg(4).png.35cb826069cdae5c1a164a94deaff377.png  1359338181_makefg(5).png.e6135dea01fa097e5d841ee5fb3c2dc5.png

Link to comment
Share on other sites

Yes. land.getSurfaceType()

One of the mist WIP functions is to verify a coordinate is of the right type. It might also be useful for finding roads to better script AI navigation.

Screen_130116_195527.jpg

Wait, how'd you get that image?

 

Incidentally, what would it take to get the ME to allow for a 3d rendered map? It would be soooo handy for making flight plans through valleys.

"Snipe"

--------------------------------------------------------------------------------

OS => Win7 64-bit Ultimate | MOBO => ASUS M2N-SLI Deluxe | RAM => 8GB | VIDEO CARD => XFX ATI 4850 | CONTROLLER => Saitek X52 | DISPLAY => ASUS 25.5" 1600x1280 | HDD => 150GB WD Raptor (10K RPM)

Link to comment
Share on other sites

Wait, how'd you get that image?

 

Incidentally, what would it take to get the ME to allow for a 3d rendered map? It would be soooo handy for making flight plans through valleys.

 

I think he used two for loops to put some smoke over the area, using a color depending on the return value of the mentioned function.

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

I think he used two for loops to put some smoke over the area, using a color depending on the return value of the mentioned function.

ROFL! That's one trigger happy FAC with the Whiskey Pete! :)

 

Good call Oznerol :thumbup:

"Snipe"

--------------------------------------------------------------------------------

OS => Win7 64-bit Ultimate | MOBO => ASUS M2N-SLI Deluxe | RAM => 8GB | VIDEO CARD => XFX ATI 4850 | CONTROLLER => Saitek X52 | DISPLAY => ASUS 25.5" 1600x1280 | HDD => 150GB WD Raptor (10K RPM)

Link to comment
Share on other sites

I created a "box" that is defined by two trigger zones in opposite corners and then iterated through coordinates at about 25m accuracy by rows and columns. Anything higher than that would explode my GFXcard. I checked what type of terrain was at a given coordinate, based on the type of terrain a different color of smoke would be spawned.

White = Land

Red = Runway

Green = Road

Blue = water

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

What I am missing guys ?

 

Thank you for help !

 

local myPos= Unit.getByName('Alexej'):getPosition().p

local myPos = {}

local data = {

["visible"] = false,

["groupId"] = math.random(10, 20),

["tasks"] =

{

}, -- end of ["tasks"]

["hidden"] = false,

["units"] =

{

[1] =

{

["y"] = myPos.z + 1,

["type"] = "ZSU-23-4 Shilka",

["name"] = string.char(math.random(65,90)),

["unitId"] = math.random(40, 50),

["heading"] = 0,

["playerCanDrive"] = true,

["skill"] = "Average",

["x"] = myPos.x + 1,

}, -- end of [1]

}, -- end of ["units"]

--["y"] = 650342.85714286,

--["x"] = -292285.71428571,

["name"] = string.char(math.random(65,90)),

--["start_time"] = 0,

--["task"] = "Ground Nothing",

} -- end of [1]

 

coalition.addGroup(country.id.RUSSIA, Group.Category.GROUND, data)

 

 

 

********************************************************************

 

DCS LOG>:

00052.051 ERROR DCS: Mission script error: : [string "local myPos= Unit.getByName('Alexej'):getPo..."]:14: attempt to perform arithmetic on field 'z' (a nil value)

stack traceback:

[C]: ?

[string "local myPos= Unit.getByName('Alexej'):getPo..."]:14: in main chunk


Edited by alexej21

[sIGPIC][/sIGPIC]

.....Vladimir, let's go to Sukhoi.......

Link to comment
Share on other sites

Remove 'local myPost = {}" as that is essentially deleting the actual values it gets from "myPos = Unit.getBy..."

 

Also you might just want to "hardcode" the the unit name, unitId, groupId, and groupName rather than using the math.random to assign it.

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

Thank you Grimes.

I'm a totaly newbie to the LUA coding.

 

This makes possible to deploy the infantry on the field from the UH1 :thumbup:

 

Would be possible to use similar code to make infantry to run to your chopper as evacuation ?

-Get your position and then set waypoint for the infatry...

[sIGPIC][/sIGPIC]

.....Vladimir, let's go to Sukhoi.......

Link to comment
Share on other sites

Good morning,

Problem again.

 

"type"] = "ZSU-23-4 Shilka", - works

"type"] = "M4", - nothing happened, no crash, but no unit appeared..

 

Thx

 

try Soldier M249 and Soldier M4

  • Like 1

Playing: F-16C

Intel i7-13700KF, 64GB DDR5 @5600MHz, RTX 4080 ZOTAC Trinity, WIN 11 64Bit Prof.

Squadron "Serious Uglies" / Discord-Server: https://discord.gg/2WccwBh

Ghost0815

Link to comment
Share on other sites

  • ED Team
Yes. land.getSurfaceType()

One of the mist WIP functions is to verify a coordinate is of the right type. It might also be useful for finding roads to better script AI navigation.

 

Sorry, was looking at it this morning and couldnt figure out how I use this with say the code you posted for random placement of a vehicle?

 

Thanks for any help.

64Sig.png
Forum RulesMy YouTube • My Discord - NineLine#0440• **How to Report a Bug**

1146563203_makefg(6).png.82dab0a01be3a361522f3fff75916ba4.png  80141746_makefg(1).png.6fa028f2fe35222644e87c786da1fabb.png  28661714_makefg(2).png.b3816386a8f83b0cceab6cb43ae2477e.png  389390805_makefg(3).png.bca83a238dd2aaf235ea3ce2873b55bc.png  216757889_makefg(4).png.35cb826069cdae5c1a164a94deaff377.png  1359338181_makefg(5).png.e6135dea01fa097e5d841ee5fb3c2dc5.png

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