Jump to content

redo a route via triggers and flags ?


BIGNEWY

Recommended Posts

  • ED Team

Hi all

 

Need a little help as I am going mad ! lol

 

 

Is it possible for a unit to travel a route ( say 5 way points ) the end way point being where it started from and then redo the route if triggered by a flag ?

 

thanks for looking

smallCATPILOT.PNG.04bbece1b27ff1b2c193b174ec410fc0.PNG

Forum rules - DCS Crashing? Try this first - Cleanup and Repair - Discord BIGNEWY#8703 - Youtube - Patch Status

Windows 11, NVIDIA MSI RTX 3090, Intel® i9-10900K 3.70GHz, 5.30GHz Turbo, Corsair Hydro Series H150i Pro, 64GB DDR @3200, ASUS ROG Strix Z490-F Gaming, HP Reverb G2

Link to comment
Share on other sites

  • ED Team

would this work ?

 

table sct.respawnInZone (string groupName, string zoneName, Boolean disperse, number

distance)

 

would some one please point me in the right direction, if there is a tutorial on how to structure the lua script that would be great.

smallCATPILOT.PNG.04bbece1b27ff1b2c193b174ec410fc0.PNG

Forum rules - DCS Crashing? Try this first - Cleanup and Repair - Discord BIGNEWY#8703 - Youtube - Patch Status

Windows 11, NVIDIA MSI RTX 3090, Intel® i9-10900K 3.70GHz, 5.30GHz Turbo, Corsair Hydro Series H150i Pro, 64GB DDR @3200, ASUS ROG Strix Z490-F Gaming, HP Reverb G2

Link to comment
Share on other sites

I have a ground patrol function that is a WIP for mist/sct but its not quite finished yet. Its been a while since I last tested it so it might have an issue or two, but add this to a do script (after adding mist) and it'll give you access to the function. Simply pass it the groupName.

 

mist.ground.patrol = function(gpData, pType)

local tempRoute = {}
local useRoute = {}
if type(gpData) == 'string' then
	gpData = Group.getByName(gpData)
end

local posStart = mist.getLeadPos(gpData)
if not route then
	tempRoute = mist.getGroupRoute(gpData:getName())
