Jump to content

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua


Recommended Posts

1 hour ago, Dlang said:

Hi,

 

Is mist.flagFunc.units_in_moving_zones{ broken ? Can't get it to work...

 

It works... but in example it lacks the parenthesis :

 

mist.flagFunc.units_in_moving_zones({ units = {'[blue]'}, zone_units = {'[red]'}, flag = 500, radius = 10000, stopflag = 9999, req_num = 4, zone_type = 'sphere', interval = 10, })

Link to comment
Share on other sites

  • 4 weeks later...

 

Folks,

 

Can we clarify the latest version of MIST ?

 

github shows version 4.4.9 to be latest, and I am using this with great success.

https://github.com/mrSkortch/MissionScriptingTools

 

But I am after the "mist.projectPoint" function, which was implemented in 4.5.

https://wiki.hoggitworld.com/view/MIST_projectPoint

 

I'm unable to locate a repository for version 4.5.

 

Any help appreciated.

 

 

Link to comment
Share on other sites

20 minutes ago, Cheyenne56 said:

...github shows version 4.4.9 to be latest, and I am using this with great success.

https://github.com/mrSkortch/MissionScriptingTools...

 

This link you provided is the good one, except what is displayed is "master" branche (4.4.9). Click on "master" button and select "development" and you'll have the version you want (4.5.98)

Link to comment
Share on other sites

 

4 hours ago, toutenglisse said:

 

This link you provided is the good one, except what is displayed is "master" branche (4.4.9). Click on "master" button and select "development" and you'll have the version you want (4.5.98)

 

Ah 🙂,  Much Thanks !

 

 

Link to comment
Share on other sites

  • 2 weeks later...

@Grimes  do you know if there are plans to update MIST to account for the current crashes that seem to be related to eject events?
MOOSE has had similar issues and they've put out a short fix as per here: https://github.com/FlightControl-Master/MOOSE/pull/1490/files
 

We are having crashed on Storm of War. Our log lines seem to be responding to the same problem as per here:

2021-04-23 09:31:13.121 INFO    Scripting: event:type=end shooting,initiatorPilotName=VF17-StuFly,t=17579.2,weapon=Browning .50 M2,initiatorMissionID=247,
2021-04-23 09:31:19.669 WARNING LOG: 3 duplicate message(s) skipped.
2021-04-23 09:31:19.669 WARNING EDOBJECTS: RegMapStorage::ForceID() - id is busy
2021-04-23 09:31:19.669 ERROR   EDOBJECTS: Failed assert `success` at Projects\edObjects\Source\Registry\RegMapStorage.cpp:178
2021-04-23 09:31:19.669 INFO    Scripting: event:type=eject,initiatorPilotName=VF17-StuFly,target=,t=17585.744,initiatorMissionID=247,targetMissionID=0,
2021-04-23 09:31:19.669 ERROR   Lua::Config: Call error world.onEvent:[string "-- world events hook..."]:452: Unit doesn't exist
stack traceback:
	[C]: ?
	[C]: in function 'getName'
	[string "-- world events hook..."]:452: in function <[string "-- world events hook..."]:428>.

On YouTube: https://www.youtube.com/philstylenz

Storm of War WW2 server website: https://stormofwar.net/

 

Link to comment
Share on other sites

Just thought I'd throw this out there for those using Mist that want to grab the weather presets.

 

Adding this under 'mist.DBs.missionData.version = env.mission.version'

mist.DBs.missionData.weather = env.mission.weather.clouds.preset

Will allow you to grab which preset is in the mission with this

local weather = env.mission.weather.clouds.preset

 Attached is a lua with strings of the METARs and cloud description.

weatherPresets.lua


Edited by TonyG
Link to comment
Share on other sites

19 hours ago, philstyle said:

@Grimes  do you know if there are plans to update MIST to account for the current crashes that seem to be related to eject events?
MOOSE has had similar issues and they've put out a short fix as per here: https://github.com/FlightControl-Master/MOOSE/pull/1490/files
 

Thats slmod not mist. The only event handlers mist has is for checking for dead objects and birth events. 

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

  • 2 weeks later...
On 11/1/2020 at 7:54 AM, Grimes said:

Not sure about the EWRS script, I've never used it.

 

 

The respawn/clone/teleportInZone functions are more meant for ground units with no route. If you used my example you can get their existing route data via mist.getGroupRoute(gpName, true).

 

newGroup.route = mist.getGroupRoute('whatever', true)

 

Now the important thing to keep in mind with all this is that the route data is what was assigned and setup in the editor. Coordinates of waypoints and tasks won't be shifted. The solution is to either shift them similar to what I did with each unit in the group or create a new flight plan and tasks based on what you need them to do. Which can be done either by assigning a task directly or assigning a mission task which has their flight plan and other tasking information.

I am having some problems assigning tasking. Was wondering if anyone can give me an example?

 

I am spawning Mig29 using mist.respawnInZone. However they RTB immediately after spawning. They don't seem to follow the waypoints and tasking assigned in ME.

 

I have also tried mist.respawnGroup which works, but there is no randomisation. I used mist.teleportInZone but the units once again seem to RTB immediately after.

 

I've seen the post by Grimes but the coding really flies over my head... Tried examples but can't seem to understand what to do


Edited by crispy12
Link to comment
Share on other sites

9 hours ago, crispy12 said:

I am having some problems assigning tasking. Was wondering if anyone can give me an example?

 

I am spawning Mig29 using mist.respawnInZone. However they RTB immediately after spawning. They don't seem to follow the waypoints and tasking assigned in ME.

 

I have also tried mist.respawnGroup which works, but there is no randomisation. I used mist.teleportInZone but the units once again seem to RTB immediately after.

 

I've seen the post by Grimes but the coding really flies over my head... Tried examples but can't seem to understand what to do

 

 

Hi, here is an exemple using respawnInZone on a late activation airborne unit (S3B) that has no task and no route.

 

At Time>2sec the unit in respawned in "Respawn" zone, and a "DoScript" assign a route (using mist.goRoute) with 1 waypoint, a main task (tanker), an "Orbit" task when waypoint is reached, and also a RTB on bingo option, a radiocom frequency and a beacon (Tacan). (you can see on F10/map the assigned route when you "click" on the S3B unit)

 

A player F18 is on ground hot start and you can hear tanker reporting "on station" when he starts orbiting on Wpt (com2 is set to his freq.). You can then ask for air refuel.

In exemple the Wpt is on fixed coordinates but it can be randomized on another zone, or near an other unit, or whatever, and you can set as many Wpt as you need.

test-RespawnInZone-tanker.miz


Edited by toutenglisse
Link to comment
Share on other sites

19 hours ago, toutenglisse said:

 

Hi, here is an exemple using respawnInZone on a late activation airborne unit (S3B) that has no task and no route.

 

At Time>2sec the unit in respawned in "Respawn" zone, and a "DoScript" assign a route (using mist.goRoute) with 1 waypoint, a main task (tanker), an "Orbit" task when waypoint is reached, and also a RTB on bingo option, a radiocom frequency and a beacon (Tacan). (you can see on F10/map the assigned route when you "click" on the S3B unit)

 

A player F18 is on ground hot start and you can hear tanker reporting "on station" when he starts orbiting on Wpt (com2 is set to his freq.). You can then ask for air refuel.

In exemple the Wpt is on fixed coordinates but it can be randomized on another zone, or near an other unit, or whatever, and you can set as many Wpt as you need.

test-RespawnInZone-tanker.miz 61.06 kB · 0 downloads

 


Wow! Thanks so much for the detailed reply.
I am new to LUA scripting so most of this flies over my head. I will take the time to analyze and learn it.

Link to comment
Share on other sites

  • 1 month later...

Hello,

Just started looking into MIST after I used Moose for some time and I have question please.

 

Is there way to clone group on zone position with all waypoints and options kept intact? Similar to Moose Spawn function?

 

It works only if I use Clone, If I use CloneInZone all that info is lost.

 

Thanks for any help.

Link to comment
Share on other sites

cloneInZone and the other InZone functions are more meant for stationary groups to get randomization without a ton of input values. I've always viewed it as something where it'd be pointless to randomize the start position and then re-use the exact same route. Perhaps offset every point in the route makes more sense, but only to a degree since it'd be more or less fine with aircraft but create who knows what kind of route for ground groups. At a certain point you can make your own function to achieve the results you desire.

 

local gp = mist.getGroupData('whatever', true)
gp.clone = true
local rndZone = trigger.misc.getZone('someZone')
local rnd = mist.getRandPointInCircle(rndZone.point ,rndZone.radius)
local offset = {x = gp.units[1].x - rnd.x, y = gp.units[1].y = rnd.y}
for i = 1, #gp.units do
	gp.units[i].x =  gp.units[i].x + offset.x
  	gp.units[i].y =  gp.units[i].y + offset.y
end
for i = 1, #gp.route do
  	gp.route[i].x = gp.route[i].x + offset.x
    gp.route[i].y = gp.route[i].y + offset.y
end
mist.dynAdd(gp)

The main difference being that the code above lacks the extra checks that teleportToPoint does to verify you aren't spawning ships on ground or aircraft under terrain. But you do have the added flexibility of ignoring whatever rules that teleportToPoint forces to occur. Again its meant as a relatively small amount of code to get easy randomization within a narrow scope. If you need to do something beyond that scope its relatively easy to use a few of mist's built in functions or the game's scripting functions to achieve the desired results with minimal extra coding. Hope that makes sense. 

  • 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

Thanks I will look into it. My problem with cloneinzone is not ground route, I am cloning stationary groups. Problems is that they doesn't retain their advanced waypoint tasks and settings. For example ROE and so on. 

 

 


Edited by ataribaby
Link to comment
Share on other sites

 

On 6/30/2021 at 2:42 PM, ataribaby said:

Thanks I will look into it. My problem with cloneinzone is not ground route, I am cloning stationary groups. Problems is that they doesn't retain their advanced waypoint tasks and settings. For example ROE and so on. 

 

 

 

Pushed an update last night that should work for you. https://github.com/mrSkortch/MissionScriptingTools/commit/c4b96b896b05d60a5384368b6b6c0e8c03933998

 

Still documenting changes in the wiki, but you can see the difference here: https://wiki.hoggitworld.com/view/MIST_cloneInZone

 

You need to add a table entry to the end of the function call. Something like: mist.cloneInZone('group', 'zone', nil, 2000, {initTasks = true}). If it is stationary you can also use the either the other inputs of offsetWP1 or offsetRoute. 

  • 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

  • 2 weeks later...

Just a quickie , I'm Using Mist 4_4_90 and I'm getting the error in the log:

 

2021-07-22 15:42:15.867 ERROR   SCRIPTING: Mission script error: [string "C:\Users\MCMac\AppData\Local\Temp\DCS.openbeta\/~mis000011B8.lua"]:114528: attempt to index field 'Airbase' (a nil value)

 

 

When I go to and open the temp file it opens a copy of the Mist_4_4_90 lua thats been stored in the above temp folder.

 

Anyone know what on earth that error in the log is referring too?

Link to comment
Share on other sites

That version of mist is only 7,347 lines long and that error occurs at line 114,528. 

 

Post the mission perhaps?

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

 

Is there a function I can use to generate a script with the specific intent of having an AI unit fly a specific heading after a flag or a trigger?

 

I read in the docs how to get the heading of the AI, so it is easy math after that (I specifically want it to turn 90 degrees right or left of the 'current' heading)

 

Thank you.

"Never argue with idiots. First they will drag you down to their level, then defeat you with experience."

Link to comment
Share on other sites

You basically have to give the AI a new route and there isn't one specific function that does only that in mist. But it is easy enough to create with functions created by mist. 


First you get the current location of the aircraft. Then you pass the start position, the distance, and heading you want it to fly into mist.projectPoint to figure out the point to use downrange as the 2nd waypoint. 

https://wiki.hoggitworld.com/view/MIST_projectPoint

 

Now you have a start point and end point. Pass each of those into mist.fixedWing.buildWP() to generate the needed format for aircraft waypoints and assigning em to a table like in the example on the wiki. 

https://wiki.hoggitworld.com/view/MIST_fixedWingBuildWP

 

Then you pass the group and the path into mist.goRoute() and it will tell the AI to fly the route you designated. 

 

https://wiki.hoggitworld.com/view/MIST_goRoute

 

 

 

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,

 

It sounds like it is going to test my insignificant scripting skills, but I will try it. Not whining, just joking: I am truly grateful for the help.

 

 

"Never argue with idiots. First they will drag you down to their level, then defeat you with experience."

Link to comment
Share on other sites

  • 3 weeks later...

Development branch updated: https://github.com/mrSkortch/MissionScriptingTools/commit/28da804e8013c88828ddd0870ce48acd496917e4

 

Big new feature are the mist.marker functions which are useful for drawing shapes on the map. Documentation on the wiki will be added soon. 

 

FIXED: typo in mist.dynAdd

FIXED: typo is mist.teleportToPoint

 

ADDED: mist.getUnitsByAttribute

ADDED: mist.getGroupsByAttribute

 

Both of those functions are meant to be an alternative way of getting a unit and group list from the database quickly. Similar to mist.makeUnitTable in a sense. 

 

ADDED: mist.stringCondense


Function that excludes a bunch of characters from a string for use with string comparison. 

 

ADDED: mist.debug.changeSetting

 

Function to change the default settings for stuff like logging within mist. 

 

ADDED: mist.marker.add

ADDED: mist.marker.getNextId

ADDED: mist.marker.remove

ADDED: mist.marker.get

 

Functions to add, remove, and get information on markers and shapes.  

  • Like 1
  • Thanks 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

  • 2 weeks later...

Hi everybody!

 

I'm trying to make a respawnable air defense site using respawnGroup command. However, though I tested it with aircraft and it worked, it fails to respawn ground targets. Is it because it is a stationary AA site, and the script won't respawn units inside dead bodies of previous group? Or is it something else?

[sIGPIC][/sIGPIC]

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