Road decoration

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
ian`
Supporter
Reactions:
Posts: 104
Joined: Sat Apr 04, 2020 17:36
Location: Indonesien
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#41

Post by ian` »

Yes, but it's not easy to make. :?
:bc

User avatar
CommanderABab
AB
Reactions:
Posts: 9356
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#42

Post by CommanderABab »

That's cool!
...............:) .Image

imajoke
Inhabitant of a Conurbation
Reactions:
Posts: 464
Joined: Sun Oct 27, 2019 2:39
Location: what's this stalker stop asking me XD
Plugins: Show
Version: Beta

Re: Road decoration

#43

Post by imajoke »

*confused screaming*
Show
click me
MADE YA LOOK LOOOOL :space
youtube: curtis warren btw stop begging

User avatar
THEMAX
Inhabitant of a Universe
Reactions:
Posts: 4283
Joined: Thu Sep 14, 2017 17:30
Location: Astrellia, UHAE
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#44

Post by THEMAX »

ian` wrote:
Fri Feb 05, 2021 5: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.
Emperor of Atlantean federated empire
Image
Founder state of Internationxal council
Leader of AEOY and steel pact

User avatar
ian`
Supporter
Reactions:
Posts: 104
Joined: Sat Apr 04, 2020 17:36
Location: Indonesien
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#45

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
Interactive Lua editor
Run
:bc

User avatar
THEMAX
Inhabitant of a Universe
Reactions:
Posts: 4283
Joined: Thu Sep 14, 2017 17:30
Location: Astrellia, UHAE
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#46

Post by THEMAX »

How can i add night animations to a road animation (for example, to a lamp post)
Emperor of Atlantean federated empire
Image
Founder state of Internationxal council
Leader of AEOY and steel pact

User avatar
CommanderABab
AB
Reactions:
Posts: 9356
Joined: Tue Jun 07, 2016 21:12
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#47

Post by CommanderABab »

Add

Code: Select all

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

User avatar
THEMAX
Inhabitant of a Universe
Reactions:
Posts: 4283
Joined: Thu Sep 14, 2017 17:30
Location: Astrellia, UHAE
Plugins: Show
Version: Beta

Platform

Plugin Creator

Re: Road decoration

#48

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 ?
Emperor of Atlantean federated empire
Image
Founder state of Internationxal council
Leader of AEOY and steel pact

Post Reply Previous topicNext topic

Return to “Tutorials and Documentation”