Car chains

Learn here how to create and use plugins.

Moderators: Scenario Moderators, Plugin Moderators

User avatar
Lobby
Developer
Posts: 3719
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Car chains

#1

Post by Lobby » 07 Dec 2017, 19:35

See this thread on how to add custom cars to the game. Since version 385 you can define a chain of cars that behaves as one vehicle. See here an example:
2017-12-07 02.50.37.png
The garbage trucks were appended to the fire brigade truck to form long, connected vehicles. A better use would be for example a tram or a bending bus. There's basically no limit in the length of the chain.

To append cars to a car just use

Code: Select all

"tail":["anotherCarId",...]  // A list of cars to append
To append the car itself just use null as convenient placeholder. So a chain of a car of length 3 would have a tail of length 2:

Code: Select all

"tail":[null,null]
The car ids used in a tail array have to be already defined. Only the first variant (4 frames make up a variant) will be used for each car in a tail. You may use the empty/invisible car $car_null00 as placeholder between cars in a chain if sufficient.

The code to achieve the fire-garbage-trains as shown above :json

Code: Select all

[
  {
    "override":true,
    "id":"$carfirebrigade00",
    "type":"car",
    "frames":[{"x":512,"y":657,"w":32,"h":18,"count":4}],
    "tail":["$garbagetruck00","$garbagetruck00","$garbagetruck00","$garbagetruck00"]
  }
]
No extra graphics needed.
Last edited by Anonymous on 07 Dec 2017, 19:40, edited 1 time in total.
User avatar
Borbor
Inhabitant of a Conurbation
Posts: 360
Joined: 27 Apr 2017, 14:03
Location: Republic of Turkey
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: [385]Car chains

#2

Post by Borbor » 07 Dec 2017, 20:15

If I ask you to lobby, can you sample the json file?
User avatar
THEMAX
Inhabitant of a Universe
Posts: 4314
Joined: 14 Sep 2017, 17:30
Location: Astrellia, UHAE
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: [385]Car chains

#3

Post by THEMAX » 07 Dec 2017, 20:26

I will start to work on my tramway
User avatar
Lobby
Developer
Posts: 3719
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: [385]Car chains

#4

Post by Lobby » 07 Dec 2017, 21:08

@Borbor I added the json code to get the chains as shown in the image
@former member It won't be a DLC
User avatar
Lobby
Developer
Posts: 3719
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: [385]Car chains

#5

Post by Lobby » 07 Dec 2017, 21:29

I know :)
User avatar
KINGTUT10101
1,000,000 inhabitants
Posts: 2228
Joined: 07 Jul 2016, 22:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

Re: [385]Car chains

#6

Post by KINGTUT10101 » 09 Dec 2017, 17:25

Will there be a tutorial for custom zones soon?
User avatar
Imran M
Inhabitant of a Country
Posts: 844
Joined: 24 Oct 2018, 13:41
Plugins: Showcase Store

Plugin Creator

Platform

Re: Car chains

#7

Post by Imran M » 09 Dec 2018, 18:55

For people who use json Genie: "tail" is an array, and the ids are values. They don't have a title just a value
User avatar
JustAnyone
Developer
Posts: 3588
Joined: 23 Jul 2017, 12:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: [385]Car chains

#8

Post by JustAnyone » 09 Dec 2018, 20:10

KINGTUT10101 wrote: 09 Dec 2017, 17:25 Will there be a tutorial for custom zones soon?
There is one.
User avatar
KINGTUT10101
1,000,000 inhabitants
Posts: 2228
Joined: 07 Jul 2016, 22:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

Re: Car chains

#9

Post by KINGTUT10101 » 10 Dec 2018, 00:16

That comment was made a year ago..
User avatar
CommanderABab
AB
Posts: 11258
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: [385]Car chains

#10

Post by CommanderABab » 10 Dec 2018, 00:55

JustAnyone wrote: 09 Dec 2018, 20:10
KINGTUT10101 wrote: 09 Dec 2017, 17:25 Will there be a tutorial for custom zones soon?
There is one.
Show
loud
JustAnyone wrote: 09 Dec 2018, 20:10
User avatar
abcde
Settler
Posts: 2
Joined: 03 Jul 2020, 03:12

Re: Car chains

#11

Post by abcde » 06 Jul 2020, 11:18

