Creation of a machine-gun wagon on the basis of an artillery wagon.

Place to get help with not working mods / modding interface.
Keysivi
Fast Inserter
Fast Inserter
Posts: 112
Joined: Mon Feb 07, 2022 5:29 pm
Contact:

Creation of a machine-gun wagon on the basis of an artillery wagon.

Post by Keysivi »

Good afternoon I'm trying to make a mod with a machine gun wagon by converting it from a vanilla artillery wagon

https://mods.factorio.com/mod/My_add_pack

I managed to more or less redo the graphics and change the basic parameters of the wagon. As a turret I used tank-machine-gun. But I ran into three unsolvable problems:

1. The turret wagon ignores biters and spitters and only tries to attack spawners.

2. When firing ammo, the turret does no damage to manufacturers.

3. The attack of producers is carried out only at a complete stop of the train. In motion, the turret does not attack, but folds into a marching mode.[/list]

I searched all the game files, but did not find the function responsible for these parameters.

Unfortunately, I do not know programming well, so I really count on the help of more experienced modders.

Thank you
robot256
Smart Inserter
Smart Inserter
Posts: 1248
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Creation of a machine-gun wagon on the basis of an artillery wagon.

Post by robot256 »

The artillery behavior code is in the base game and cannot be modified to act like a normal turret.

The turret wagons mod (https://mods.factorio.com/mod/Armored-train) achieves your goal by teleporting an invisible turret entity along with the train wagon. It's very inefficient right now because it's always teleporting, even when the train is stopped.
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Keysivi
Fast Inserter
Fast Inserter
Posts: 112
Joined: Mon Feb 07, 2022 5:29 pm
Contact:

Re: Creation of a machine-gun wagon on the basis of an artillery wagon.

Post by Keysivi »

Thanks for the answer. The Armored train mod has outdated graphics and very crooked animation. Plus there is no possibility of manual loading.

I tried to solve these problems by using the artillery wagon prototype. And I succeeded: the graphics and animation turned out to be good.

I also changed the parameter

Code: Select all

gun = "artillery-wagon-cannon"
to

Code: Select all

gun = "tank-machine-gun"
After that, the type of shooting changed

It was after this that the problems began. Since the behavior of the turret still remains the same.

This is most likely due to the

Code: Select all

type = "artillery-wagon"
parameter. since I replaced all other parameters except for the parameters of the car itself.

Theoretically, one could try to create a new type of wagon by copying and modifying the base scripts of the factorio artillery. But I searched all the base files of the game in lua format, but I did not find the scripts responsible for the behavior of the artillery wagon turret.

There is also a mod https://mods.factorio.com/mod/SchallArmouredTrain where it was possible to port the tank to the rails. But how it works is unclear. Since there are so many dependencies that the devil himself will break his leg.

-------------------------------------------------- ------------------------------------------------

It's a pity if nothing can be done. I managed to make a prototype with high-quality animation and graphics. It remains only to solve the issues with the code. For which, unfortunately, I lack the competence.

Thanks for the answer. The Armored train mod has outdated graphics and very crooked animation. Plus there is no possibility of manual loading.
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2767
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Creation of a machine-gun wagon on the basis of an artillery wagon.

Post by FuryoftheStars »

Keysivi wrote: Mon Mar 06, 2023 2:30 am This is most likely due to the

Code: Select all

type = "artillery-wagon"
parameter. since I replaced all other parameters except for the parameters of the car itself.
Yes, that is exactly why.
Keysivi wrote: Mon Mar 06, 2023 2:30 am Theoretically, one could try to create a new type of wagon by copying and modifying the base scripts of the factorio artillery. But I searched all the base files of the game in lua format, but I did not find the scripts responsible for the behavior of the artillery wagon turret.
None of this is exposed to us in this game. The closest we can come to creating "new" entity types is in using multiple together in a composite style, just like the mod authors of the mentioned mods did.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Keysivi
Fast Inserter
Fast Inserter
Posts: 112
Joined: Mon Feb 07, 2022 5:29 pm
Contact:

Re: Creation of a machine-gun wagon on the basis of an artillery wagon.

Post by Keysivi »

Thanks for clarifying!

It's sad ..... Unfortunately, making a composite wagon is too tough for me ....

We'll have to abandon this idea and remove the machine gun wagon from the mod.
Post Reply

Return to “Modding help”