else
	for i = 1, #route do
		tempRoute[#tempRoute +1] = mist.ground.buildWP(route[i], form, speed)
	end
end

useRoute[#useRoute + 1] = mist.ground.buildWP(posStart, form, speed)
for i = 1, #tempRoute do
	useRoute[#useRoute + 1] = mist.ground.buildWP(tempRoute[i], form, speed)
end
	
if pType and pType == 'doubleBack' then
	for i = #tempRoute, 2, -1 do
		useRoute[#useRoute + 1] = mist.ground.buildWP(tempRoute[i], form, speed)
	end
end

local tempTask = {
	id = 'WrappedAction', 
	params = { 
		action = {
			id = 'Script',
			params = {
				command = tostring('local group = ... \n mist.ground.patrol(group:getName() , ' .. mist.utils.basicSerialize(pType) .. ')') , 
				
			},
		},
	},
}

useRoute[#useRoute].task = tempTask
mist.goRoute(gpData, useRoute)
end

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

I could not get it to work,

 

loaded as a doscript after MIST and sctv2

 

My vehicle is "MASHCasvehicleA" maybe something I am doing wrong

 

mist.ground.patrol = function(gpData, pType)

local tempRoute = {}
local useRoute = {}
if type(gpData) == 'string' then
 gpData = Group.getByName(gpData)
end

local posStart = mist.getLeadPos(gpData)
if not route then
 tempRoute = mist.getGroupRoute(gpData:getName(MASHCasvehicleA))
else
 for i = 1, #route do
  tempRoute[#tempRoute +1] = mist.ground.buildWP(route[i], form, speed)
 end
end

useRoute[#useRoute + 1] = mist.ground.buildWP(posStart, form, speed)
for i = 1, #tempRoute do
 useRoute[#useRoute + 1] = mist.ground.buildWP(tempRoute[i], form, speed)
end

if pType and pType == 'doubleBack' then
 for i = #tempRoute, 2, -1 do
  useRoute[#useRoute + 1] = mist.ground.buildWP(tempRoute[i], form, speed)
 end
end

local tempTask = {
 id = 'WrappedAction', 
 params = { 
  action = {
   id = 'Script',
    params = {
    command = tostring('local group = ... \n mist.ground.patrol(group:getName(MASHCasvehicleA) , ' .. mist.utils.basicSerialize(pType) .. ')') , 

   },
  },
 },
}

useRoute[#useRoute].task = tempTask
mist.goRoute(gpData, useRoute)
end

smallCATPILOT.PNG.04bbece1b27ff1b2c193b174ec410fc0.PNG

Forum rules - DCS Crashing? Try this first - Cleanup and Repair - Discord BIGNEWY#8703 - Youtube - Patch Status

Windows 11, NVIDIA MSI RTX 3090, Intel® i9-10900K 3.70GHz, 5.30GHz Turbo, Corsair Hydro Series H150i Pro, 64GB DDR @3200, ASUS ROG Strix Z490-F Gaming, HP Reverb G2

Link to comment
Share on other sites

You don't need to modify the code I posted. It simply creates the function for you to call when you want the patrol to start. All you need to do would be paste it into a do script and then later when you want to use it just use: mist.ground.patrol('groupsName')

 

For example:

mist.ground.patrol('MASHCasvehicleA')

 

When you do that the (unmodifed) code I had posted will find the groupsName and then find its current route as defined in the editor. It will then iterate through each waypoint and will create the desired path. Once it reaches the last waypoint it will recall the function and automatically go back to its first waypoint to continue the path again.

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

I feel silly now lol

 

Thanks for putting up with us .lua noobs :)

smallCATPILOT.PNG.04bbece1b27ff1b2c193b174ec410fc0.PNG

Forum rules - DCS Crashing? Try this first - Cleanup and Repair - Discord BIGNEWY#8703 - Youtube - Patch Status

Windows 11, NVIDIA MSI RTX 3090, Intel® i9-10900K 3.70GHz, 5.30GHz Turbo, Corsair Hydro Series H150i Pro, 64GB DDR @3200, ASUS ROG Strix Z490-F Gaming, HP Reverb G2

Link to comment
Share on other sites

  • ED Team

Outstanding grimes !

 

it works :)

 

I would give you more rep, but it will not let me ! :)

smallCATPILOT.PNG.04bbece1b27ff1b2c193b174ec410fc0.PNG

Forum rules - DCS Crashing? Try this first - Cleanup and Repair - Discord BIGNEWY#8703 - Youtube - Patch Status

Windows 11, NVIDIA MSI RTX 3090, Intel® i9-10900K 3.70GHz, 5.30GHz Turbo, Corsair Hydro Series H150i Pro, 64GB DDR @3200, ASUS ROG Strix Z490-F Gaming, HP Reverb G2

Link to comment
Share on other sites

You don't need to modify the code I posted. It simply creates the function for you to call when you want the patrol to start. All you need to do would be paste it into a do script and then later when you want to use it just use: mist.ground.patrol('groupsName')

 

For example:

mist.ground.patrol('MASHCasvehicleA')

 

When you do that the (unmodifed) code I had posted will find the groupsName and then find its current route as defined in the editor. It will then iterate through each waypoint and will create the desired path. Once it reaches the last waypoint it will recall the function and automatically go back to its first waypoint to continue the path again.

 

 

 

umm.. I hate to ask but... where do I put the mist.ground.patrol('groupsName') at? As a trigger rule - Expression? or as an advanced waypoint action for that unit? I'm still confused.

Link to comment
Share on other sites

  • ED Team
umm.. I hate to ask but... where do I put the mist.ground.patrol('groupsName') at? As a trigger rule - Expression? or as an advanced waypoint action for that unit? I'm still confused.

 

 

Advanced waypoint - script

 

example below


Edited by BIGNEWY
  • Like 1

smallCATPILOT.PNG.04bbece1b27ff1b2c193b174ec410fc0.PNG

Forum rules - DCS Crashing? Try this first - Cleanup and Repair - Discord BIGNEWY#8703 - Youtube - Patch Status

Windows 11, NVIDIA MSI RTX 3090, Intel® i9-10900K 3.70GHz, 5.30GHz Turbo, Corsair Hydro Series H150i Pro, 64GB DDR @3200, ASUS ROG Strix Z490-F Gaming, HP Reverb G2

Link to comment
Share on other sites

Hi Guys,

 

I need some help with that script. I downloaded Mist 2.0 and loaded it, like explained, in my mission. I insert the doscript by grimes in my trigger list and added the triggered action. but the unit still stops at the last waypoint.

 

Maybe, some screenshots help you to help me ... :(

 

redo1.jpg

 

redo2c.jpg

 

redo3.jpg

 

redo4.jpg

 

Uploaded with ImageShack.us

 

 

Thanks in advance.

 

regards,

Fire

Hardware: Intel i5 4670K | Zalman NPS9900MAX | GeIL 16GB @1333MHz | Asrock Z97 Pro4 | Sapphire Radeon R9 380X Nitro | Samsung SSDs 840 series 120GB & 250 GB | Samsung HD204UI 2TB | be quiet! Pure Power 530W | Aerocool RS-9 Devil Red | Samsung SyncMaster SA350 24" + ASUS VE198S 19" | Saitek X52 | TrackIR 5 | Thrustmaster MFD Cougar | Speedlink Darksky LED | Razor Diamondback | Razor X-Mat Control | SoundBlaster Tactic 3D Rage ### Software: Windows 10 Pro 64Bit

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Thanks! Now, it works fine.

I found a little issue: after the first round, the unit drives with full speed. I used 11 kts for the unit, but after the first round, the unit drives with 30 kts. I think, to hold the speed isn't in the script yet.

 

regards,

Fire

Hardware: Intel i5 4670K | Zalman NPS9900MAX | GeIL 16GB @1333MHz | Asrock Z97 Pro4 | Sapphire Radeon R9 380X Nitro | Samsung SSDs 840 series 120GB & 250 GB | Samsung HD204UI 2TB | be quiet! Pure Power 530W | Aerocool RS-9 Devil Red | Samsung SyncMaster SA350 24" + ASUS VE198S 19" | Saitek X52 | TrackIR 5 | Thrustmaster MFD Cougar | Speedlink Darksky LED | Razor Diamondback | Razor X-Mat Control | SoundBlaster Tactic 3D Rage ### Software: Windows 10 Pro 64Bit

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Correct, holding the speed is not yet in the script. Well it sort of is, but there are bugs in the script I gotta work out. I've been focusing on another scripting project for the last few weeks, and I haven't really done much with mist, as I am waiting on Speed to add some stuff.

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 for the info and for that script. :thumbup:

 

regards,

fire

Hardware: Intel i5 4670K | Zalman NPS9900MAX | GeIL 16GB @1333MHz | Asrock Z97 Pro4 | Sapphire Radeon R9 380X Nitro | Samsung SSDs 840 series 120GB & 250 GB | Samsung HD204UI 2TB | be quiet! Pure Power 530W | Aerocool RS-9 Devil Red | Samsung SyncMaster SA350 24" + ASUS VE198S 19" | Saitek X52 | TrackIR 5 | Thrustmaster MFD Cougar | Speedlink Darksky LED | Razor Diamondback | Razor X-Mat Control | SoundBlaster Tactic 3D Rage ### Software: Windows 10 Pro 64Bit

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 3 months later...

Hoping someone can help, we're running a scripted set of missions for the group I fly with and basically each mission serves as the base for the next. I had mission 1 using this ground patrol function and all was well. However Mist 3 came along just after we flew mission 1 so I saved mission 1 as a new file name to create mission 2 and then edited it and also upgraded to Mist 3 without changing the ground patrol script. I now get the attached error but being a nearly lua illiterate I'm struggling to understand it. I get the impression that perhaps mist is not loaded before the ground patrol do script starts but find that strange as they are both on a mission start trigger with the do script for mist first.

 

Any thoughts?

 

Thanks,

Stonehouse

Untitled.thumb.jpg.4c178f360699414bc767462f68b34c15.jpg

Link to comment
Share on other sites

mist.ground.patrol was never officially added into mist because I never finished it and it was doing some weird stuff the last time I tried to use it. For instance the group would occasionally stop patrolling for one reason or another. It was planned on being re-added with mist 3.2+

 

Follow the same instructions from this post to add it back in: http://forums.eagle.ru/showpost.php?p=1776748&postcount=5

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 Grimes. Sorry I wasn't very clear in my earlier post what I was trying to say was I had a mission which used exactly the instructions in the post you linked to and worked fine. I loaded this mission into the editor and saved it to a new filename. I then edited this "new" mission removing some objects and adding/changing aircraft groups and their waypoints and the briefing to create mission 2. The objects using the patrol script are scenery at our home base and these I didn't change other than moving their waypoints a bit so essentially they are the same as the working mission. However between flying the working mission and creating the new one we had 1.2.6 arrive and I also downloaded the latest version of Mist 3 and updated the mission start trigger to reference Mist 3 instead of Mist 2. When I tried to test this new mission I got the error for each of the ground objects/groups using the patrol script ( ie same error different group name). Interestingly after making my earlier post I went back into the mission and changed the start trigger to point back to Mist v2 and still get the same error.......does that imply that something in the waypoint trigger run script command changed in 1.2.6 that causes the error to occur?

 

Worst case for our group's mission this Thursday I'll just put in lots of manual waypoints for the vehicles around the base so we keep the immersion of airbase local ground traffic so if you've no time at present to think about it that's quite understandable, it was just that the ground patrol script was a much nicer way and I thought I should pass the info onto you guys as well as check if anyone else had the issue and perhaps a solution.

 

Cheers,

Stonehouse

Link to comment
Share on other sites

I went ahead and changed the mission to use manually plotted waypoints for the ground vehicles and found another issue - any client joining the game got stuck on the F10 map and the host (me) was stuck in F11 view and no one could get into the cockpit of an aircraft. As a test I built a new test mission from scratch with some client aircraft and all was good. Could my issues described in my last few posts be due to the fact that I did a "save as" of an existing mission to create the next one? Did that somehow corrupt the saved mission? Is that likely and is there a best way to clone an existing mission to avoid problems?

 

Thanks,

Stonehouse

Link to comment
Share on other sites

Actually I fixed the patrol script last night to implement it into mist 3.2. Its in the post spoiler :) That error occurs if mist wasn't loaded correctly or by the time you ran the function.

 

 

 

if ptype is string 'doubleback' then the patrol will go to the last WP, and follow the WPs in reverse back to the first

formation by default is specified in the actual waypoints you setup in the editor. If form is valid it will override the WPs with that formation type

speed is the speed you want them to travel in meters per second

 

Proper documentation will be in mist 3.2

mist.ground.patrol = function(gpData, pType, form, speed)

local tempRoute = {}
local useRoute = {}
if type(gpData) == 'string' then
	gpData = Group.getByName(gpData)
end

local posStart = mist.getLeadPos(gpData)

tempRoute = mist.getGroupRoute(gpData:getName())
useRoute[#useRoute + 1] = mist.ground.buildWP(posStart, form, speed)
for i = 1, #tempRoute do
	useRoute[#useRoute + 1] = mist.ground.buildWP(tempRoute[i], form, speed)
end
	
if pType and string.lower(pType) == 'doubleback' then
	for i = #tempRoute, 2, -1 do
		useRoute[#useRoute + 1] = mist.ground.buildWP(tempRoute[i], form, speed)
	end
end

useRoute[1].action = useRoute[#useRoute].action -- make it so the first WP matches the last WP
if useRoute[1].action == 'On Road' then
	form = 'On Road'
end
		
local cTask2 = {}
cTask2[#cTask2 + 1] = 'local group = ... \n mist.ground.patrol(group:getName() ,'
if pType then
	cTask2[#cTask2 + 1] = tostring(mist.utils.basicSerialize(pType))
else
	cTask2[#cTask2 + 1] = "'norm'"
end
cTask2[#cTask2 + 1] = ' , '
if form then
	cTask2[#cTask2 + 1] = tostring(mist.utils.basicSerialize(form))
else
	cTask2[#cTask2 + 1] = "'Cone'"
end
cTask2[#cTask2 + 1] = ' , '
if speed then
	cTask2[#cTask2 + 1] = speed
else
	cTask2[#cTask2 + 1] = 5.55
end

cTask2[#cTask2 + 1] = ')'

cTask2 = table.concat(cTask2)

local tempTask = {
	id = 'WrappedAction', 
	params = { 
		action = {
			id = 'Script',
			params = {
				command = cTask2, 
				
			},
		},
	},
}

	
useRoute[#useRoute].task = tempTask

mist.goRoute(gpData, useRoute)
end

 

 

 

If you have the logs from the MP mission it would be helpful to see if they were actually joining a valid slot or if errors were popping up. Sort of curious if it was similar to what was happening in this post: http://forums.eagle.ru/showthread.php?t=113504 If a mission were corrupt, it would also be corrupt in single player. Aside from that I'm not really sure what might have happened with it. If you are willing to share it I could take a look.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...