MIssion Scripting Tools (Mist)- enhancing mission scripting Lua - Page 132 - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 07-20-2017, 04:36 AM   #1311
Stonehouse
Senior Member
 
Stonehouse's Avatar
 
Join Date: Oct 2010
Posts: 1,329
Default

Thanks Johnny, haven't had time to do what you have done.


So from your tests it would appear that the DCS coalition.addGroup function has changed somehow and either has a bug or the usage has changed and so doesn't work with the current version of mist.dynAdd


Hoping Grimes has seen these posts.
Stonehouse is offline   Reply With Quote
Old 07-21-2017, 07:05 AM   #1312
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,476
Default

Figuring out crashes related to scripting code like this makes me really miss the old non unified game engine. When the sim exe crashes you just get sent back to the editor exe as if you exited the mission. Now you gotta restart the whole thing. Anyways I figured it out.


Found the problem, the waypoint was missing the task table. I loaded up an older mission using GCI CAP that was crashing the sim in 1.5.2 or something, so I have no idea how up to date it is. I exported the table mist was using to spawn the group and compared it to a table that was spawning correctly. Process of elimination narrowed it down to this missing from each waypoint table:

Code:
["task"] = 
{
	["id"] = "ComboTask",
	["params"] = 
	{
		["tasks"] = 
		{
		}, -- end of ["tasks"]
	}, -- end of ["params"]
}, -- end of ["task"]
Its not something that mist checks for because it wasn't required to spawn the group. Obviously if something is required and missing it should just fail to spawn the group. I don't know if that requirement has changed or not, but it still shouldn't crash the sim.

To give a frame of reference this is the points table in its entirety. When the task entry is missing the game will crash. I need to investigate it further with other group types.
Code:
	["route"] = 
	{
		["points"] = 
		{
			[1] = 
			{
				["alt"] = 2000,
				["x"] = -52155.1015625,
				["action"] = "From Parking Area",
				["alt_type"] = "RADIO",
				["speed"] = 138.88888888889,
				["airdromeId"] = 26,
				["type"] = "TakeOffParking",
				["y"] = 707557,
				["task"] = 
				{
					["id"] = "ComboTask",
					["params"] = 
					{
						["tasks"] = 
						{
						}, -- end of ["tasks"]
					}, -- end of ["params"]
				}, -- end of ["task"]
			}, -- end of [1]
		}, -- end of ["points"]
	}, -- end of ["route"]
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote
Old 07-28-2017, 12:06 PM   #1313
Johnny_Rico
Senior Member
 
Johnny_Rico's Avatar
 
Join Date: Jul 2017
Posts: 1,262
Default

Hi Grimes, Thanks for taking the time to look at this issue, have you had any success ?
Johnny_Rico is offline   Reply With Quote
Old 07-29-2017, 09:59 AM   #1314
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,476
Default

Quote:
Originally Posted by Johnny_Rico View Post
Hi Grimes, Thanks for taking the time to look at this issue, have you had any success ?
I literally stated what the bug was in the previous forum post. The issue was isolated to 1.5.7, as I couldn't reproduce it on the tester version or 2.1. Whenever that is the case it bodes well that it might be fixed in the next patch. I still reported it though. So I will monitor and hope for a quick fix.
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote
Old 08-11-2017, 01:46 PM   #1315
DynamicROFL
Junior Member
 
DynamicROFL's Avatar
 
Join Date: Jun 2016
Location: Prague, CZ
Posts: 5
Default

EDIT: I realized I had a very old version of MIST (1.1) so I updated. Now the script works, although it only spawns one unit in the group, not the whole group)
I'm trying for my first time with MIST and having some trouble. I can't figure out what the problem is.

I have MIST loaded successfully, then I want to have a group (of soldiers) cloned in a Trigger zone.

I had a DO SCRIPT trigger set up with the following:
Quote:
mist.cloneInZone('Scientists1','Village West','true','20')
What I get back is this:


I don't know what I'm missing and searching this thread didn't give me any answers unfortunately. Can anyone help?

Last edited by DynamicROFL; 08-11-2017 at 02:01 PM. Reason: Solved it, mostly
DynamicROFL is offline   Reply With Quote
Old 08-12-2017, 01:00 AM   #1316
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,476
Default

