Jump to content

Periodically write the coordinates of a moving car into a file?


Flappie

Recommended Posts

Hi guys,

 

I'm working on an accurate vector map of our beloved DC 2.5 Caucasus terrain. I already shared two very early versions of my map in Viper39's CombatFlite, but there's still a lot work to do (rivers, roads and bridges are missing, among other things).

 

I'm currently painstakingly hand drawing the river network, and until now, I thought I would do the same regarding the road network. But I had an idea: maybe I could send a few cars through the Caucasus roads and periodically get their coordinates... This could save a LOT of my time.

 

TL;DR

 

Could someone provide me with a script able to periodically write into a file the DMS (or decimal degrees) coordinates of a moving car object?

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

EDIT: Ok, I've finally solved the nasty issues I had before, :thumbup:

 

I've created 3 versions of a MOOSE demo mission where a single BTR80 is travelling from Beslan to Tbilisi by road.

 

The first version will show both DDM + DMS coordinates of the BTR80 every 10 seconds (and log them in dcs.log)

 

The second version will show DDM coordinates of the BTR80 every 10 seconds (and log them in dcs.log)

 

The third version will show DMS coordinates of the BTR80 every 10 seconds (and log them in dcs.log)

 

 

The script for each mission can be found inside the "DEFAULT" folder (path-> "missiondir\l10n\DEFAULT")

 

Here is the MOOSE script idea, though (this will show both DDM and DMS coordinates):

 

 

SCHEDULER:New( nil,

function()

 

local RoadMapper = UNIT:FindByName("Name of the UNIT in ME")

local RoadMapperCoordinate = RoadMapper:GetCoordinate()

local RoadMapperLLDMS = RoadMapperCoordinate:ToStringLLDMS()

local RoadMapperLLDDM = RoadMapperCoordinate:ToStringLLDDM()

 

MESSAGE:New(RoadMapperLLDMS.. "\n"..RoadMapperLLDDM, 10):ToAll()

BASE:T("DMS coordinates:"..RoadMapperLLDMS)

BASE:T("DDM coordinates:"..RoadMapperLLDDM)

end, {}, 1, 10

)

 

 

 

Note that the BTR80 will go slightly off road in some turns, don't expect 100% accuracy using this method.

 

I have to say, though, there might be faster/easier methods of mapping roads, this seems like an excruciating task :cry:

Road mapping demo DDM + DMS coordinates.miz

Road mapping demo DDM coordinates.miz

Road mapping demo DMS coordinates.miz


Edited by Hardcard
Link to comment
Share on other sites

Thanks a lot, Hardcard! :cheer3nc:

 

I'll put your scripts to good use and go back here to show what it looks like on my map. I'll probably use a UAZ instead of a BTR. I guess it sticks to the road better.

And if you find a better idea to trace all those roads, I'm all ears! ;)

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

You're welcome.

 

I assumed all vehicle types would go off road, so I kept using the BTR :doh: (I can confirm that the UAZ performs way better in turns and also travels much faster)

 

As for better/faster methods, while checking the MOOSE Coordinate documentation I noticed that, apparently, there's a method to get a table of road coordinates between two points (which I assume would do the road mapping job in a split second, albeit the path would be chosen automatically...I'm guessing).

 

I'm talking about this baby:

 

COORDINATE:GetPathOnRoad(ToCoord, IncludeEndpoints, Railroad, MarkPath, SmokePath)

 

 

Problem is that I don't know how it works exactly, since I've never used it (need to investigate further). Also, right now I have no clue of how to translate the returned coordinate table into DDM / DMS format (and log it all in dcs.log).

 

Perhaps you'll get lucky and far more experienced users will chip in.

I'm just a lowly MOOSE noob myself :D

 

PS. You could also try doing what feefifofum suggested, perhaps you'll find a better way of doing this by messing with TacView.


Edited by Hardcard
Link to comment
Share on other sites

I've just checked the content of an ACMI file. It looks like this:

 

 

1602,T=4.7879442|4.3985878|35.17|||327.1|623973.5|-266515.5|321.1

 

 

