Cars

Find tutorials, documentation, and resources for creating and using TheoTown plugins.
Previous topicNext topic
User avatar
Lobby
Inhabitant of a Supercluster
Reactions:
Posts: 3759
Joined: 26 Oct 2008, 10:34
Plugins: Showcase Store

Re: Cars

Post by Lobby »

@Imran M That's because of the order in which your files are read in. Rename your "space cars" folder into "a_space cars" to ensure that it will be loaded first.
User avatar
Imran M
Inhabitant of a Country
Reactions:
Posts: 834
Joined: 24 Oct 2018, 11:41
Plugins: Showcase Store

Plugin Creator

Platform

Re: Cars

Post by Imran M »

Thanks! I didn't know that!
I just love the DOPE-amine you get after completing a plugin!
User avatar
Imran M
Inhabitant of a Country
Reactions:
Posts: 834
Joined: 24 Oct 2018, 11:41
Plugins: Showcase Store

Plugin Creator

Platform

Re: Cars

Post by Imran M »

Meh, close enough.
You do not have the required permissions to view the files attached to this post.
I just love the DOPE-amine you get after completing a plugin!
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Cars, did you know? Designating level in car spawner.

Post by CommanderABab »

Code: Select all

"car spawner":[
           {
             "cars":["$bigcarplugin63"],
             "count":1000,
             "radius":3000,
             "level":-1,
              "targets":[
                "$busdepot00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$busstop00",
                "$busdepot00",
                "$railstation00",
                "$bigpark00" ,
                "$easteregg00"
            ] 
           },
           {
             "cars":["$bigcarplugin63"],
             "count":1000,
             "radius":3000,
             "level":0,
              "targets":[
                "$busdepot00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$busstop00",
                "$busdepot00",
                "$railstation00",
                "$bigpark00" ,
                "$easteregg00"
            ] 
           },
           {
             "cars":["$bigcarplugin63"],
             "count":1000,
             "radius":3000,
             "level":1,
              "targets":[
                "$busdepot00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$busstop00",
                "$busdepot00",
                "$railstation00",
                "$bigpark00" ,
                "$easteregg00"
            ] 
           },
           {
             "cars":["$bigcarplugin63"],
             "count":1000,
             "radius":3000,
             "level":2,
              "targets":[
                "$busdepot00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$busstop00",
                "$busdepot00",
                "$railstation00",
                "$bigpark00" ,
                "$easteregg00"
            ] 
           },
           {
             "cars":["$bigcarplugin63"],
             "count":1000,
             "radius":3000,
             "level":3,
              "targets":[
                "$busdepot00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$busstop00",
                "$busdepot00",
                "$railstation00",
                "$bigpark00" ,
                "$easteregg00"
            ] 
           },
           {
             "cars":["$bigcarplugin63"],
             "count":1000,
             "radius":3000,
             "level":4,
              "targets":[
                "$busdepot00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$easteregg00",
                "$busstop00",
                "$busdepot00",
                "$railstation00",
                "$bigpark00" ,
                "$easteregg00"
            ] 
           },
           {
             "cars":["$bigcarplugin63"],
             "count":100,
             "radius":300,
             "level":1           
           }
         ],
That you can spawn cars from different levels?
So, if car spawner designates level 3 for a car(s), then that/those car(s) you would spawn directly to a level 3 bridge next to the building.

I think default ground level would be 0.
my avatar:
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Cars

Post by CommanderABab »

Your .json with commas expanded to commas and linefeed:

Code: Select all

{ "id":"milkcar.28eu9jd",
 "type":"car",
 "frames":[ {"bmp":"milkcar.png",
"w":15,
"h":10,
"count":4} ,
 {"bmp":"milkcar.png",
"w":15,
"h":10,
"count":4},
 {"bmp":"milkcar.png",
"w":15,
"h":10,
"count":4} ],
 "v2":true,
 "capacity":1,
 "flag normal":false,
 "flag user2":true },
 [ { "id":"milfarm929jd",
 "type":"industrial",
 "workers":190,
 "author":"Lancaster Kingdom",
 "width":1,
 "height":1,
 "frames":[{"bmp":"milkfarm.png"}],
 "smoke":[{"id":"$smoke07",
"x":13,
"y":-14}],
 "level":3,
 "car spawner":[ { "cars":["milkcar.28eu9jd"],
 "radius":100,
 "count":70 } ] } ]
Should be:

Code: Select all

[{ "id":"milkcar.28eu9jd",
 "type":"car",
 "frames":[ {"bmp":"milkcar.png",
"w":15,
"h":10,
"count":4}  ],
 "v2":true,
 "capacity":1,
 "flag normal":false,
 "flag user2":true },
 { "id":"milfarm929jd",
 "type":"industrial",
 "workers":190,
 "author":"Lancaster Kingdom",
 "width":1,
 "height":1,
 "frames":[{"bmp":"milkfarm.png"}],
 "smoke":[{"id":"$smoke07",
"x":13,
"y":-14}],
 "level":3,
 "car spawner":[ { "cars":["milkcar.28eu9jd"],
 "radius":100,
 "count":70 } ] } ]
