Pennix_LeGaulois Posted June 6, 2021 Posted June 6, 2021 Hello everyone, I'm looking for ways to detect train carriages when a train reaches its destination. Usage would be as follow : the train includes several flak platforms & "platformnb" (the ones with disguised vehicles) the train can be attacked by players while it's moving towards its destination once the train reaches its final checkpoint, tanks would be generated depending on the number of platformnb that made it to the destination. I was expecting to use a Complex Trigger and specify "platformnb" in the Objects scripts list, but it seems none of the platforms are available. I did a quick search on the forum but did not manage to find a solution. Does anyone know a way to count the surviving platforms of a defined type ? Alternatively, I guess I could use an object link to the train (with either a Complex Trigger or a Check Zone) and maybe some clever use of "on damaged" report from the train to "fake" counting the destroyed platforms ? Maybe set the "Damage : (Step)" as 1/(nb of platforms + engine) and count OnDamaged Events. Would that work ?
Alonzo Posted June 6, 2021 Posted June 6, 2021 I don't know of a way to count the carriages, but your idea about counting the number of "on damaged" steps might work. I've always found OnDamaged (and even OnKilled) to be somewhat difficult to get right, for example bridges are a real pain. My other comment on this is that trains are pretty weak -- if the players find and attack the train it's quite a high likelihood they'll kill the locomotive. You might get almost the same effect on gameplay simply to have a constant number of tanks spawn if the train makes it, and possibly send more trains (via different routes) to make it more challenging for the players.
IckyATLAS Posted June 7, 2021 Posted June 7, 2021 I also wanted to have the possibility to manage the carriages but this is not possible. The Loc is the only item of the train you can control. The train is the Loc. The train is like a unique object and you do not have direct access to the carriages. The carriages seem to be a kind of internal elements of the Loc. As for the damaged or killed event messages they are completely unreliable and not precise and I have not been able to use them as a reflection of the carriage state. As an example you can have all your carriages damaged but the locomotive intact then it will be as the train is undamaged. With the BON coming and even with BOBp which are European battlefields where train attacks where a major activity of air ground support compared to the Kuban region, train damage management should be better implemented. I think the fundamental problem here is the way the train has been implemented as a single entity. When the carriages are damaged or destroyed and become separated from the train then you have to create from one unique entity multiple ones that where not known at start. This is why the train should be modelled as a convoy that is a set of vehicles target linked to the locomotive that acts as leader. Some specific behaviors for trains that differ from vehicle convoys would be implemented but the general approach would be that of the convoy. I suppose the devs will never take the time to do this. This would also imply to modify all the campaigns and missions published up to now to implement this new approach to trains. Trains are a good example of choices made at the beginning of a project upfront, and that down the line when you want to make a fundamental change it could be a daunting perspective in terms of work magnitude.
Pennix_LeGaulois Posted June 9, 2021 Author Posted June 9, 2021 On 6/7/2021 at 12:39 AM, Alonzo said: I don't know of a way to count the carriages, but your idea about counting the number of "on damaged" steps might work. I've always found OnDamaged (and even OnKilled) to be somewhat difficult to get right, for example bridges are a real pain. [...] On 6/7/2021 at 7:37 AM, IckyATLAS said: [...] As an example you can have all your carriages damaged but the locomotive intact then it will be as the train is undamaged. [...] Thank you both for your feedback. I performed the test (version 4.602, to help future forum archeologist ?) today : train with both flak platforms & "platformnb" (10 platforms total) "Damage : (Step)" as 0.1 display a subtitle every time an OnDamaged Event occured Result is clear : I was able to destroy each platform (starting from the last one), without any message being displayed -> train was considered undamaged by the game. when I hit the engine, I got the message. In conclusion, counting "on damaged" event does not work to approximate the state of carriages. Spoiler (in another test, I discovered that using the MCU Command: Damage would damage every part of the train (engine and all carriages) every time it is triggered (tested with both major and minor damage). I was surprised, but it seems to be a known behavior). 1
IckyATLAS Posted June 14, 2021 Posted June 14, 2021 On 6/9/2021 at 5:32 PM, Pennix_LeGaulois said: Thank you both for your feedback. I performed the test (version 4.602, to help future forum archeologist ?) today : train with both flak platforms & "platformnb" (10 platforms total) "Damage : (Step)" as 0.1 display a subtitle every time an OnDamaged Event occured Result is clear : I was able to destroy each platform (starting from the last one), without any message being displayed -> train was considered undamaged by the game. when I hit the engine, I got the message. In conclusion, counting "on damaged" event does not work to approximate the state of carriages. Reveal hidden contents (in another test, I discovered that using the MCU Command: Damage would damage every part of the train (engine and all carriages) every time it is triggered (tested with both major and minor damage). I was surprised, but it seems to be a known behavior). Thank you very much for this test. I did not have time to implement it but I was hinting it was so and know it is proven.
WWCephas Posted July 3 Posted July 3 (edited) I don't know if this is new but I could not find an answer to this problem I have wanted to work for several years now. I finally found a solution to make individual carriage cars count when destroyed or any other suitable function by using the Complex Trigger. You can use a complex trigger set to check Vehicles by nationality only, the object name does not register for trains it appears. Then choose what options you want like Object Entered or Object Killed. It will count each time a carriage takes one of these effects. This even works well for bomb attacks, counting each car individually destroyed and not lumping 4-5 killed at once as one kill. Unfortunately, this does not work with detecting the type of car killed as the Complex Trigger has no scripts lists for trains if had a need to detect that. To get over the limitation of not being able to use Object names you can set the radius up to 99000 and then make your trains an allied country so it does not count other vehicles on the map. If you want to use separate counters for each train perhaps to count the number of supplies that arrive from each location, you can set the maps coalition alignment in mission properties to a separate one for each train and match the coalition to the corresponding team. Edited July 3 by WWCephas
WWCephas Posted July 3 Posted July 3 (edited) @IckyATLAS @Pennix_LeGaulois @Alonzo Edited July 3 by WWCephas
IckyATLAS Posted July 6 Posted July 6 On 7/3/2025 at 5:34 PM, WWCephas said: I don't know if this is new but I could not find an answer to this problem I have wanted to work for several years now. I finally found a solution to make individual carriage cars count when destroyed or any other suitable function by using the Complex Trigger. You can use a complex trigger set to check Vehicles by nationality only, the object name does not register for trains it appears. Then choose what options you want like Object Entered or Object Killed. It will count each time a carriage takes one of these effects. This even works well for bomb attacks, counting each car individually destroyed and not lumping 4-5 killed at once as one kill. Unfortunately, this does not work with detecting the type of car killed as the Complex Trigger has no scripts lists for trains if had a need to detect that. To get over the limitation of not being able to use Object names you can set the radius up to 99000 and then make your trains an allied country so it does not count other vehicles on the map. If you want to use separate counters for each train perhaps to count the number of supplies that arrive from each location, you can set the maps coalition alignment in mission properties to a separate one for each train and match the coalition to the corresponding team. Interesting. It is clearly a plus. Thanks. One day maybe I will try to look to see how to handle the object limitation.
jollyjack Posted July 6 Posted July 6 quite interesting, WWCephas , maybe you can post a mission file with your test programming?
WWCephas Posted July 8 Posted July 8 (edited) Here is a simple mission for Single Player mode. A train will start randomly on East or West side and continue to the other side, stop at the end and 2 minutes later restart in the other direction. Besides objective scoring, another great function I have found for this is to stop runaway trains by forcing a Speed 0 STOP WP active at the end of the run when any car is detected destroyed. (Formation commands like STOP or PANIC STOP do not work on trains) Setting the STOP WP behind a train makes it come to an immediate stop with explosive results that are very unrealistic. Setting it to the end of the current run brings it to a slow realistic stop. (I have found no practical way to force a derail for effects when the attack point is unknown) If the train is attacked and any carriage is derailed by being blown up, the entire train will come to a stop within about a half mile at 60kmh. A message is set to appear on the map saying the train has been disabled along that route. If a further attack destroys up to 8 of the 10 cars a new message appears on the map saying the train is destroyed (respawning is locked out also). There is also an 8-minute timer that will give the "Destroyed" message if the engine itself is destroyed as it will de-spawn along with the entire train, so no more carriages can be killed anyway. One train is set to Red and the other to the Green nationality with a Complex trigger detecting each to make sure the proper STOP WP is selected. The mission map Mission Properties/Countries... is set to Axis for both Red and Green so they will behave in mission just like a German train would. I have other variants like a single train reversing at the end or you could make this work with a train with multiple stops as well, but maps can get finnicky with train routes if they go too far or pass several branches in the route, so it is best to keep them short. I have missions now with up to 10 train lines all running concurrently using this system. With careful placement you can re-use the color coding if the train runs do not overlap the complex triggers detection radius. You can also use any other nationality instead of the color codes (including the WWI variants) as long as they are set to the proper countries setting in the Mission properties. This will not be noticeable to players. You can also add another complex trigger detector that looks for all the keywords in a radius of up to 99000 meters to score all kills to trigger victory condition counters. If you need to chat to ask questions I am on WingWalkers Discord channel at tinyurl.com/ww92invite , post in IL2 ops. Train Carriage Counting.zip Edited July 8 by WWCephas 1
jollyjack Posted July 14 Posted July 14 Just ran a brief trial, set the plane to a typhoon with rockets, but have no time yet to look any further .. thanks. Been messing a lot with trains in the past, pity that there's no further development with other train types like the armored ones. The only thing i think is you can set those as static linked entry if i remember right.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now