Jump to content

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua


Recommended Posts

xcom, it seems to work if you respawn the group with the default task embedded into the group.

 

mist.respawnGroup('group1', true) should work

while mist.respawnGroup('group1') or mist.respawnGroup('group1', 5) won't work.

 

Basically the uncontrolled variable is defined, its just missing the route data to "start on ramp", thus the AI spawn in the air.

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

I can't get the mist.msgMGRS function to work.

What am I missing ?

 

mist.msgMGRS {
units = {'Unit1'},
acc = 5,
displayTime = 25,
msgFor = {units = {'Stuka'}},
}

 

Error I get:

error.PNG.426f54a9f506119c5773698e6b680175.PNG

dUJOta.jpg

 

Windows 11 | i9 12900KF | 64GB DDR4 | RTX 3090 | TM Warthog HOTAS | Saitek Combat Rudder Pedals | TM MFDs + Lilliput 8" | TIR5 Pro

Link to comment
Share on other sites

Guys, a small request (if allowed, of course). I like the function mist.flagFunc.units_in_moving_zones because it's excellent when I build missions for intercept. However if I am intercepting an aircraft I'd like to escort it for like say 5 minutes until this changes course (I am using groupToPoint function) and heads home. Trouble with the function above is that is pretty difficult to keep track of how long the escorting units are in the moving zone. Therefore I propose a very simple addition to the vars argument : add one more argument vars.counter which gets incremented every time the flag is set true (see now why can't I use time since flag trigger). This is the addition I propose :

 

if #in_zone_units >= req_num then
		trigger.action.setUserFlag(flag, true)
		trigger.action.setUserFlag(counter, counter + interval)
	elseif #in_zone_units < req_num and toggle then
		trigger.action.setUserFlag(flag, false)
		trigger.action.setUserFlag(counter, 0)
	end	

 

I have chosen interval as increment here but it can be anything (say 1).

 

Again, if there are other ways to do this I am more than happy to hear it.

[sIGPIC]OK[/sIGPIC]

Link to comment
Share on other sites

Question: is it possibile to spawn an airplane to the parking position instead of in the air using mist.dynAdd? (I only need a yes or no)

 

thanks :)

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

@zayets. Its a possibility to add it. But I'd rather not get to crazy with addition optional variables to the flagfuncs.

 

Question: is it possibile to spawn an airplane to the parking position instead of in the air using mist.dynAdd? (I only need a yes or no)

 

yes

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

 

 

 

Thanks! then I'll look how to get it :)

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

@zayets. Its a possibility to add it. But I'd rather not get to crazy with addition optional variables to the flagfuncs.

 

Alright. I can modify the function myself (or create a clone in a separate script file) but I thought it would be nice to have it in the standard version of Mist.

[sIGPIC]OK[/sIGPIC]

Link to comment
Share on other sites

I need to set a group main task to "CAS", to follow this SNAFU's suggestion:

http://forums.eagle.ru/showthread.php?t=135334

 

But I can't find how to do that using mist.dynAdd.

 

I tried to use coalition.addGroup:

coalition.addGroup(country.id.USA, Group.Category.AIRPLANE, GroupData) (GroupData is a group table), but it gives me errors:

 

if I use "country.id.USA", it says that can't index id... is nil.

if I use "2" instead of "country.id.USA" it says that cant' index addGroup.

 

While mist.dynAdd works. Any suggestion? :)

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

I need to set a group main task to "CAS", to follow this SNAFU's suggestion:

http://forums.eagle.ru/showthread.php?t=135334

 

But I can't find how to do that using mist.dynAdd.

 

I tried to use coalition.addGroup:

coalition.addGroup(country.id.USA, Group.Category.AIRPLANE, GroupData) (GroupData is a group table), but it gives me errors:

 

if I use "country.id.USA", it says that can't index id... is nil.

if I use "2" instead of "country.id.USA" it says that cant' index addGroup.

 

While mist.dynAdd works. Any suggestion? :)

 

solved.

 

using:

_G.coalition.addGroup(CountryData, Group.Category.AIRPLANE, GroupData)

 

instead of

coalition.addGroup(CountryData, Group.Category.AIRPLANE, GroupData)

 

gives no error and everything work as expected.

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

  • 3 weeks later...

Found a problem with the mist.msgBRA (table vars) function which probably leads to other problems with related functions.

 

1. in Mist.msgBR - in the documentation the text is optional, in the mist.lua file the text is directly being used with string.find which generates an error in case you do not use the text variable.

example of a fix:

original:

if string.find(text, '%%s') then  -- look for %s
		newText = string.format(text, s)  -- insert the coordinates into the message
	else  -- else, just append to the end.
		newText = text .. s
	end

fix:

	if text then
	if string.find(text, '%%s') then  -- look for %s
		newText = string.format(text, s)  -- insert the coordinates into the message
	else  -- else, just append to the end.
		newText = text .. s
	end
else
	newText = s
end

 

2. There seems to be another issue with the units table I put in.