It doesn't look like DDM nor DDS to me. I'll stick with your script. I was able to generate the path you entered (Beslan - Tbilisi) pretty quickly with a Humvee: those can reach a speed of 61 knots, plus I had it play x8.

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

Looks like those are raw coordinates which need to be converted to DDM or DMS format (don't take my word for it, though).

 

Btw, I didn't mention this earlier, since I assumed you'd notice it while checking the demo mission triggers by yourself.

The thing is that in order for dcs.log to actually log those coordinates (using the script I provided) you need to create an additional trigger in ME (either MISSION START or ONCE type).

That trigger should perform a "DO SCRIPT" action and run the following script:

 

BASE:TraceOnOff( true )

BASE:TraceLevel(1)

BASE:TraceClass("BASE")

 

 

This is one way of telling MOOSE to trace "BASE" class (ie. log it in dcs.log every time it's used), that's why I added the following bit at the end of the scheduler:

 

BASE:T("DMS coordinates:"..RoadMapperLLDMS)

BASE:T("DDM coordinates:"..RoadMapperLLDDM)

 

 

Btw, you can simply delete the "DMS/DDM coordinates:.." part, since it's not needed. Those "RoadMapperLLDMS/LLDDM" variables will return strings which already specify the coordinate format.

In fact, you could actually replace that by the name/identifier of your vehicle, so you'd know where those coordinates belong (in case you decided to use multiple vehicles to map several roads at once).

Yes, the script can be modified to allow for multiple vehicles, but the "output method" (coordinate logging format in dcs.log) needs to be given some thought, otherwise you'll end up with a messy coordinate list :cry:

 

I'm mentioning all this stuff just in case you decide to create your own missions in order to do this, only to discover that dcs.log isn't actually logging the coordinates :doh:


Edited by Hardcard
Link to comment
Share on other sites

It's OK, I've already made a bunch of scripted missions, though MOOSE is a stranger to me (well, a bit less, from now on).

 

 

Yes, I will change the beginning of each line to :

- name the road,

- add an increasing number to each point, to help Quantum GIS "link the dots" in the right order.

 

 

Soon, herds of Humvees will roam the Caucasus to draw roads for me...

 

:place evil laugh here:

 

Thanks again!

 

 

 

 

EDIT: herds, not hords. :D


Edited by Flappie

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

It's a shame I've already hand drawn the railway network a while ago! :lol:

But thanks anyway, I might need this in the case I draw another DCS map (some already asked for an accurate Normandy map).

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

  • 2 months later...
Nice to see that you got it working!

 

Btw, I've just tried the script with a train and it works too! You'll be able to map railway networks as well :thumbup:

Hi Hardcard. I'm happy to say that I've finished tracing the road network thanks to your script ! This brand new layer will soon be available as an update to my CombatFlite map.

 

But I have a problem : now that the road network is so precisely traced, my manual railroad network doesn't fit at all... :D

 

I've simply changed my 13 BTR units into 13 train units, and tried launching the mission as usual, but somehow the script failed, and the train object didn't seem to appear in game, nor in the F10 map. I'm afraid the Caucasus theatre is not compatible with train units yet.

 

 

Was your train test executed on the Caucasus map?

 

Here's the log.

 

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap 008,[Country]=2,[units]={[1]=BTR Roadmap_8,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap_2,[Country]=2,[units]={[1]=BTR Roadmap_2,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap #002,[Country]=2,[units]={[1]=BTR Roadmap_3,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap #008,[Country]=2,[units]={[1]=BTR Roadmap_9,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap #010,[Country]=2,[units]={[1]=BTR Roadmap_11,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap #145,[Country]=2,[units]={[1]=BTR Roadmap_6,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap #003,[Country]=2,[units]={[1]=BTR Roadmap_4,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap #035,[Country]=2,[units]={[1]=BTR Roadmap_12,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap #005,[Country]=2,[units]={[1]=BTR Roadmap_5,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap #009,[Country]=2,[units]={[1]=BTR Roadmap_10,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap #106,[Country]=2,[units]={[1]=BTR Roadmap_13,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap_1,[Country]=2,[units]={[1]=BTR Roadmap_1,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10802( 11402)/I: DATABASE00003._RegisterGroupTemplate({[Coalition]=2,[Category]=2,[Group]=BTR Roadmap 007,[Country]=2,[units]={[1]=BTR Roadmap_7,},})

2019-01-15 23:48:09.738 INFO SCRIPTING: 10951( 10256)/I: DATABASE00003._RegisterGroupsAndUnits(Groups:)

2019-01-15 23:48:09.739 INFO SCRIPTING: 10976( 10258)/I: DATABASE00003._RegisterStatics({[statics]={[GroupsRed]={},[GroupsBlue]={},},})

2019-01-15 23:48:09.739 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Anapa-Vityazevo,[3]=12,})

2019-01-15 23:48:09.739 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Krasnodar-Center,[3]=13,})

