Community Forum

Traffic Light - change light on time (loop)

Forum Overview >> Farming Simulator 2011

CategoryFarming Simulator 2011
Created09.07.2011 13:53


Dominik Woźniak (cdplastyk) 09.07.2011 13:57
Hello.

I want to do traffic lights into LS2011. Is it possible to do time switch two textures / planes using the parameter "Visiblity"?
If so, how it runs in a loop 20-30 sec?

Florian Otte (unknown) 14.07.2011 01:39
Hi there.
I'm not sure aboud the texture thingy using the visibility. But for the loop you should be able to use the usual update function and check the elapsed time using os.clock().

e.g.:

if global_start == nil then
global_start = os.clock();
elseif (os.clock() - global_start) % 20 == 0 then
-- change stuff

os.clock() returns the time since the start of lua in seconds.
-- do stuff every20sec.
end;



Note: Log in to post. Create a new account here.