first, it is unclear in the documentation if it needs a UnitNameTable (converted using the MIST function) or just a simple table of units. (it also says in the mist.lua -

vars.units- table of unit names (NOT unitNameTable- maybe this should change).

second, when transferring a table of units, it fails when trying to transfer the units to the function - mist.getAvgPos, there is fails when trying to run Unit.getByName on the unit, the error states that -

Parameter #1 (unit name string) missed
although by checking with the mist.tableshow function, the table seems fine.

 

attaching a mission example - open the radio menu and go to other - and on.

it will trigger the script and will show the error.

 

Thanks for any look at this issue.

DL_TEST.miz

Link to comment
Share on other sites

Hi,

 

is it possible to teleport a player controlled unit?

I tried mist.teleportInZone(), which teleports the unit but throws out the player. What I'm trying to do is to set up a workaround for improvised landing strips. I thought teleporting a plane would do the trick as spawning on ground away from airfields is not possible.

 

Thx,

mav

Link to comment
Share on other sites

bump - anyone got any idea about the question on post 688?

 

Negative, sorry :(

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

i have a problem with using MIST 3.5 and respawning planes....after they have respawned, they will count as "buildings" and will not longer be recognized as planes.if a client then kills one of the planes it will say "player x killed building"....any known fix for this?

 

i use the condition "lua predicate" with:

 if not Group.getByName('blueaiplane1') then
return true
end

and the action "do script" with:

mist.respawnGroup ('blueaiplane1',true)


Edited by 9./JG27 DavidRed
Link to comment
Share on other sites

i have a problem with using MIST 3.5 and respawning planes....after they have respawned, they will count as "buildings" and will not longer be recognized as planes.if a client then kills one of the planes it will say "player x killed building"....any known fix for this?

 

AFAIK this is a limitation of DCS.

From what I understand, the server sends a message "unit with internal ID xyz has been killed". The client looks up that internal unit ID in the copy of the .miz file it downloaded when it joined the server. It does not find it (because it did not exist at mission start), so it goes "huh, must have been a building".

Link to comment
Share on other sites

  • 2 weeks later...

Same is happening to our mission as well, started happening after the most recent update. Was working fine before it. Currently using Mist 3.5, may try changing back a version, but not sure if it is MIST or DCS causing the error. When other's get kicked they are getting a "run time" error. Will try to duplicate and post full message when able.


Edited by calibro8185
Link to comment
Share on other sites

Same is happening to our mission as well, started happening after the most recent update. Was working fine before it. Currently using Mist 3.5, may try changing back a version, but not sure if it is MIST or DCS causing the error. When other's get kicked they are getting a "run time" error. Will try to duplicate and post full message when able.

 

i'm using Mist 3.3 hope it'll be resolved, i'm stuck without this function ...

Link to comment
Share on other sites

any idea why after using mist.respawnGroup('groupname', 5) the group is respawned as intended, but all clients apart from the host are kicked out and their dcs crash ?

 

Bug in version 1.2.14.36041.

 

Look here: http://forums.eagle.ru/showthread.php?t=138072

And here: http://forums.eagle.ru/showthread.php?t=137906

 

Remedy or workaround for the moment:

 

1. Revert the DCS clients to the earlier version of DCS World. 1.2.14.35734. (the servers are okay to run on 1.2.14.16041).

2. If you're hosting a mission, put the underlying text in your mission briefing. so that people will see they need to revert the version when running your mission.

 

How? browse using a command prompt to your install directory of DCS world, and browse to the bin folder. Within the bin folder, execute the following command: DCS_UPDATER UPDATE 1.2.14.35734. It will revert the version number back.

 

But indeed, this bug causes some emotional reactions from some mission designers and server hosters.

 

Sven


Edited by FlightControl

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

Found a problem with the mist.msgBRA (table vars) function which probably leads to other problems with related functions.

 

1. in Mist.msgBR - in the documentation the text is optional, in the mist.lua file the text is directly being used with string.find which generates an error in case you do not use the text variable.

example of a fix:

original:

if string.find(text, '%%s') then  -- look for %s
		newText = string.format(text, s)  -- insert the coordinates into the message
	else  -- else, just append to the end.
		newText = text .. s
	end

fix:

	if text then
	if string.find(text, '%%s') then  -- look for %s
		newText = string.format(text, s)  -- insert the coordinates into the message
	else  -- else, just append to the end.
		newText = text .. s
	end
else
	newText = s
end

 

2. There seems to be another issue with the units table I put in.

first, it is unclear in the documentation if it needs a UnitNameTable (converted using the MIST function) or just a simple table of units. (it also says in the mist.lua -

second, when transferring a table of units, it fails when trying to transfer the units to the function - mist.getAvgPos, there is fails when trying to run Unit.getByName on the unit, the error states that - although by checking with the mist.tableshow function, the table seems fine.

 

attaching a mission example - open the radio menu and go to other - and on.

it will trigger the script and will show the error.

 

Thanks for any look at this issue.

 

Anyone got any idea on the 2nd point here?

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