Dzsozi (h03) Posted March 24, 2014 Posted March 24, 2014 Hey guys, so I want to make random camera positions for my account system. So when you in the login or register screen, it should change the camera positions with fade camera. How can I make it? Can somebody write me an example please? I would be grateful. Thank you!
manawydan Posted March 24, 2014 Posted March 24, 2014 you can use: math.random setCameraMatrix some tables some variables
WhoAmI Posted March 24, 2014 Posted March 24, 2014 I'm not sure that would work couse I'm doin it for first tiem, but cameraPosition = { -- x, y, z, lookAtX, lookAtY, lookAtZ { 0, 0, 0, 1, 1, 1 }, { 1, 1, 1, 2, 2, 2 } } minutes = 5 -- after how many minutes cameraMatrix should change addEventHandler ( "onPlayerJoin", root, function ( ) fadeCamera ( source, true ) local randomPos = cameraPosition [ math.random ( #cameraPosition ) ] setCameraMatrix ( source, randomPos [ 1 ], randomPos [ 2 ], randomPos [ 3 ], randomPos, [ 4 ], randomPos [ 5 ], randomPos [ 6 ] ) local timer = setTimer ( function ( ) local table = cameraPosition [ math.random ( #cameraPosition ) ] setCameraMatrix ( source, table [ 1 ], table [ 2 ], table [ 3 ], table, [ 4 ], table [ 5 ], table [ 6 ] ) end, minutes * 60000, 0 ) setElementData ( source, "joiningTimer", timer ) end ) addEventHandler ( "onPlayerLogin", root, function ( ) fadeCamera ( source, false ) local timer = getElementData ( source, "joiningTimer" ) if ( isTimer ( timer ) ) then killTimer ( timer ) end end )
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now