ADuke 1 Posted January 17, 2011 Hi, In a mission (via the init.sqf) I would like to start with a black screen, then "waitUntil" all players have loaded into the game, then fade in from black. I know how to do most of this, like the fade in and fade out. The problem I am having is the waitUntil portion, I am assuming I would name the playable units, then have something like... waitUntil {P1 == Player} & (P2 ==Player} and so on and so forth for the rest of the players.... Could anyone provide some clarity? Thanks, -AD Share this post Link to post Share on other sites
shuko 59 Posted January 17, 2011 Why would you need to have a black screen at the same time, instead of doing it for each client when they are ready? Share this post Link to post Share on other sites
ADuke 1 Posted January 17, 2011 Why would you need to have a black screen at the same time, instead of doing it for each client when they are ready? I have my reasons, it is because of some resource heavy scripts that I am running at init. Did you have a suggestion? Share this post Link to post Share on other sites
Gekkibi 11 Posted January 17, 2011 I know exactly what you mean. I have the same problem in my current MP-mission project. You can't use "p1 == player && p2 == player && ... && pn == player", because player is different to every client. You'll have to check it in client side. I am not sure if this works, but make a script that waits until player have loaded the mission (Not sure how... p1 == player..?) and then it sets a global variable to true and broadcasts it to other clients. Server has a waitUntil {var1 && var2 && ... && varn}; If it works could you be so kind to inform me? :) Share this post Link to post Share on other sites
ADuke 1 Posted January 17, 2011 I know exactly what you mean. I have the same problem in my current MP-mission project.You can't use "p1 == player && p2 == player && ... && pn == player", because player is different to every client. You'll have to check it in client side. I am not sure if this works, but make a script that waits until player have loaded the mission (Not sure how... p1 == player..?) and then it sets a global variable to true and broadcasts it to other clients. Server has a waitUntil {var1 && var2 && ... && varn}; If it works could you be so kind to inform me? :) OK, thanks, I will be sure to post the solution in this thread once I have it. :) Share this post Link to post Share on other sites
shuko 59 Posted January 17, 2011 Nope. Still wondering why would you need to have one client to wait for everyone else to load to show black screen on that client. If you insist that you need to do it that way, then, if nobody comes up with a better idea, you probably have to make each client tell the server that they have loaded with a simple: waituntil {!isnull player}; imReady = true; publicvariable "imReady"; Which the server will catch with a pubvar eventhandler. In that EH it will update and compare a list of ready clients with the current player list: if (count readyList == {isplayer _x} count playableunits) then { Share this post Link to post Share on other sites
Gekkibi 11 Posted January 17, 2011 @shk If you want to make sure all players can start the mission at the same time. I wouldn't use black screen myself, I would use disableUserInput to ensure they don't do anything. In my missions some players have to wait 15-20 seconds more than others... Share this post Link to post Share on other sites
shuko 59 Posted January 17, 2011 Yeah, I'd rather do black screen for each client right as he/she has loaded instead of having people running around for that 15 seconds before black screen. Share this post Link to post Share on other sites
ADuke 1 Posted January 17, 2011 Nope. Still wondering why would you need to have one client to wait for everyone else to load to show black screen on that client. Actually, to clarify.... What I want to happen is.... Screen starts off black (for everyone)... waitUntil all clients are loaded.... Fade back in from black. but you were right, waiting to show a black screen would be silly. Thanks for your suggestion. :) Share this post Link to post Share on other sites
Deadfast 43 Posted January 17, 2011 Use startLoadingScreen. Not only will it show a clear indication that something is being loaded, it will also make the scripts run much faster and therefore the loading will take less time. Share this post Link to post Share on other sites
gossamersolid 155 Posted January 18, 2011 Use startLoadingScreen. Not only will it show a clear indication that something is being loaded, it will also make the scripts run much faster and therefore the loading will take less time. I recently started using that feature and I'm loving it. Really helps get everything initialized really quick. Share this post Link to post Share on other sites
Nephris1 10 Posted January 18, 2011 (edited) titleText [format["Your text...... . please wait 10 seconds"], "BLACK OUT",0.1]; waituntil {(time > 10)}; waituntil{maybe_a_initfinish_varaiable_defined_before> 0}; titleText ["", "BLACK IN",2]; I never seriously worked b4 with startloadingscreen. Would it work instead using the titletext solution? The titletext kicks in as soon as each player == !isNull, is it also by using startloadingscreen and does it work properly in mp? Edited January 18, 2011 by Nephris1 Share this post Link to post Share on other sites
Gekkibi 11 Posted January 18, 2011 startLoadingScreen decreases the loading time. Haven't tested it yet, but it also should prevent user inputs in the game (For example, you can't blindly shoot everywhere, which is the case of a black screen). Share this post Link to post Share on other sites
wraith_v 11 Posted March 6, 2011 Hello, I stumbled across this thread with a similar problem In my mission the squad starts off in a freefall, the player just has to open the parachute. Unfortunately once i click start mission from the briefing, it comes up with 'receiving' and I can hear my squad mates talking to each other, then when I gain control of my character i have about 5 seconds to deploy my chute or i'll hit the ground and die. I just need the server to wait for any players to finish loading before starting the mission so everyone doesn't end up roadkill before their machines are loaded. I am a bit confused as to where i should put the code, and what code, there were a few good solutions but I am unsure which one would be best for me to use. i put startLoadingScreen at the start of my init.sqs and endLoadingScreen at the end, but it still takes too long to load. I could just increase the starting height for the soldiers, or start everyone already in parachute but I would prefer a more elegant solution. Share this post Link to post Share on other sites
gossamersolid 155 Posted March 6, 2011 You could make the players on the ground in a safe location, but when they are actually initialized via: waitUntil {!isNull player}; Then make it move the player to the desired height and be parachuting. Share this post Link to post Share on other sites
wraith_v 11 Posted March 6, 2011 (edited) Ok i put this at the end of my init.sqf file waitUntil { !isNull player };waitUntil { player == player }; _nul = [] execVM "parachute.sqf"; which calls this _thisgroup = swoop; _units_thisgroup = units _thisgroup; _height = 1000; { _x setpos [getpos _x select 0, getpos _x select 1,(getpos _x select 2) + _height]; _x flyinheight 1000; _x setvelocity [0,0,0]; [_x]exec "ca\air2\halo\data\Scripts\Halo_init.sqs"; _height = _height - 50; } forEach _units_thisgroup; It still ends up the same - briefing, then receiving screen while hearing wind rush past, then I gain control at a very low altitude. I've never attempted a multiplayer mission before could you please explain where i should be putting the code. I just need the server to wait for any players to finish loading before starting the mission so everyone doesn't end up roadkill before their machines have finished loading. Edited March 6, 2011 by Wraith_V Share this post Link to post Share on other sites
.kju 3245 Posted March 6, 2011 add sleep 1; before the code to make it post briefing phase Share this post Link to post Share on other sites
wraith_v 11 Posted March 6, 2011 Your solution works excellently PvPscene by having the character on the ground for 1 second it DRASTICALLY reduced the loading time, from 20+ seconds to ~ 5 seconds. Thanks so much guys! Share this post Link to post Share on other sites
nptccv 10 Posted April 8, 2011 (edited) waituntil {!isnull player}; imReady = true; publicvariable "imReady"; Which the server will catch with a pubvar eventhandler. In that EH it will update and compare a list of ready clients with the current player list: if (count readyList == {isplayer _x} count playableunits) then { Trying out something to synchronize players before script is run through. Would this work on a dedicated? init.sqf if (isServer) then { "playerReady" addPublicVariableEventHandler {readyList = (readyList +1); if (count readyList == {isplayer _x} count playableunits) then { allReady = true; publicVariable "allReady"; }; }; }; sqfname.sqf (execVM'd from init.sqf on client) waituntil {!isnull player}; playerReady = true; publicVariable "playerReady"; waituntil {(time>0) && (allReady)}; Edited April 8, 2011 by nptccv Share this post Link to post Share on other sites