Jump to content
Sign in to follow this  
dzrealkiller

Fake loading screen before able to spawn?

Recommended Posts

This may sound extremely weird but its just for looks and feel.. I would like to do some sort of script that when a player joins the server an image pops up and fills the screen with a custom image that says "loading..." and after say 5-10 seconds the image goes and they can then play.. its cosmetic only for looks and feel... any ideas?

 

Also want to add some quiet background music while the image is on the screen and when the image leave the screen the music stops.

Share this post


Link to post
Share on other sites

I'm sorry not sure what I'm looking at their I see you're post but looking through defines.hpp there's a lot of stuff in there is all of it for the image? I seen something about safezones in there also, I'm pretty new to all this I have basic understanding but Im not a genius lol could you throw a little guidance my way please... unless the entire thing is for the images then i know what to do.

Share this post


Link to post
Share on other sites

I'm sorry not sure what I'm looking at their I see you're post but looking through defines.hpp there's a lot of stuff in there is all of it for the image? I seen something about safezones in there also, I'm pretty new to all this I have basic understanding but Im not a genius lol could you throw a little guidance my way please... unless the entire thing is for the images then i know what to do.

The defines.hpp also has a lot of configs for other controls, not just the image. But you don't really need them because they're the default ones already in the game.

 

If you want simply to display one picture:

disableSerialization;
_ctrl = (findDisplay 46) ctrlCreate ["RscPicture", 80001];
_ctrl ctrlSetPosition [safezoneX, safezoneY, safezoneW, safezoneH];
_ctrl ctrlSetText "yourpicture.jpg";
_ctrl ctrlCommit 0;
sleep 5;
ctrlDelete _ctrl;

Share this post


Link to post
Share on other sites

Still no idea how to do this, This is my first time messing with defines and such :S

No need for defines, just run the above script.

 

I don't know much about MP scripting but I guess you should add the script in the initPlayerLocal.sqf.

Share this post


Link to post
Share on other sites

Ok I made a new file called initPlayerLocal.sqf

 

I then added:

disableSerialization;
_ctrl = (findDisplay 46) ctrlCreate ["RscPicture", 80001];
_ctrl ctrlSetPosition [safezoneX, safezoneY, safezoneW, safezoneH];
_ctrl ctrlSetText "Testing_Image.jpg";
_ctrl ctrlCommit 0;
sleep 5;
ctrlDelete _ctrl;

and saved it. I then launched the server but no image shows, Am I supposed to do something where it says safezone? Currently I have no safezones setup on the mission. :S Sorry I am kinda learning things as I go.

 

Do I need to call the file or does It read it automatically?

Share this post


Link to post
Share on other sites

Ahh ok will have a mess about and see if i cant make something show up, Thanks :)

 

I would re-write your script as this:

// initPlayerLocal.sqf

// fnc_loadScreen - dummy loadscreen
[] spawn {
    waitUntil {!isNull (findDisplay 46)};
    _display = findDisplay 46;
    _control = _display ctrlCreate ["RscPicture", 22505];
    _control ctrlSetPosition [0,0,safeZoneW,safeZoneH]; // Not sure the position is correct
    _control ctrlCommit 0;
    _control ctrlSetText "path\to\picture.paa";
    sleep 5;
    ctrlDelete _control;
};
// not tested

initPlayerLocal.sqf usually executed before Display #46 is created.

 

 

Regards,

 

Bull

Share this post


Link to post
Share on other sites

My bad, forgot that Arma does that!

 

Adjusted code:

// initPlayerLocal.sqf
 
// fnc_loadScreen - dummy loadscreen
[] spawn {
    disableSerialization;
    waitUntil {!isNull (findDisplay 46)};
    _display = findDisplay 46;
    _control = _display ctrlCreate ["RscPicture", 22505];
    _control ctrlSetPosition [0,0,safeZoneW,safeZoneH]; // Not sure the position is correct
    _control ctrlCommit 0;
    _control ctrlSetText "path\to\picture.paa";
    sleep 5;
    ctrlDelete _control;
};
// not tested

disableSerialization must be used inside the "spawn" scope

Share this post


Link to post
Share on other sites

bull_a, you're right; the waituntil is probably needed.

 

The error happens because the disableSerialization is missing.

 

edit. oh, you ninja'd.

That position will not fill the screen. 0,0 is not the corner of the screen.

Hence:

_control ctrlSetPosition [safezoneX, safezoneY, safezoneW, safezoneH];

Share this post


Link to post
Share on other sites

Says it cant load mipmap now any ideas? for testing I am using a .jpg image that's ok for testing right? or does it only work with .paa files?

