Jump to content

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua


Recommended Posts

You could probably have a solution where you combine it with the dynamic campaign system where you have different missions for different objectives and they all load from the same save file. This approach might help with things like time of day, weather or players starting position which you can't change from within the mission. If you don't want to use EDs system, you could just instruct the player which mission to start next when the current one is ending.

DCS AJS37 HACKERMAN

 

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

Link to comment
Share on other sites

You could probably have a solution where you combine it with the dynamic campaign system where you have different missions for different objectives and they all load from the same save file. This approach might help with things like time of day, weather or players starting position which you can't change from within the mission. If you don't want to use EDs system, you could just instruct the player which mission to start next when the current one is ending.

 

Ok, thanks, i will dig on that.

Link to comment
Share on other sites

Hey guys,

 

I'm still on my personal crusade of creating some extra fidelity around the mist.respawngroup scripting.

 

My LUA learning process has got me stuck on a small speed detecting LUA predicate that keeps giving me errors that it wont accept the function.

Digging through examples and mission files i got myself the following:

 

if c_unit_speed_higher('Unit A', 50) == true then
   return true
else
   return false
end

 

or

 

if c_unit_speed_higher('Unit A', 50) then
   return true
else
   return false
end

 

Something is very or slightly wrong, but considering my rudimetary knowledge i'm not sure how to proceed to the correct format.

 

Does anyone have a pointer to make this work?

 

======================================

 

During my crusade i was also experiencing DCS.exe crashes caused in DCS's DXrenderer.dll while using the mist.respawngroup script. I'm sure it happens with all aircraft, but it does with the FA-18 and the Su-33.

 

My hardware is operating within normal parameters and everything is freshly installed. The Win 7 X64 OS last week too. Everything is updated, don't run tons of stuff in the background and don't have any problems.

 

I've included 2 example missions that generates my crash. One with MIST 3.3 loaded spawning the same 2 aircraft and one without MIST 3.3 each carrier spawning 5 aircraft.

 

The crash happens when the 2 aircraft are shot once and the mission is ended. It seems the engine keeps running when something is wrong, but messes things up eventually. These crashes also occurred in recent earlier MIST versions for me.

When only MIST is loaded and not any script used there's not a DX crash. Only in this case with respawning.

 

I have a feeling i'm not the only one, but to be sure i'm ringing this bell and a small test.

 

Problem signature:
 Problem Event Name:	APPCRASH
 Application Name:	Launcher.exe_DCS
 Application Version:	1.2.7.23803
 Application Timestamp:	52b97dcf
 Fault Module Name:	DXRenderer.dll
 Fault Module Version:	1.2.7.23803
 Fault Module Timestamp:	52b97863
 Exception Code:	c0000005
 Exception Offset:	0000000000024c8b
 OS Version:	6.1.7601.2.1.0.256.1
 Locale ID:	1033
 Additional Information 1:	2df6
 Additional Information 2:	2df67ce17c6b1fa82ac0fbe2816907f6
 Additional Information 3:	492a
 Additional Information 4:	492a1ea299e8af88b2dc69f8ea62325e

DX Crash MIST 33.miz

DX Crash TEST No MIST 33.miz


Edited by BRooDJeRo
Link to comment
Share on other sites

In DCS CA you can change the speed of active ground units. Is it possible to do the same on active aircrafts? I can't find any AI task for that in ME.

 

EDIT: In script and adding a menu. I'm specially thinking off setting tanker speed to change from fighter refuel at 275 knots and then changing to 220 for the A-10.


Edited by HiJack
typing error
Link to comment
Share on other sites

  • 2 weeks later...

toggle trouble

 

I've been trying to make use of mist.flagFunc.units_in_polygon, but I've been running into trouble with the toggle variable.

 

The code I have in use is as follows;

mist.flagFunc.units_in_polygon{
units = {'[blue][plane]', '[-c]Turkey'},
zone = mist.getGroupPoints('testaircraft'),
flag = 50041,
stopflag = 90091,
interval = 5,
--toggle = true,
}

The idea is that the flight plan for testaircraft takes it around a zone. No blue aircraft other than Turkish are to enter it, or else stuff happens. As the code is presented above, that works perfectly fine, and I couldn't be happier. Except I could.

 

