Car Updated
Posted: 28 Mar 2021, 03:05
this. Tutorial is incomplete,find original tutorial for moment
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
So example car frames looks like: 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: 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
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
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: For someone else who want make long train this two image owned by me, please credit!
credit: theo & lobby