Jump to content

fadeCamera for all doesn't work.


#Switch

Recommended Posts

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
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...