I redacted multiple uses of the same .png in the frames statements for the car, but that wasn't causing your problem. The json being an array [] of objects {}, didn't start with the initial [, which was later in the file. I moved it to the beginning.
my avatar:
User avatar
CERRERA
Townsman
Reactions:
Posts: 48
Joined: 25 Jan 2020, 04:19
Location: Philippines
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Cars

Post by CERRERA »

How about elevated train
Everything you can imagine is real
User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2211
Joined: 07 Jul 2016, 20:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Cars

Post by KINGTUT10101 »

Lobby wrote: 25 Jan 2018, 23:51 2. You have to add this into your bus definition:

Code: Select all

"template":"$template_bus00"
The bus will then be added to the variants of busses.
Is there a template for emergency vehicles, like SWAT vans, to be specific?
User avatar
Lobby
Inhabitant of a Supercluster
Reactions:
Posts: 3759
Joined: 26 Oct 2008, 10:34
Plugins: Showcase Store

Re: Cars

Post by Lobby »

No, there's not. You'd have to write the template yourself if you need one. See content_car.json in the json resource topic for the needed attributes.
User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2211
Joined: 07 Jul 2016, 20:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Cars

Post by KINGTUT10101 »

I took a look at the SWAT van's definition, and I didn't find anything out of the ordinary that seemed to give it the functionality I wanted. Are the emergency vehicles hard-coded?
User avatar
JustAnyone
Honorary Contributor
Reactions:
Posts: 3666
Joined: 23 Jul 2017, 10:45
Location: Easter Island
Plugins: Showcase Store

Platform

Re: Cars

Post by JustAnyone »

Yes
User avatar
THEMAX
Inhabitant of a Universe
Reactions:
Posts: 4313
Joined: 14 Sep 2017, 15:30
Location: Astrellia, UHAE
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Cars

Post by THEMAX »

I was wondering lately if it would be possible to allow a vehicle to spawn from a specific income level / category building such as T Industrial, TTT Residential and etc... as i am resuming work on a very old plugin i used to work on which would add new TTT / TT or T vehicles for existing buildings.
Emperor of Atlantean federated empire
Image
Founder state of Internationxal council
Leader of AEOY and steel pact
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Cars

Post by CommanderABab »

Yes
my avatar:
User avatar
THEMAX
Inhabitant of a Universe
Reactions:
Posts: 4313
Joined: 14 Sep 2017, 15:30
Location: Astrellia, UHAE
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Cars

Post by THEMAX »

how can this be done then ?
Emperor of Atlantean federated empire
Image
Founder state of Internationxal council
Leader of AEOY and steel pact
User avatar
CommanderABab
AB
Reactions:
Posts: 11269
Joined: 07 Jun 2016, 19:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Cars

Post by CommanderABab »

Code: Select all

"car spawner":[
           {
             "cars":["$yourcarid","$anothercarid","$etccarid"],
             "flags": ["garbage"],
             "count":36,
             "radius":1300          
           }
         ],
garbage for example of flags.
count should probably be lower.
radius should be less if you like to see your vehicles near the building only.
my avatar:
User avatar
TheoKier[YT]
Villager
Reactions:
Posts: 22
Joined: 11 Sep 2020, 02:58
Location: Philippines
Plugins: Showcase Store

Re: Cars

Post by TheoKier[YT] »

Pls help me i try to put it on my json with the building but when i open theotown it says n is negative and i cant play the game pls help whats the json for garbage car/truck...
User avatar
TheoKier[YT]
Villager
Reactions:
Posts: 22
Joined: 11 Sep 2020, 02:58
Location: Philippines
Plugins: Showcase Store

Re: Cars

Post by TheoKier[YT] »

I tried the car spawner thing pls help is there a json for the car also that will not ruined the json for my building?
User avatar
TheFennekin
Inhabitant of a Galaxy Cluster
Reactions:
Posts: 2715
Joined: 24 Aug 2017, 09:17
Location: honsing around
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Cars

Post by TheFennekin »

Can you please show your json please?
Image
User avatar
star Lee
Villager
Reactions:
Posts: 19
Joined: 06 Jul 2020, 02:57

Plugin Creator

Platform

Re: Cars

Post by star Lee »

How can I get my car on the bus lane? I want to make a bus .
User avatar
Lobby
Inhabitant of a Supercluster
Reactions:
Posts: 3759
Joined: 26 Oct 2008, 10:34
Plugins: Showcase Store

Re: Cars

Post by Lobby »

Code: Select all

    "flag bus":true,
This will allow the car to use bus lanes.
User avatar
Zoll
Settler
Reactions:
Posts: 6
Joined: 29 Oct 2020, 04:12

Re: Cars

Post by Zoll »

Why does some frame of my truck offset?

This happen sometimes but I don't understand why.
I used to just move their position in the image, not sure if that's how we supposed to deal with it :shock:
Screenshot_2020-11-08-10-58-57-73.png
Screenshot_2020-11-08-10-58-46-85.png
Screenshot_2020-11-08-10-58-30-32.png
He's moving, not parked at side of the road, it just you can't see it
Screenshot_2020-11-08-10-59-08-19.png

The code:

Code: Select all    Reset

[{ "flag normal":true, "flag pkw":false, "frames":[{"bmp":"JBPM_ScaniaP310.png","count":4,"h":19,"w":25}], "id":"$carfirebrigade00", "meta":{"tags":{"medic":{}}}, "speed":1, "type":"car", "v2":true, "override":true }]
JSON checker
Check
Probably because the override?

Are my placement in texture is corrrct?
JBPM_ScaniaP310.png
Please don't use the texture yet, it's not done and looks weird. I will publish it when he's good. Not sure why I named it P310.
You do not have the required permissions to view the files attached to this post.
Previous topicNext topic