What should I do if I want to make a train? The car chain looks like a train, but how to make it run on the rail? Can I add a few lines of code to make it a train?
thanks :bq
User avatar
Lobby
Developer
Posts: 3719
Joined: 26 Oct 2008, 12:34
Plugins: Showcase Store
Version: Beta

Platform

Re: Car chains

#12

Post by Lobby » 06 Jul 2020, 11:57

Basically yes, adding

Code: Select all

"flag normal": false,
"flag train": true
to your car chain would allow it to drive on rails. However, you need a building (e.g. a station) that spawns it because it won't be spawned automatically.
User avatar
ChunFangXin
Settler
Posts: 3
Joined: 11 Jul 2020, 07:54

Re: Car chains

#13

Post by ChunFangXin » 23 Jul 2020, 13:06

I'm very sorry to disturb you again, because I have encountered a terrible plug-in problem. I make a lot of trains, but they always carry a car. Sometimes I make a garbage truck on top of the train, and sometimes the fire engine will be embedded in the locomotive. It's strange. But I firmly believe that this is my programming. There is a problem with the two parameters of X and y. Because when I adjust these two parameters, the situation will change, but it never disappears. There is always this strange problem. What is the problem? How to calculate the four parameters of X, y, W and h when making automobile chain? thank you. I'm very sorry, because my English is not good, this paragraph uses the translation software to translate, if there is something wrong, I'm very sorry. :bq
User avatar
star Lee
Villager
Posts: 19
Joined: 06 Jul 2020, 04:57

Plugin Creator

Platform

Re: Car chains

#14

Post by star Lee » 24 Jul 2020, 13:18

Excuse me,what is this? :o
070f55a64b71aee3b6d8868020cd665.jpg
Attachments
070f55a64b71aee3b6d8868020cd665.jpg
070f55a64b71aee3b6d8868020cd665.jpg
User avatar
PetrovMaksYt
Inhabitant of a Megacity
Posts: 337
Joined: 16 Aug 2020, 11:26
Plugins: Showcase Store
Version: Beta

Platform

Re: Car chains

#15

Post by PetrovMaksYt » 10 Oct 2020, 10:41

star Lee wrote: 24 Jul 2020, 13:18 Excuse me,what is this? :o

070f55a64b71aee3b6d8868020cd665.jpg
Texture of vagons very long too.
User avatar
PetrovMaksYt
Inhabitant of a Megacity
Posts: 337
Joined: 16 Aug 2020, 11:26
Plugins: Showcase Store
Version: Beta

Platform

Re: Car chains

#16

Post by PetrovMaksYt » 10 Oct 2020, 10:41

or high
User avatar
imajoke
Inhabitant of a Conurbation
Posts: 532
Joined: 27 Oct 2019, 02:39
Plugins: Showcase Store
Version: Beta

Platform

Re: Car chains

#17

Post by imajoke » 14 Mar 2021, 22:02

ChunFangXin wrote: 23 Jul 2020, 13:06 I'm very sorry to disturb you again, because I have encountered a terrible plug-in problem. I make a lot of trains, but they always carry a car. Sometimes I make a garbage truck on top of the train, and sometimes the fire engine will be embedded in the locomotive. It's strange. But I firmly believe that this is my programming. There is a problem with the two parameters of X and y. Because when I adjust these two parameters, the situation will change, but it never disappears. There is always this strange problem. What is the problem? How to calculate the four parameters of X, y, W and h when making automobile chain? thank you. I'm very sorry, because my English is not good, this paragraph uses the translation software to translate, if there is something wrong, I'm very sorry. :bq
It isn't your programing, it's your textures.
User avatar
Wepf
Inhabitant of a Megacity
Posts: 285
Joined: 14 Oct 2021, 10:19
Location: Your lucid dream
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Car chains

#18

Post by Wepf » 18 Nov 2021, 11:22

Oke_21-11-18_13.38.37.png
For some reason, this happened to me
User avatar
SantiagoVal
Settler
Posts: 1
Joined: 11 Oct 2024, 11:11

Re: Car chains

#19

Post by SantiagoVal » 12 May 2025, 06:55

I want to make a mod of the Mexico City Metro, I want to make the textures and files, custom platforms, traffic lights and rails, the truth is I need help to create it, Because I don't know anything about creating plugins, and I would like to know if it is possible to use the bus dynamics, The one that has a personalized stop, that is like the bus stops and not a road decoration, And that you can put a road decoration and a stop at the same time, but I don't know how to do it, I need help from plugin creators
Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”