Car Updated

Find tutorials, documentation, and resources for creating and using TheoTown plugins.
Previous topicNext topic
User avatar
Yakka Works
Inhabitant of a Conurbation
Reactions:
Posts: 412
Joined: 06 Jan 2020, 07:57
Location: Java-indonesia
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Car Updated

Post by Yakka Works »

this. Tutorial is incomplete,find original tutorial for moment
 ! Message from: CommanderABab
original here:
viewtopic.php?p=22167#p22167

Hello there, I'm recreating car and car chain tutorial
Car code basically looks like:

Code: Select all    Reset

[ { "type":"car", "speed":1.0, "v2":true, "frames":[ { "bmp":"img.png", "count":4, "w":20, "h":20 } ] } ]
JSON checker
Check
You will notice that I provide 4 frames here. That's needed as we need a frame (image) for each direction in which the car can drive. We indexed the directions as followed:
image.png


So example car frames looks like:
image (1).png
Notice how we load 4 frames from a single image by providing the width and height of each frame and the number of frames we want to extract. The plugin loader will automatically load "count" many frames of the given width and height from left to right out of the provided image. You can provide multiple cars within a single plugin by just providing more frames. The total number of frames has to be a multiple of 4.

It's worth to mention that "v2":true indicates that we want to use the second generation of car loading. We recommend that as it's much easier to use and takes less expensive texture space. However, a lot of cars are still internally defined using the old system. The provided frames there have to look like that:
image (2).png
We can do that by defining a car spawner with the following attributes:
• cars - An array of car ids
• radius - Radius for the cars to be spawned. Big radius are heavy on computation, so try to avoid them. To cover the whole map you might use a value like 512
• count - Number of cars that should be spawned
• targets - An array of building ids that should be targeted by spawned cars. If empty, any buildings will be
• targeted (default behavior). Entry null will represent the building in which the car spawner is defined (for convenience).

So spawner code looks like:

Code: Select all    Reset

"car spawner":[ { "cars":["$lobby_carplugin00"], "radius":10, "count":5 } ]
JSON checker
Check
Place it on building code,such as example Plugin

You can add some stuff such as:

Code: Select all    Reset

[ { "type":"car", "speed":1.0, "v2":true, "frames":[ { "bmp":"img.png", "count":4, "w":20, "h":20 } ], "capacity":10,//capacity for car "flag bus":true,//flag usefull for making train tram bus or others "frames per car":4,//usefull if you use multiple frames require atleast 2 frames "tail":["carid"]//usefull if you want make train or trams } ]
JSON checker
Check
Override in game car is possible see this

Find in game car id on JSON,but for example:
$carres00
$carres01
$carres02
$carind00
$carind01
$carind02
$carfirebrigade00
$carpolice00
$carbus00
$carswat00
$tank00
$mltry_truck00
$carmedic00

In game car frames:
image (4).png
For someone else who want make long train
PARTB.png
PARTA.png
this two image owned by me, please credit!

credit: theo & lobby
You do not have the required permissions to view the files attached to this post.
My plugins,up to date and it's free on my website. So check it out.
My website
Community/Creators Discord Server List
User avatar
Yakka Works
Inhabitant of a Conurbation
Reactions:
Posts: 412
Joined: 06 Jan 2020, 07:57
Location: Java-indonesia
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Car Updated

Post by Yakka Works »

Naufhal wrote: 05 Mar 2022, 13:04 @CommanderABab. This topic Is Fake! It From @Lobby. Not you. Can you fix your topic? :)
I've been put disclaimer on the top.
Why are you spamming reply on people's topic?, it's annoying for me.
My plugins,up to date and it's free on my website. So check it out.
My website
Community/Creators Discord Server List
User avatar
Adexdia4343
Inhabitant of a Megacity
Reactions:
Posts: 277
Joined: 24 May 2026, 07:16
Location: Lampung
Plugins: Showcase Store

Plugin Creator

Platform

Re: Car Updated

Post by Adexdia4343 »

Yakka wrote: 05 Mar 2022, 16:57
Naufhal wrote: 05 Mar 2022, 13:04 @CommanderABab. This topic Is Fake! It From @Lobby. Not you. Can you fix your topic? :)
I've been put disclaimer on the top.
Why are you spamming reply on people's topic?, it's annoying for me.
What is the code for trains and buses?
User avatar
Yakka Works
Inhabitant of a Conurbation
Reactions:
Posts: 412
Joined: 06 Jan 2020, 07:57
Location: Java-indonesia
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Car Updated

Post by Yakka Works »

Adexdia4343 wrote: 24 Jul 2026, 21:36
Yakka wrote: 05 Mar 2022, 16:57
Naufhal wrote: 05 Mar 2022, 13:04 @CommanderABab. This topic Is Fake! It From @Lobby. Not you. Can you fix your topic? :)
I've been put disclaimer on the top.
Why are you spamming reply on people's topic?, it's annoying for me.
What is the code for trains and buses?
Refer to this:
viewtopic.php?t=28157
Previous topicNext topic