2019-01-15 23:48:09.739 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Novorossiysk,[3]=14,})

2019-01-15 23:48:09.739 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Krymsk,[3]=15,})

2019-01-15 23:48:09.740 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Maykop-Khanskaya,[3]=16,})

2019-01-15 23:48:09.740 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Gelendzhik,[3]=17,})

2019-01-15 23:48:09.740 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Sochi-Adler,[3]=18,})

2019-01-15 23:48:09.740 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Krasnodar-Pashkovsky,[3]=19,})

2019-01-15 23:48:09.740 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Sukhumi-Babushara,[3]=20,})

2019-01-15 23:48:09.741 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Gudauta,[3]=21,})

2019-01-15 23:48:09.741 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Batumi,[3]=22,})

2019-01-15 23:48:09.741 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Senaki-Kolkhi,[3]=23,})

2019-01-15 23:48:09.741 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Kobuleti,[3]=24,})

2019-01-15 23:48:09.741 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Kutaisi,[3]=25,})

2019-01-15 23:48:09.742 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Mineralnye Vody,[3]=26,})

2019-01-15 23:48:09.742 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Nalchik,[3]=27,})

2019-01-15 23:48:09.742 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Mozdok,[3]=28,})

2019-01-15 23:48:09.742 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Tbilisi-Lochini,[3]=29,})

2019-01-15 23:48:09.742 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Soganlug,[3]=30,})

2019-01-15 23:48:09.743 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Vaziani,[3]=31,})

2019-01-15 23:48:09.743 INFO SCRIPTING: 11003( 10260)/I: DATABASE00003._RegisterAirbases({[1]=Register Airbase:,[2]=Beslan,[3]=32,})

2019-01-15 23:48:09.743 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=TUNNELS,})

2019-01-15 23:48:09.744 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=TUNNEL?,})

2019-01-15 23:48:09.744 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=TODO,})

2019-01-15 23:48:09.744 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #001,})

2019-01-15 23:48:09.745 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #009,})

2019-01-15 23:48:09.745 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #010,})

2019-01-15 23:48:09.745 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #002,})

2019-01-15 23:48:09.745 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gares,})

2019-01-15 23:48:09.746 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=TODO #001,})

2019-01-15 23:48:09.746 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #003,})

2019-01-15 23:48:09.746 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gares #002,})

2019-01-15 23:48:09.746 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #011,})

2019-01-15 23:48:09.746 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #004,})

2019-01-15 23:48:09.747 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=TODO #003,})

2019-01-15 23:48:09.747 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=TUNNEL,})

2019-01-15 23:48:09.747 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=TODO #002,})

2019-01-15 23:48:09.747 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #005,})

2019-01-15 23:48:09.748 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #006,})

2019-01-15 23:48:09.748 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare,})

2019-01-15 23:48:09.748 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #007,})

2019-01-15 23:48:09.748 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #012,})

2019-01-15 23:48:09.749 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gares #001,})