Quote:
Originally Posted by DynamicROFL View Post
EDIT: I realized I had a very old version of MIST (1.1) so I updated. Now the script works, although it only spawns one unit in the group, not the whole group)
Try this:
Code:
mist.cloneInZone('Scientists1','Village West',true,20)
Best guess is it is failing on the last variable. It shouldn't be in quotes, it should be a number. The true value should also not be a string. true and false are special cases within lua. It doesn't really matter if you want the value passed to be true, but if you wanted it to be false then you wouldn't get what you were expecting. For example the following code would print out 'true' because 'false' and false are not the same thing.

Code:
local myVal = 'false'
	if myVal == false then
		print('false')
	else
		print('true')
	end
end
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote
Old 08-13-2017, 12:04 PM   #1317
SNAFU
Member
 
SNAFU's Avatar
 
Join Date: Jan 2009
Posts: 726
Default

I am still having issues with

coalition.addGroup

in 1.5.7 and 2.1. Previously working function using the the coalition.addGroup cause a CTD now. Is it me or is it the Scripting Engine?

PS: Using mist.dynAdd() doesn´t cause a CTD, using the same parameters with coalition.addGroup causes a CTD (latest 1.5.7 and 2.1)
__________________


Unsere Facebook-Seite

Last edited by SNAFU; 08-13-2017 at 12:28 PM.
SNAFU is offline   Reply With Quote
Old 08-13-2017, 10:49 PM   #1318
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,476
Default

Can you post the group table that is causing a crash?
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote
Old 08-14-2017, 08:32 AM   #1319
SNAFU
Member
 
SNAFU's Avatar
 
Join Date: Jan 2009
Posts: 726
Default

Sure:

Code:
	
--MISSION I: INTERCEPT HELI MISSION GENERATION
heliAImissiongroupnametable = {}
heliAImissiongroupnametable[1] = {groupname = "__helihuntmissiontemplate1"} 
heliAImissiongroupnametable[2] = {groupname = "__helihuntmissiontemplate2"} 
heliAImissiongroupnametable[3] = {groupname = "__helihuntmissiontemplate3"} 
heliAImissiongroupnametable[4] = {groupname = "__helihuntmissiontemplate4"} 
heliAImissiongroupnametable[5] = {groupname = "__helihuntmissiontemplate5"} 
heliAImissiongroupnametable[6] = {groupname = "__helihuntmissiontemplate6"}
heliAImissiongroupnametable[7] = {groupname = "__helihuntmissiontemplate7"}  
heliAImissiongroupnametable[8] = {groupname = "__helihuntmissiontemplate8"} 

spawnedmissionheliAItable = {}
heliinterceptmissionAICounter = #spawnedmissionheliAItable

