Do you have any json / lua that can show me how this is done ? cause it could be really interesting for me since i am working on a train expansion plugin.
Road decoration
Moderators: Scenario Moderators, Plugin Moderators
- ian`
- Supporter
- Posts: 118
- Joined: 04 Apr 2020, 17:36
- Location: Indonesien
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: Road decoration
The code looks like this :
Code: Select all Reset
local lastCounterRight = Array{0, 0, 0} local lastCounterLeft = Array{0, 0, 0} local timer = 0 local x,y,level local isTrainOnTheTrack = false function script:update() if City.countRoads(Draft.getDraft'$road_barrier_open00') > 0 then x,y,level = City.getRoad(1, Draft.getDraft'$road_barrier_open00') elseif City.countRoads(Draft.getDraft'$road_barrier_closed00') > 0 then x,y,level = City.getRoad(1, Draft.getDraft'$road_barrier_closed00') end if timer == 0 then lastCounterRight[1] = Tile.getRoadCarCount(x+4, y+1, level) lastCounterRight[2] = Tile.getRoadCarCount(x+3, y+1, level) lastCounterRight[3] = Tile.getRoadCarCount(x+5, y+1, level) lastCounterLeft[1] = Tile.getRoadCarCount(x-4, y+1, level) lastCounterLeft[2] = Tile.getRoadCarCount(x-3, y+1, level) lastCounterLeft[3] = Tile.getRoadCarCount(x-5, y+1, level) Builder.buildRoad(Draft.getDraft'$road_barrier_open00',x,y,x,y) isTrainOnTheTrack = false timer = 1 elseif timer > 250 then lastCounterRight[1] = Tile.getRoadCarCount(x+4, y+1, level) lastCounterRight[2] = Tile.getRoadCarCount(x+3, y+1, level) lastCounterRight[3] = Tile.getRoadCarCount(x+5, y+1, level) lastCounterLeft[1] = Tile.getRoadCarCount(x-4, y+1, level) lastCounterLeft[2] = Tile.getRoadCarCount(x-3, y+1, level) lastCounterLeft[3] = Tile.getRoadCarCount(x-5, y+1, level) Builder.buildRoad(Draft.getDraft'$road_barrier_open00',x,y,x,y) isTrainOnTheTrack = false timer = 0 elseif timer > 1 then Builder.buildRoad(Draft.getDraft'$road_barrier_closed00',x,y,x,y) end if Tile.getRoadCarCount(x+4, y+1, level) ~= lastCounterRight[1] then if isTrainOnTheTrack then isTrainOnTheTrack = false end if not isTrainOnTheTrack and Tile.getRoadCarCount(x+3, y+1, level) ~= lastCounterRight[2] then timer = timer + 1 isTrainOnTheTrack = true if isTrainOnTheTrack then if Tile.getRoadCarCount(x-3, y+1, level) ~= lastCounterLeft[2] then if Tile.getRoadCarCount(x-4, y+1, level) ~= lastCounterLeft[1] then timer = 0 end end end elseif isTrainOnTheTrack and Tile.getRoadCarCount(x+5, y+1, level) ~= lastCounterRight[3] then isTrainOnTheTrack = false timer = 0 end elseif Tile.getRoadCarCount(x-4, y+1, level) ~= lastCounterLeft[1] then if isTrainOnTheTrack then isTrainOnTheTrack = false end if not isTrainOnTheTrack and Tile.getRoadCarCount(x-3, y+1, level) ~= lastCounterLeft[2] then timer = timer + 1 isTrainOnTheTrack = true if isTrainOnTheTrack then if Tile.getRoadCarCount(x+3, y+1, level) ~= lastCounterRight[2] then if Tile.getRoadCarCount(x+4, y+1, level) ~= lastCounterRight[1] then timer = 0 end end end elseif isTrainOnTheTrack and Tile.getRoadCarCount(x-5, y+1, level) ~= lastCounterLeft[3] then isTrainOnTheTrack = false timer = 0 end end end
Lua editor
- CommanderABab
- AB
- Posts: 11241
- Joined: 07 Jun 2016, 21:12
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: Road decoration
Add to the lit at night part.
Code: Select all
"light": true,
"light switching":true
- 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: Road decoration
Does someone have the json + the textures of the lamp post & the night animation of the lamp post so i can see how those are made ?
- 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: Road decoration
With the diagonal road update, have diagonal road decorations become possible or will it be something for later ? @Lobby @JustAnyone
- Yakka
- Inhabitant of a Conurbation
- Posts: 417
- Joined: 06 Jan 2020, 09:57
- Location: Java-indonesia
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: Road decoration
Is value true enabled and value false is disabled?
- Patchouli Knowledge
- Townsman
- Posts: 62
- Joined: 26 Sep 2020, 09:42
Re: Road decoration
How to add lights to road decorations?
- burgernamn
- Former aster dude
- Posts: 176
- Joined: 15 Apr 2022, 10:32
- Plugins: Showcase Store
-
Plugin Creator
Platform
Re: Road decoration
what does the ones and zeros mean
- Lakan Haraya
- Metropolitan
- Posts: 131
- Joined: 28 Mar 2019, 09:34
- Location: Philippines
- Plugins: Showcase Store
- Version: Beta
-
Plugin Creator
Platform
Re: 关于:道路装饰
Use 64 arrays
Code: Select all
"animation":[
{"id":"$animation_A"}, //this will be your 0
{"id":"$animation_B"}, //and this is 1
{"id":"$animation_C"} //2
// 3, 4, 5, ... if you add more
],
"frame animation indices":[
[],[],[],[], //here's for rotation 0
[],[0,1],[],[],
[],[],[0,2],[],
[],[],[],[],
[],[],[],[], //for rotation 1
[],[0,3],[],[],
[],[],[0,4],[],
[],[],[],[],
[],[],[],[], //rotation 2
[],[0,5],[],[],
[],[],[0,6],[],
[],[],[],[],
[],[],[],[], //rotation 3
[],[0,7],[],[],
[],[],[0,8],[],
[],[],[],[]
]
As you can see, four 16 arrays are grouped together, each 16-group is for each rotations

Re: Road decoration

thank you!Lakan Haraya wrote: ↑04 Jun 2023, 20:59Use 64 arraysThe placement of zeros are for frame 5 and frame 10 of road. You can also add more animations like how 1, 2, 3, ... are added in this example.Code: Select all
"animation":[ {"id":"$animation_A"}, //this will be your 0 {"id":"$animation_B"}, //and this is 1 {"id":"$animation_C"} //2 // 3, 4, 5, ... if you add more ], "frame animation indices":[ [],[],[],[], //here's for rotation 0 [],[0,1],[],[], [],[],[0,2],[], [],[],[],[], [],[],[],[], //for rotation 1 [],[0,3],[],[], [],[],[0,4],[], [],[],[],[], [],[],[],[], //rotation 2 [],[0,5],[],[], [],[],[0,6],[], [],[],[],[], [],[],[],[], //rotation 3 [],[0,7],[],[], [],[],[0,8],[], [],[],[],[] ]
As you can see, four 16 arrays are grouped together, each 16-group is for each rotations
Take note that rotationally aware road decos are only applicable for one-way roads
Re: Road decoration
Does anyone know where I might be able to get a guild on creating simple decorations for cities. Stuff like phonebooths, padestrian seats, etc. I know I can make building but I don't really have any place for that or road decorations right now.
- FVI
- Inhabitant of a Galaxy
- Posts: 2368
- Joined: 22 Feb 2022, 18:00
- Location: The largest island in Europe
- Plugins: Showcase Store
- Version: Beta
-
Platform
Re: Road decoration
You might try asking someone if he's interested in collaborating with you, but it's probably generally more practical doing the textures yourself.
- Ross The Mayor
- Villager
- Posts: 22
- Joined: 20 Dec 2023, 23:30
Re: Road decoration
Does anyone know the code for the cross walk road deco? How do you allow pedestrians to use it and cross the road?
- dnswodn
- Inhabitant of a Megacity
- Posts: 247
- Joined: 08 Feb 2022, 08:14
- Location:
Theonia
- Plugins: Showcase Store
-
Plugin Creator
Platform
Re: Road decoration
Add this:Ross The Mayor wrote: ↑26 Apr 2025, 19:13Does anyone know the code for the cross walk road deco? How do you allow pedestrians to use it and cross the road?
Code: Select all
"allow road crossing": true