2019-01-15 23:48:09.749 INFO SCRIPTING: 10452( 99742)/I: DATABASE00003.?({[1]=Register ZONE:,[Name]=Gare #008,})

2019-01-15 23:48:09.749 INFO SCRIPTING: *** MOOSE INCLUDE END ***

2019-01-15 23:48:09.765 INFO SCRIPTING: 4023( 2)/E: BASE00000.TraceLevel(Tracing level 1)

2019-01-15 23:48:09.765 INFO SCRIPTING: 4046( 3)/E: BASE00000.TraceClass(Tracing class BASE)

2019-01-15 23:48:10.483 INFO EDTERRAINGRAPHICS41: surface5 gc() LOD 0 117 squares

2019-01-15 23:48:10.488 INFO EDTERRAINGRAPHICS41: surface5 gc() LOD 1 118 squares

2019-01-15 23:48:10.488 INFO EDTERRAINGRAPHICS41: surface5 gc() 11.707949 ms

2019-01-15 23:48:10.774 INFO SCRIPTING: Error in timer function: [string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00005394"]:6: attempt to index local 'BTRRoadMapper' (a nil value)

2019-01-15 23:48:10.774 INFO SCRIPTING: stack traceback:

[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5029: in function <[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5026>

[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00005394"]:6: in function <[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00005394"]:3>

(tail call): ?

[C]: in function 'xpcall'

[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5069: in function <[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5023>

2019-01-15 23:48:10.774 INFO SCRIPTING: Error in timer function: [string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00000C6E"]:6: attempt to index local 'BTRRoadMapper' (a nil value)

2019-01-15 23:48:10.774 INFO SCRIPTING: stack traceback:

[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5029: in function <[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5026>

[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00000C6E"]:6: in function <[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00000C6E"]:3>

(tail call): ?

[C]: in function 'xpcall'

[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5069: in function <[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5023>

2019-01-15 23:48:10.774 INFO SCRIPTING: Error in timer function: [string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00004AAB"]:6: attempt to index local 'BTRRoadMapper' (a nil value)

2019-01-15 23:48:10.774 INFO SCRIPTING: stack traceback:

[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5029: in function <[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5026>

[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00004AAB"]:6: in function <[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00004AAB"]:3>

(tail call): ?

[C]: in function 'xpcall'

[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5069: in function <[string "C:\Users\Flav\AppData\Local\Temp\DCS\/~mis00006948"]:5023>

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

@Flappie

 

Hi there!

 

Glad to hear that you've been able to map all the roads! :thumbup:

 

Don't worry about this error, I tested the script with trains in the Caucasus map and it worked.

 

6: attempt to index local 'BTRRoadMapper' (a nil value)

 

This is simply saying that "BTRRoadMapper" (which the script is trying to target) can't be found in your mission.

 

To fix this, check the following line in the script:

 

local RoadMapper = UNIT:FindByName("Name of the UNIT in ME")

 

 

Make sure that the UNIT name specified in the script (between those quotes) matches the UNIT name of the train in ME.

 

It can't be the GROUP name, it must be the UNIT name! Watch out for typos!

 

Also, you must remove any such line that refers to a BTR unit that's no longer present in your mission (otherwise you'll get this error).

 

I'll test this anyway, see if I notice something odd :thumbup:


Edited by Hardcard
Link to comment
Share on other sites

Ok, I've tested it and seems to work without issues.

 

I'm attaching a demo mission + the script it uses

 

Since there's no "train camera" in ME (as far as I can tell), I've included a gaz tigr vehicle that will travel with the train (roughly :D). Just use the vehicle camera to see what the train is doing.

Train mapping demo DMS coordinates.miz

Train mapping DMS.lua

Link to comment
Share on other sites

Ok, I've tested it and seems to work without issues.

 

I'm attaching a demo mission + the script it uses

 

Since there's no "train camera" in ME (as far as I can tell), I've included a gaz tigr vehicle that will travel with the train (roughly :D). Just use the vehicle camera to see what the train is doing.

I confirm that your train mission works well on my PC... but I really don't understand why my train mission is bugged. After all, I've only changed the vehicle type of my BTRs, I didn't rename them at all, and when I double check the names, they are still matching the names I put in the lua scripts... That's a mystery to me.

 

But I won't lose anymore time on this, I'll simply tweak your train mission to get things working at they were (multiple trains + automatic mission ending).

 

Thanks again!

 

 

 

 

EDIT: yeepee!

2019-01-16 21:47:15.839 INFO SCRIPTING: *** MOOSE INCLUDE END ***

2019-01-16 21:47:15.839 INFO SCRIPTING: 4055( 2)/E: BASE00000.TraceLevel(Tracing level 1)

2019-01-16 21:47:15.839 INFO SCRIPTING: 4078( 3)/E: BASE00000.TraceClass(Tracing class BASE)

2019-01-16 21:47:17.150 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 045 19.477'N 036 38.686'E,TrainMapper_1,

2019-01-16 21:47:17.150 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 044 44.969'N 037 44.534'E,TrainMapper_10,

2019-01-16 21:47:17.150 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 044 45.576'N 037 44.586'E,TrainMapper_11,

2019-01-16 21:47:17.150 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 044 54.046'N 037 58.190'E,TrainMapper_12,

2019-01-16 21:47:17.151 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 044 54.843'N 038 00.506'E,TrainMapper_13,

2019-01-16 21:47:17.151 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 045 19.280'N 036 38.543'E,TrainMapper_2,

2019-01-16 21:47:17.151 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 045 11.596'N 037 16.855'E,TrainMapper_3,

2019-01-16 21:47:17.151 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 045 07.492'N 037 23.850'E,TrainMapper_4,

2019-01-16 21:47:17.151 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 044 58.171'N 037 17.679'E,TrainMapper_5,

2019-01-16 21:47:17.152 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 045 23.261'N 038 30.982'E,TrainMapper_6,

2019-01-16 21:47:17.152 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 045 20.629'N 036 40.558'E,TrainMapper_7,

2019-01-16 21:47:17.152 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 044 50.314'N 037 39.073'E,TrainMapper_8,

2019-01-16 21:47:17.152 INFO SCRIPTING: 8( -1)/T: BASE00000.,0000028801LL DDM, 044 44.666'N 037 45.662'E,TrainMapper_9,


Edited by Flappie

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

Here's the mystery. :smilewink:

 

I've just noticed that the trains never stop: as soon as they reach the end of the line, they return to their starting waypoint (and so on). :lol:

I've been trying to stop them using the "Hold" task, or a "setGroupAIOff" action script, but to no avail. Do you hold the power of stopping those crazy trains?

Road mapping demo DDS coordinates_trains_v2_bugged.miz

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

Ok , mystery solved!

 

You forgot to actually add the locomotives to the train units you created (this is an extra step required for trains). That's why none of the scripts were finding anything.

 

https://i.imgur.com/qn6TE6t.jpg

 

On another note, are you sure you want to use a separate script for each train group?

 

You know that a single script can handle it all, right?

Is there a particular reason you're doing this?

 

Going to work on making those trains disappear now :D

Link to comment
Share on other sites

Ah OK, I'd never dealt with dynamic trains before. I didn't know one had to add a locomotive. :music_whistling:

 

When I was tracing the whole road network, I had to remember which street/road/highway had already been traced. Once a road was traced, I would simply change the corresponding vehicle's side from BLUE to RED and deactivate it. I also needed to edit every single traced road right after the "capture", so I don't miss any. For all those reasons, I didn't want to handle more than 13 vehicles at a time. Hence the dirty duplication of your original script. :surrender:

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

@Flappie

 

Last update before going to sleep.

 

Trains do not respond to :Destroy() (which is the typical MOOSE method I use to get rid of stuff).

 

Perhaps trains haven't been fully implemented with regard to the DCS scripting engine, that might explain this.

 

Right now I can't think of anything that would destroy those trains... I'm not even sure they can be destroyed with "conventional" methods (like shooting at them). I'll try tomorrow, I guess.

 

If that fails, I'm afraid you'll need to keep an eye on the trains and stop "tracking" as soon as they reach their last waypoint... sorry.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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