Jump to content
Sign in to follow this  
bloodxgusher

Intro Skip

Recommended Posts

So I am working on a mission that plays a video once the player enters mission.

Its a 15 sec video but i want to give familiar players the option to skip the video once it starts playing

he is the code I have assembled to try and get this done.




//sleep 1;


//1.10 cutText ["", "BLACK OUT"];


_video = ["test.ogv", true];


scriptName "initMission.hpp: mission start";
["test.ogv", true] spawn BIS_fnc_titlecard;	
if (BIS_fnc_titlecard_finished) then {terminate _video};
waitUntil {!(isNil "BIS_fnc_titlecard_finished")};



//_video = ["test.ogv", -1, -1, 3.1, 3.1] spawn bis_fnc_playVideo;


//waitUntil {scriptDone _video}; 


sleep 1; 


1.10 cutText ["", "BLACK IN"];


//hint "video over";  


sleep 15;


The current issue I have with this is that the video stops but audio from the video still runs its course.

I tried to use the terminate command to stop the entire script but I am not sure if it is firing or if that would even stop the audio.

If someone could look at this and help me out would be much appreciated.

thanks.

Share this post


Link to post
Share on other sites

personally I would make a parameter out of it.

in Description.ext:

class Params
{
class PLAYINTO
{
	title = "Play Into";
	values[] = {0,1};
	texts[] = {"No","Yes"};
	default = 1;
};
}

then in init.sqf:

//Saves all params into vars with the same name.
for "_i" from (0) to ((count paramsArray) - 1) do
{
missionNamespace setVariable [configName ((missionConfigFile/"Params") select _i),paramsArray select _i];
};

And then do a if loop where you call the intro:

if(PLAYINTO == 1) then
{
 //play into
};

---------- Post added at 12:04 ---------- Previous post was at 11:51 ----------

Alternativly you could assign a key for the skip action. This is a bit more advanced tho.

35 is a keycode (for the key H: http://community.bistudio.com/wiki/DIK_KeyCodes). You will need to convert those hex codes into decimal (atleast when I tested it the hex values didn't work for me).

http://www.statman.info/conversions/hexadecimal.html.

init.sqf (I did not test this).

//Waits till the main display is initialized.
waitUntil {!(isNull (findDisplay 46))};

INTRO_SKIP_HANDLER = (finddisplay 46) displayAddEventHandler ["keydown", "
  if ((_this select 1) == 35) then {
       terminate INTRO_HANLDE;
       (finddisplay 46) displayRemoveEventHandler [""keydown"", INTRO_SKIP_HANDLER];
  };
"];

INTRO_HANLDE = ["test.ogv", true] spawn BIS_fnc_titlecard;

Edited by mindstorm

Share this post


Link to post
Share on other sites
personally I would make a parameter out of it.

in Description.ext:

class Params
{
class PLAYINTO
{
	title = "Play Into";
	values[] = {0,1};
	texts[] = {"No","Yes"};
	default = 1;
};
}

then in init.sqf:

//Saves all params into vars with the same name.
for "_i" from (0) to ((count paramsArray) - 1) do
{
missionNamespace setVariable [configName ((missionConfigFile/"Params") select _i),paramsArray select _i];
};

And then do a if loop where you call the intro:

if(PLAYINTO == 1) then
{
 //play into
};

---------- Post added at 12:04 ---------- Previous post was at 11:51 ----------

Alternativly you could assign a key for the skip action. This is a bit more advanced tho.

35 is a keycode (for the key H: http://community.bistudio.com/wiki/DIK_KeyCodes). You will need to convert those hex codes into decimal (atleast when I tested it the hex values didn't work for me).

http://www.statman.info/conversions/hexadecimal.html.

init.sqf (I did not test this).

//Waits till the main display is initialized.
waitUntil {!(isNull (findDisplay 46))};

INTRO_SKIP_HANDLER = (finddisplay 46) displayAddEventHandler ["keydown", "
  if ((_this select 1) == 35) then {
       terminate INTRO_HANLDE;
       (finddisplay 46) displayRemoveEventHandler ["keydown", INTRO_SKIP_HANDLER];
  };
"];

INTRO_HANLDE = ["test.ogv", true] spawn BIS_fnc_titlecard;

Interesting. I will check these out and report back.

Thank you.

Share this post


Link to post
Share on other sites

fixed a type in my post

(finddisplay 46) displayRemoveEventHandler [""keydown"", INTRO_SKIP_HANDLER];

"keydown" was with single double quotes but it needed double double quotes because it's in a string.

Share this post


Link to post
Share on other sites

any update on this did these work for the player to skip the intro i am looking into a similar situation i am in i would rather have the user to skip rather than the server admin turn it off

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  

×