Semaphore profiles - possible one light green at a time?

Post Reply
User avatar
SimulatorSam
Posts: 4902
Joined: 05 Mar 2014 17:52
Location: United Kingdom
Contact:

Semaphore profiles - possible one light green at a time?

#1 Post by SimulatorSam » 11 Jan 2018 19:24

I'm trying to make a semaphore profile, with only one traffic light green at a time. For instance, if traffic light 2 is green, 0, 1 and 3 should be red.

However, what ever I seem to do there are always at least two of the traffic lights green.

I mostly understand how this system works from reading an old modding guide, however I'm not so sure on the cycle numbers. What do these actually mean? The default traffic lights are:

Code: Select all

	cycle[0]: 0.0
	cycle[1]: 21.0
	cycle[2]: 0.0
	cycle[3]: 21.0
So I thought my numbers would work like this, however it results in the same as the default cycle:

(Each semaphore ID in the prefab matches the node ID its near for simplicity sake)

Code: Select all

tr_semaphore_profile : tr_sem_prof.l_hadham {

	name: "little hadham uk"

	model: 4
	model[0]: "city"
	model[1]: "city"
	model[2]: "city"
	model[3]: "city"
	
	type: 4
	type[0]: traffic_light
	type[1]: traffic_light
	type[2]: traffic_light
	type[3]: traffic_light

	# 		green amber red
	interval: 4
	interval[0]: (15.0, 2.0, 23.0, 2.0)
	interval[1]: (15.0, 2.0, 23.0, 2.0)
	interval[2]: (15.0, 2.0, 23.0, 2.0)
	interval[3]: (15.0, 2.0, 23.0, 2.0)

	cycle: 4
	cycle[0]: 21.0
	cycle[1]: 42.0
	cycle[2]: 63.0
	cycle[3]: 84.0
}
[ external image ]
User avatar
MandelSoft
Beta tester
Posts: 788
Joined: 23 Aug 2013 18:55
Location: Zoetermeer [NL]
Contact:

Re: Semaphore profiles - possible one light green at a time?

#2 Post by MandelSoft » 11 Jan 2018 19:32

This won't work if you have set the def up like this.

First of all, for simplicity sake, one of the cycle time offsets should be 0, since the cycles "wrap around" in each cycle. I suggest to set the last cycle to 0.

Second, your total cycle time is 84 seconds. Now the numbers of each interval should add up to this. But in your case, they only add up to 42. You have to add the missing 42 seconds to each value in the third row, which represents the time in seconds that the traffic light shows red, like so:

Code: Select all

	interval[0]: (15.0, 2.0, 65.0, 2.0)
	interval[1]: (15.0, 2.0, 65.0, 2.0)
	interval[2]: (15.0, 2.0, 65.0, 2.0)
	interval[3]: (15.0, 2.0, 65.0, 2.0)
I hope this clarifies things a bit
╔═══╗────╔═╗╔═╗────╔╗
║╔═╗║────║║╚╝║║────║║
║╚═╝╠═╦══╣╔╗╔╗╠══╦═╝╠══╗
║╔══╣╔╣╔╗║║║║║║╔╗║╔╗║══╣
║║──║║║╚╝║║║║║║╚╝║╚╝╠══║
╚╝──╚╝╚══╩╝╚╝╚╩══╩══╩══╝
Don't ask us for a release date; we don't know either.
User avatar
SimulatorSam
Posts: 4902
Joined: 05 Mar 2014 17:52
Location: United Kingdom
Contact:

Re: Semaphore profiles - possible one light green at a time?

#3 Post by SimulatorSam » 11 Jan 2018 19:40

Right, that works and I understand the interval times. :) However, what do the cycle numbers them selves actually mean out of interest? :?

EDIT:

And how do I make the time it takes for the next light to go green take longer? The AI need some time to get though the prefab.
User avatar
MandelSoft
Beta tester
Posts: 788
Joined: 23 Aug 2013 18:55
Location: Zoetermeer [NL]
Contact:

Re: Semaphore profiles - possible one light green at a time?

#4 Post by MandelSoft » 11 Jan 2018 20:01

The cycle offsets are actually the offset for the interval. If you set the offset to x, then the intervals won't start at t=0, but t=x.
Use these two to get your traffic light timings correct. If you want more clearance time, add a few seconds to the red time for each phase, so in your case you add this clearance time four times. You also have to take this into account with your cycle offsets.
╔═══╗────╔═╗╔═╗────╔╗
║╔═╗║────║║╚╝║║────║║
║╚═╝╠═╦══╣╔╗╔╗╠══╦═╝╠══╗
║╔══╣╔╣╔╗║║║║║║╔╗║╔╗║══╣
║║──║║║╚╝║║║║║║╚╝║╚╝╠══║
╚╝──╚╝╚══╩╝╚╝╚╩══╩══╩══╝
Don't ask us for a release date; we don't know either.
Post Reply

Return to “Help center - player to player”

Who is online

Users browsing this forum: No registered users and 6 guests