Road decoration

Learn here how to create and use plugins.

Moderators: Scenario Moderators, Plugin Moderators

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: Road decoration

#41

Post by THEMAX »

ian` wrote:
05 Feb 2021, 05:06
Yes, but it's not easy to make. :?
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.

User avatar
ian`
Supporter
Posts: 118
Joined: 04 Apr 2020, 17:36
Location: Indonesien
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Road decoration

#42

Post by ian` »

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
Run

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: Road decoration

#43

Post by THEMAX »

How can i add night animations to a road animation (for example, to a lamp post)

User avatar
CommanderABab
AB
Posts: 11241
Joined: 07 Jun 2016, 21:12
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: Road decoration

#44

Post by CommanderABab »

Add

Code: Select all

"light": true,
"light switching":true
to the lit at night part.

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: Road decoration

#45

Post by THEMAX »

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 ?

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: Road decoration

#46

Post by THEMAX »

With the diagonal road update, have diagonal road decorations become possible or will it be something for later ? @Lobby @JustAnyone

User avatar
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

#47

Post by Yakka »

Lobby wrote:
14 May 2018, 16:21

Code: Select all

"exclusive":true
Is value true enabled and value false is disabled?

User avatar
Patchouli Knowledge
Townsman
Posts: 62
Joined: 26 Sep 2020, 09:42

Re: Road decoration

#48

Post by Patchouli Knowledge »

How to add lights to road decorations?

User avatar
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

#49

Post by Yakka »

Patchouli Knowledge wrote:
09 Apr 2022, 17:54
How to add lights to road decorations?
Ask @Pederont for that.

User avatar
burgernamn
Former aster dude
Posts: 176
Joined: 15 Apr 2022, 10:32
Plugins: Showcase Store

Plugin Creator

Platform

Re: Road decoration

#50

Post by burgernamn »

what does the ones and zeros mean

User avatar
黑色高级市长
Settler
Posts: 5
Joined: 15 Nov 2022, 12:56

关于:道路装饰

#51

Post by 黑色高级市长 »

@Lobby How to make a road decoration that can rotate on all sides? I want make a vehicle trim parked on one side on road and that looks to be in the right position from all four directions.

User avatar
Lakan Haraya
Metropolitan
Posts: 131
Joined: 28 Mar 2019, 09:34
Location: Philippines
Plugins: Showcase Store
Version: Beta

Plugin Creator

Platform

Re: 关于:道路装饰

#52

Post by Lakan Haraya »

黑色高级市长 wrote:
29 Mar 2023, 13:07
How to make a road decoration that can rotate on all sides?
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],[],
	[],[],[],[]
]
The 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.
As you can see, four 16 arrays are grouped together, each 16-group is for each rotations
:teachTake note that rotationally aware road decos are only applicable for one-way roads

User avatar
黑色高级市长
Settler
Posts: 5
Joined: 15 Nov 2022, 12:56

Re: Road decoration

#53

Post by 黑色高级市长 »

:fire
Lakan Haraya wrote:
04 Jun 2023, 20:59
黑色高级市长 wrote:
29 Mar 2023, 13:07
How to make a road decoration that can rotate on all sides?
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],[],
	[],[],[],[]
]
The 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.
As you can see, four 16 arrays are grouped together, each 16-group is for each rotations
:teachTake note that rotationally aware road decos are only applicable for one-way roads
thank you!

User avatar
Jtrendz
Villager
Posts: 13
Joined: 25 Oct 2024, 17:15

Re: Road decoration

#54

Post by Jtrendz »

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.

User avatar
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

#55

Post by FVI »

Jtrendz wrote:
17 Nov 2024, 01:30
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.
You might try asking someone if he's interested in collaborating with you, but it's probably generally more practical doing the textures yourself.

User avatar
Ross The Mayor
Villager
Posts: 22
Joined: 20 Dec 2023, 23:30

Re: Road decoration

#56

Post by Ross The Mayor »

Does anyone know the code for the cross walk road deco? How do you allow pedestrians to use it and cross the road?

User avatar
dnswodn
Inhabitant of a Megacity
Posts: 247
Joined: 08 Feb 2022, 08:14
Location: 🏞️ Theonia 🌁
Plugins: Showcase Store

Plugin Creator

Platform

Re: Road decoration

#57

Post by dnswodn »

Ross The Mayor wrote:
26 Apr 2025, 19:13
Does anyone know the code for the cross walk road deco? How do you allow pedestrians to use it and cross the road?
Add this:

Code: Select all

"allow road crossing": true

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”