The thing is, that if an aircraft leaves the zone, flag 50041 is still true, and so the next blue non-Turkish aircraft to enter the zone won't trigger the effect again. I need flag 50041 to revert to false again when the aircraft leave the zone. That's where the toggle variable comes into play. I think.

 

The documentation is a bit unclear about this. I get that it is supposed to do one of two things;

 


  1. Make mist.flagFunc.units_in_polygon work as normal, but then turn flag back to false when no more units are in the zone (this is the effect I want, and what I assume it's supposed to do).
  2. Make mist.flagFunc.units_in_polygon work inverted entirely: flag is specifically set to false when no units are in the zone (this seems a bit convoluted, but I can still use it, I'll just need to run mist.flagFunc.units_in_polygon once to turn the flag to true, then again with toggle to turn it back to false).

The problem I run into is as follows: The moment I uncomment the toggle line, the sim throws a scripting error at me the moment the script is loaded. The error is as follows;

 

[string "--MiST Mission Scripting Tools..."]:2064: attempt to call field 'getUserFlag' (a nil value)
stack traceback:
[C]: in function 'getUserFlag'
[string "--MiST Mission Scripting Tools..."]:2064: in function 'units_in_polygon'
[string "mist.flagFunc.units_in_polygon{..."]:1: in main chunk

So my question is twofold:

What is the expected behaviour of the toggle variable? Is it supposed to behave like I described as option 1 or 2 above, or am I completely misunderstanding it?

Is this error caused by an issue with MiST and the toggle function, or am I doing something very wrong?

 

Any help on this issue would be much appreciated!

 

-Helios

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

And that will continue to be updated at every interval until stopflag is true? Awesome, that's just what I need. Thanks, St3v3f! That takes care of question one, just the scripting error left now...

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

mist 3.3 cannot dynamically create cargo

 

Hi,

 

I have tried to use mist to create a cargo that can be picked up by a Huey. I used:

 

 
local static1 = {
country = 'USA',
category = "Cargos",
x = position.x,
y = position.y,
type = "Cargo1",
name = 'Cargo Object',
mass = 1000,
canCargo = true
}
mist.dynAddStatic(static1)

The cargo appears in the mission, but it cannot be selected as cargo using F10. :helpsmilie:

[sIGPIC][/sIGPIC]

 

Intel Core I7 4820K @4.3 GHz, Asus P9X79 motherboard, 16 GB RAM @ 933 MHz, NVidia GTX 1070 with 8 GB VRAM, Windows 10 Pro

Link to comment
Share on other sites

51 pages. Plus other threads below that deal with Mist topics.

 

Big issue: when you search for a specific Mist feature/function, this thread is returned, but the user has to browse 51 pages to find it answer.

 

 

Is it possible to divide this room into sub-rooms, where Mist (and Scripting Engine) topics would be treated as multiple threads ? Maybe by features ? (spawning, triggers, and so on...)

 

What do you think about that ?

Link to comment
Share on other sites

I support the idea to have a separate forum section dedicated to the scripting engine, I've suggested it before. Maybe one section with releases and one section with discussions.

 

galevsky, you can choose to view the individual posts that was returned in the search instead of the topics. It's just below the search box.

DCS AJS37 HACKERMAN

 

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

Link to comment
Share on other sites

Hey Guys

 

Has anyone had any success with Mist 3.3 in 1.2.8 ? Is it stable ?

 

 

We had a mission with a lot of scripts including Mist 3.3. and it was fine .

No errors or issues.

 

However we noticed a problem with the number of Ground groups in 1.2.8.

 

We run a campaign with a lot of units (500 ground units plus aircrafts/choppers) and it was ok in 1.2.7 .

Now in 1.2.8 we had issues if we didnt decrease the number of units to ~300.

 

I know this is not the right thread so I will post this find in the bug reports to see if it is valid.

"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

Thanks Gregzagk, interesting about the units. Is it a new mission built in 1.2.8 or one that was built previously in 1.2.7 and re-saved?

 

I've had a similiar issue with old 1.2.7 missions that have been re-saved. My 1.2.8 missions are running fine, but I have started them with a small amount of units. I tend to do small steps at a time to see how stable the version is.

Link to comment
Share on other sites

Thanks Gregzagk, interesting about the units. Is it a new mission built in 1.2.8 or one that was built previously in 1.2.7 and re-saved?

 

I've had a similiar issue with old 1.2.7 missions that have been re-saved. My 1.2.8 missions are running fine, but I have started them with a small amount of units. I tend to do small steps at a time to see how stable the version is.

 

Tested only with re-saved missions cause it was an event we organised in 1.2.7 :smilewink:

"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

We had a mission with a lot of scripts including Mist 3.3. and it was fine .

No errors or issues.

 

However we noticed a problem with the number of Ground groups in 1.2.8.

 

We run a campaign with a lot of units (500 ground units plus aircrafts/choppers) and it was ok in 1.2.7 .

Now in 1.2.8 we had issues if we didnt decrease the number of units to ~300.

 

I know this is not the right thread so I will post this find in the bug reports to see if it is valid.

 

Has this been posted in a bug thread, as I think you may be on to something here. I've built a new mission with plenty of units and the server struggles to load the mission and crashes.

Link to comment
Share on other sites

Using mist 3.3 and everything working great but one line in the dcs.log that keeps bugging me. When I use timers they produce a SCRIPTING error line in the log. But everything seems to be working. I belive the error is linked to the use of "nil" when no parameter is passed to the function.

 

myFunction_ID = timer.scheduleFunction(myFunction, nil, timer.getTime() + my_timeout)

gives this error:

00041.137 INFO    SCRIPTING: mist.scheduleFunction, error in  scheduled function: [string  "C:\Users\user\AppData\Local\Temp\DCS.openbet..."]:4251: Parameter #1  (unit name string) missed
00203.126 INFO    SCRIPTING:  mist.scheduleFunction, error in scheduled function: [string  "C:\Users\user\AppData\Local\Temp\DCS.openbet..."]:4254: Parameter #1  (unit name string) missed

 

EDIT: My timer is not related, did some more tests and it must be from the CAP script or the random traffic script.


Edited by HiJack
Link to comment
Share on other sites

Hi all, I'm using a mist.utils.get2DDist to get the distance between one point and another... and I'm using it in a series of comparison by one specific point to a series of point in a table.

 

Well, I have to choose the 2nd smaller distance (the smallest is used for another purpose) of series.

 

here's the chunk:

 

			for _, objData in pairs(Objectivelist) do
			if (objData) then	
				if objData.objCoalition == groupCoa then
					local placeName = objData.objName
					local OBJx = objData.objCoordx
					local OBJz = objData.objCoordy
					local unitPos = { 
									x = OBJx,
									y = 0,
									z = OBJz
									}
					local actualoffset = mist.utils.get2DDist(unitPos, groupToMovePos)											
					
					[color="Red"]if actualoffset > 5000 then[/color]
						if minimumoffset > actualoffset then -- this loop will ensure to return the lowest actualoffset possibile...
							minimumoffset = actualoffset -- ...by sobstitute every time "minimumoffset" is > than the new calculated position.
							closestObjPos = unitPos -- ad obviously update the coordinates of the closest obj by using the new unitPos unit.
							AllyPlaceRef = placeName
						end
						nearestAllyObj = DGWS.tostringMGRS(coord.LLtoMGRS(coord.LOtoLL({x = closestObjPos.x, y = 0, z = closestObjPos.z})),1)		
					end				
				end
			end
		end

 

I use the red part to try to filter only points that have a distance >5000 mt, knowing that the smaller distance would be for sure <1000 mt...


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

solved: there was an issue related to the minimumoffset variable, used in chunk loaded before that returned value far less than 5000. So that's why the "if" was never verified.

 

thanks anyway :)

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

how do i use the respawn group function?? is it tied to a Once group dead ->do script ?

ASUS Tuf Gaming Pro x570 / AMD Ryzen 7 5800X @ 3.8 / XFX Radeon 6900 XT / 64 GB DDR4 3200 

"This was not in the Manual I did not read", cried the Noob" - BMBM, WWIIOL

Link to comment
Share on other sites

thanks xcom - +1

 

I am using a randomized trigger for AI groups right now so it will randomly span a certain # of AI flights differently each time…. will this script recognize an "unselected" group from my randomization list as "dead" and spawn it? I'm trying to figure out if it will render my randomization efforts as moot then.

 

I'd like to randomize - then respawn out of the groups that were selected by the random triggers.

ASUS Tuf Gaming Pro x570 / AMD Ryzen 7 5800X @ 3.8 / XFX Radeon 6900 XT / 64 GB DDR4 3200 

"This was not in the Manual I did not read", cried the Noob" - BMBM, WWIIOL

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