#Switch Posted March 15, 2014 Share Posted March 15, 2014 I've tried to use fadeCamera out when a map ends, but it doesn't work, its a server side script (base.lua from default race gamemode) here's the code: function RaceMode.endMap() if stateAllowsPostFinish() then fadeCamera ( source, false, 5, 0, 0, 0 ) -- fades out to black screen in 5 secs. gotoState('PostFinish') local text = g_GameOptions.randommaps and 'Next map starts in:' or '' Countdown.create(5, RaceMode.startNextMapSelect, text, 255, 255, 255, 2, 0 ):start() triggerEvent('onPostFinish', g_Root) end end i've tried changing arguments but it doesn't work, any idea? Link to comment
manawydan Posted March 15, 2014 Share Posted March 15, 2014 you can try use: for ipairs getElementsByType Link to comment
#Switch Posted March 16, 2014 Author Share Posted March 16, 2014 you can try use: for ipairs getElementsByType How? im not a "pro" scripter , could you explain me please? Link to comment
DNL291 Posted March 16, 2014 Share Posted March 16, 2014 for i, player in ipairs(getElementsByType("player")) do -- end Link to comment
Tete omar Posted March 16, 2014 Share Posted March 16, 2014 I suggest using 'root' instead of looping through all players E.g: fadeCamera ( root, false ) Link to comment
#Switch Posted March 16, 2014 Author Share Posted March 16, 2014 for i, player in ipairs(getElementsByType("player")) do -- end I suggest using 'root' instead of looping through all players E.g: fadeCamera ( root, false ) Thank you guys, it works perfectly! final result: function RaceMode.endMap() if stateAllowsPostFinish() then for i, player in ipairs(getElementsByType("player")) do fadeCamera ( root, false, 3.5, 0, 0, 0 ) -- fades out in 3.5 secs. end gotoState('PostFinish') local text = g_GameOptions.randommaps and 'Next map starts in:' or '' Countdown.create(4, RaceMode.startNextMapSelect, text, 255, 255, 255, 2, 0 ):start() triggerEvent('onPostFinish', g_Root) end end Link to comment
Saml1er Posted March 16, 2014 Share Posted March 16, 2014 for i, player in ipairs(getElementsByType("player")) do -- end I suggest using 'root' instead of looping through all players E.g: fadeCamera ( root, false ) Thank you guys, it works perfectly! final result: function RaceMode.endMap() if stateAllowsPostFinish() then for i, player in ipairs(getElementsByType("player")) do fadeCamera ( root, false, 3.5, 0, 0, 0 ) -- fades out in 3.5 secs. end gotoState('PostFinish') local text = g_GameOptions.randommaps and 'Next map starts in:' or '' Countdown.create(4, RaceMode.startNextMapSelect, text, 255, 255, 255, 2, 0 ):start() triggerEvent('onPostFinish', g_Root) end end If you're using root then you don't need to loop through all players, here: function RaceMode.endMap() if stateAllowsPostFinish() then fadeCamera ( root, false, 3.5, 0, 0, 0 ) -- fades out in 3.5 secs. gotoState('PostFinish') local text = g_GameOptions.randommaps and 'Next map starts in:' or '' Countdown.create(4, RaceMode.startNextMapSelect, text, 255, 255, 255, 2, 0 ):start() triggerEvent('onPostFinish', g_Root) end end Link to comment
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