helihuntwaypoints = {}
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Ambrolauri", endzonename = "Zestafoni"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Zestafoni", endzonename = "Ambrolauri"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Kobuleti", endzonename = "Poti"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Poti", endzonename = "Kobuleti"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Batumi", endzonename = "Poti"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Poti", endzonename = "Batumi"}
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Zugdidi", endzonename = "Tsageri"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Zugdidi", endzonename = "Poti"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Poti", endzonename = "Zugdidi"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Senaki", endzonename = "Kobuleti"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Kobuleti", endzonename = "Senaki"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Ambrolauri", endzonename = "Senaki"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Senaki", endzonename = "Ambrolauri"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Tsageri", endzonename = "Senaki"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Senaki", endzonename = "Tsageri"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Dzhvari", endzonename = "Senaki"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Senaki", endzonename = "Dzhvari"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Gori", endzonename = "Zestafoni"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Zestafoni", endzonename = "Gori"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Zestafoni", endzonename = "Senaki"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Senaki", endzonename = "Zestafoni"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Chiatura", endzonename = "Gori"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Gori", endzonename = "Chiatura"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Chiatura", endzonename = "Tsageri"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Tsageri", endzonename = "Chiatura"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Tsageri", endzonename = "Zestafoni"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Zestafoni", endzonename = "Tsageri"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Tsageri", endzonename = "Dzhvari"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Zestafoni", endzonename = "Dzhvari"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Chiatura", endzonename = "Dzhvari"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Zugdidi", endzonename = "Kobuleti"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Kobuleti", endzonename = "Zugdidi"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Tsageri", endzonename = "Zugdidi"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Kobuleti", endzonename = "Dzhvari"}--
helihuntwaypoints[#helihuntwaypoints +1] = {startzonename = "Dzhvari", endzonename = "Chiatura"}



local heliAInumber = math.random(1,2)
	local j = math.random(1,#heliAImissiongroupnametable)
	local heliAIintrudergroupname = heliAImissiongroupnametable[j].groupname		
	local helimissionAIgrouptable = {}
	helimissionAIgrouptable = mist.getGroupData(heliAIintrudergroupname)
	local heliinterceptmissionAItype = helimissionAIgrouptable["units"][1]["type"]
	local heliinterceptmissionAIskin = helimissionAIgrouptable["units"][1]["livery_id"]
	local heliinterceptmissionAIskill = helimissionAIgrouptable["units"][1]["skill"]
	local heliInterceptMissionAIcountry = helimissionAIgrouptable["countryId"]
	local heliAImissiontask = helimissionAIgrouptable["task"]
	
	heliinterceptmissionAIpayload = mist.getPayload(heliAIintrudergroupname) 
	local helispeed = 50
	heliinterceptmissionAICounter = #spawnedmissionheliAItable + 1
	local helirouterandomizer = math.random(1,#helihuntwaypoints)
	local randomheliAIspawnzonename = helihuntwaypoints[helirouterandomizer].startzonename
	heliinterceptmission = trigger.misc.getZone(randomheliAIspawnzonename)
	heliinterceptmissionpos = {}
	heliinterceptmissionposx = heliinterceptmission.point.x + math.random(heliinterceptmission.radius * -1, heliinterceptmission.radius)
	heliinterceptmissionposz = heliinterceptmission.point.z + math.random(heliinterceptmission.radius * -1, heliinterceptmission.radius)
	local heliinterceptmissionAIspawnalt = math.random(heliminAIspawnaltitude,helimaxAIspawnaltitude)
	local heliinterceptmissionAIgroupname = 'Mission I:'..heliinterceptmissionAItype..' #:'..string.format(heliinterceptmissionAICounter)	
	local heliinterceptmissionAIPatrolpointstable = {}
	heliinterceptmissionAIPatrolpointstable[1] =
					{
						["alt"] = heliinterceptmissionAIspawnalt,
						["type"] = "Turning Point",
						["action"] = "Turning Point", 
						["alt_type"] = "RADIO",
						["formation_template"] = "",
						["ETA"] = 0,
						["airdromeId"] = 1,
						["y"] = heliinterceptmissionposz,
						["x"] = heliinterceptmissionposx,
						["speed"] = helispeed,
						["ETA_locked"] = true,
						["task"] =  heliAIwaypointtask,
						["speed_locked"] = true,
					}

											

	local randomheliAIwaypointzonename = helihuntwaypoints[helirouterandomizer].endzonename
	randomheliAIwaypointzone = trigger.misc.getZone(randomheliAIwaypointzonename)
	local randomheliAIwaypointzoneposz = randomheliAIwaypointzone.point.z + math.random(randomheliAIwaypointzone.radius * -1, randomheliAIwaypointzone.radius)
	local randomheliAIwaypointzoneposx = randomheliAIwaypointzone.point.x + math.random(randomheliAIwaypointzone.radius * -1, randomheliAIwaypointzone.radius)
	heliinterceptmissionAIPatrolpointstable[2] =
					{
						["alt"] = heliinterceptmissionAIspawnalt + math.random(heliinterceptmissionAIspawnalt * -0.2, heliinterceptmissionAIspawnalt * 0.2),
						["type"] = "Turning Point",
						["action"] = "Turning Point",
						["alt_type"] = "RADIO",
						["formation_template"] = "",
						["properties"] = 
						{
							["vnav"] = 1,
							["scale"] = 0,
							["angle"] = 0,
							["vangle"] = 0,
							["steer"] = 2,
						}, -- end of ["properties"]
						["ETA"] = 230.54689194991,
						["y"] = randomheliAIwaypointzoneposz,
						["x"] = randomheliAIwaypointzoneposx,
						["speed"] = helispeed,
						["ETA_locked"] = false,
						["task"] = heliAIwaypointtask,
						["speed_locked"] = true,
					}
	heliinterceptmissionAIPatrolpointstable[3] =
					{
						["alt"] = heliinterceptmissionAIspawnalt,
						["type"] = "Turning Point",
						["action"] = "Turning Point", 
						["alt_type"] = "RADIO",
						["formation_template"] = "",
						["ETA"] = 0,
						["airdromeId"] = 1,
						["y"] = heliinterceptmissionposz,
						["x"] = heliinterceptmissionposx,
						["speed"] = helispeed,
						["ETA_locked"] = true,
						["task"] =  heliAIwaypointtask,
						["speed_locked"] = true,
					}
												


	local heliinterceptmissionAIPatrolunitstable = {}
	if heliAInumber == 1
	then
		heliinterceptmissionAIPatrolunitstable =	{
					[1] = 
					{
						["alt"] = heliinterceptmissionAIspawnalt,
						["heading"] = 0,
						["livery_id"] = interceptmissionAIskin,
						["type"] = heliinterceptmissionAItype,
						["psi"] = 0,
						["onboard_num"] = "10",
						["parking"] = 1,
						["y"] = heliinterceptmissionposz,
						["x"] = heliinterceptmissionposx,
						["name"] =  heliinterceptmissionAIgroupname,
						["payload"] = heliinterceptmissionAIpayload,
						["speed"] = helispeed,
						["unitId"] =  math.random(9999,99999),
						["alt_type"] = "RADIO",
						["skill"] = heliinterceptmissionAIskill,
					}, -- end of [1]
					}
	elseif heliAInumber == 2
	then
		heliinterceptmissionAIPatrolunitstable =	{
					[1] = 
					{
						["alt"] = heliinterceptmissionAIspawnalt,
						["heading"] = 0,
						["livery_id"] = heliinterceptmissionAIskin,
						["type"] = heliinterceptmissionAItype,
						["psi"] = 0,
						["onboard_num"] = "10",
						["parking"] = 1,
						["y"] = heliinterceptmissionposz,
						["x"] = heliinterceptmissionposx,
						["name"] =  heliinterceptmissionAIgroupname,
						["payload"] = heliinterceptmissionAIpayload,
						["speed"] = helispeed,
						["unitId"] =  math.random(9999,99999),
						["alt_type"] = "RADIO",
						["skill"] = heliinterceptmissionAIskill,
					}, -- end of [1]
					 [2] = 
					{
						["alt"] = heliinterceptmissionAIspawnalt,
						["heading"] = 0,
						["livery_id"] = heliinterceptmissionAIskin,
						["type"] = heliinterceptmissionAItype,
						["psi"] = 0,
						["onboard_num"] = "11",
						["parking"] = 2,
						["y"] = heliinterceptmissionposz +50,
						["x"] = heliinterceptmissionposx + 50,
						["name"] =  heliinterceptmissionAIgroupname.." #2",
						["payload"] = interceptmissionAIpayload,
						["speed"] = helispeed,
						["unitId"] =  math.random(9999,99999),
						["alt_type"] = "RADIO",
						["skill"] = heliinterceptmissionAIskill,
						},

					}
	end
	
	local heliinterceptmissionAIdata = 	{
						["modulation"] = 0,
						["tasks"] = 
						{
						}, -- end of ["tasks"]
						["task"] = heliAImissiontask,
						["uncontrolled"] = false,
						["route"] = 
								{
								["points"] = heliinterceptmissionAIPatrolpointstable,
								}, -- end of ["route"]
						["groupId"] = math.random(10000,99999),
						["hidden"] = false,
						["units"] = heliinterceptmissionAIPatrolunitstable, 
						["y"] = heliinterceptmissionposz,
						["x"] = heliinterceptmissionposx,
						["name"] =  heliinterceptmissionAIgroupname,
						["communication"] = true,
						["start_time"] = 0,
						["frequency"] = 124,
					}
coalition.addGroup(heliInterceptMissionAIcountry, Group.Category.HELICOPTER, heliinterceptmissionAIdata)
I guess this is related to a missing task? Since I wrote "heliAiwaypointtask" in the route table, but defined it above as "local heliAimissiontask". Will test it in the evening. This worked before 1.5.7 strangely.
__________________


Unsere Facebook-Seite

Last edited by SNAFU; 08-14-2017 at 08:52 AM.
SNAFU is offline   Reply With Quote
Old 08-15-2017, 07:19 AM   #1320
SNAFU
Member
 
SNAFU's Avatar
 
Join Date: Jan 2009
Posts: 726
Default

Nevermind, the incomplete task was indeed the issue.

The task taken from mist.getGroupData() caused a crash, too. So I just used an empty task as described above.
__________________


Unsere Facebook-Seite
SNAFU is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 02:58 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.