Share this post


Link to post
Share on other sites

I have had *.jpg working in the past. Best practice is to use *.paa as this file type is native to the engine. Remember to use sizes that are ^2 (e.g. 1024x1024, 512x512...)

 

 

That position will not fill the screen. 0,0 is not the corner of the screen.

Hence:

_control ctrlSetPosition [safezoneX, safezoneY, safezoneW, safezoneH];

 

:banghead:  Silly me, I always use the GUI_GRID defines so for me its always '0'  :)

Share this post


Link to post
Share on other sites

Ok that worked but it only shows for a second then my loadout selection menu comes up, Not sure if the loadout selection is closing the image or if the image is just closing by its self really fast. 

Share this post


Link to post
Share on other sites

I have had *.jpg working in the past. Best practice is to use *.paa as this file type is native to the engine. Remember to use sizes that are ^2 (e.g. 1024x1024, 512x512...)

JPG's work, at any aspect ratios too. At least with RscPicture.

 

No idea about the "Can't load mipmap" though. :huh:

 

Ok that worked but it only shows for a second then my loadout selection menu comes up, Not sure if the loadout selection is closing the image or if the image is just closing by its self really fast.

Yeah, other dialogs may close it. You could add a delay before it runs?

Share this post


Link to post
Share on other sites

Yeah, other dialogs may close it. You could add a delay before it runs?

 

Hm any idea on how?

 

Here is my InitServer.sqf:

// Loadouts
WaitUntil {Sleep 1; Local Player};
    _gear = [west, "west1"] call BIS_fnc_addRespawnInventory; //Assault BluFor
    _gear = [west, "west2"] call BIS_fnc_addRespawnInventory; //Engineer BluFor
    _gear = [west, "west3"] call BIS_fnc_addRespawnInventory; //Sniper BluFor
    _gear = [west, "west4"] call BIS_fnc_addRespawnInventory; //Medic BluFor
    _gear = [west, "west5"] call BIS_fnc_addRespawnInventory; //Support BluFor
	
    _gear = [east, "east1"] call BIS_fnc_addRespawnInventory; //Assault OpFor
    _gear = [east, "east2"] call BIS_fnc_addRespawnInventory; //Engineer OpFor
    _gear = [east, "east3"] call BIS_fnc_addRespawnInventory; //Sniper OpFor
    _gear = [east, "east4"] call BIS_fnc_addRespawnInventory; //Medic OpFor
    _gear = [east, "east5"] call BIS_fnc_addRespawnInventory; //Support OpFor

I believe that's what pulls up the menu but I also have respawns that are joint to that menu :S

 

And Description.ext:

respawn = "BASE"; // CAN ALSO BE 3
respawnDelay = 10;
respawnOnStart = 1;
respawnButton = 1;
respawnTemplates[] = {"Tickets", "EndMission", "Counter", "MenuPosition", "MenuInventory"};

I think the respawnOnStart = 1; pulls up the menu not 100% though cant remember lol

Share this post


Link to post
Share on other sites

What I beleive is happending is this sequence:

 

1. Script holds until Display #46 is created

2. RscPicture control created in display 46

3. Momentary pause (because is sleep function in initPlayerLocal.sqf)

4. MenuPosition dialog displays as an overlay on Display #46 (effectively closing the display)

5. Once MenuPosition dialog is closed Display #46 is shown again, but the RscPicture control has already been destroyed

 

If you set respawnOnStart to -1 you would not open the MenuPosition dialog and would see the RscPicture

Share this post


Link to post
Share on other sites

Absolutely correct, putting respawnOnStart to -1 did the trick but the issue Is to spawn with a loadout from my kit selection I have to have that turned on "respawnOnStart = 1;" If not it will spawn me as a basic soldier, Anyway to get around this?

Share this post


Link to post
Share on other sites

Easy answer, no

 

Hard answer, yes. But there are so many things to do that it is not worth the effort. Basically you would have to write your own respawn template, which is not impossible (lots of people have done it) but is very difficult and complex. Lots of things to consider in multiplayer 

Share this post


Link to post
Share on other sites

Hmm ... what about players select their gear and spawn point and then the image comes up instantly when they have spawned and locks their players position for like 5-10 seconds and then maybe have game sound auto muted then once the image goes the player gets unlocked and the sound comes back? there would be a way to do that right? and it would be easier? 

 

The only reason I want to do this is because later I will make more missions in different areas and different maps and would like a custom image for each to show the zones and map they will be playing on and such. just gives a nice touch I think.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×