Jump to content
Indiculous

[HOW TO] Adding Intro Music!

Recommended Posts

NOTICE: I do not take credit for these scripts im simply just sharing them with a tutorial!

 

Programs i use http://audacity.sourceforge.net/download/

 

Find a song you wish to use and drag and drop it into audacity.

 

Crop the song to around 30 seconds and then "File\export" export it as OGG

 

Name the OGG File introsong and put it in the root of your mission file (in the same place as your init.sqf)

 

 

Now on to the script!

 

1)Open your init.sqf

 

Around Line 88 look for 

//Run the player monitor

 

Just under that place this 

 _id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "playerspawn.sqf";}];

2)Make a sqf called playerspawn.sqf in the same place as your init.sqf

 

and inside that paste this into it

 

waitUntil { alive player };
//BlurGaming Intro Script
sleep 4;
playsound "introSong";
cutText ["servername here", "PLAIN DOWN"];
 
3)in your description.ext around line 43-55 you will see this 
class RscPicture
{
access=0;
type=0;
idc=-1;
style=48;
colorBackground[]={0,0,0,0};
colorText[]={1,1,1,1};
font="TahomaB";
sizeEx=0;
lineSpacing=0;
text="";
};
 
Under that paste this 
 
class CfgSounds
{
    sounds[] =
    {
    introSong
    };
    class introSong
    {
    name="introSong";
    sound[]={introSong.ogg,0.9,1};
    titles[] = {};
    };
};
 
 
Thats it your done!

Share this post


Link to post
Share on other sites

not worked.

 

Now on to the script!

 

1)Open your init.sqf

 

Around Line 88 look for 

//Run the player monitor

 

Just under that place this 

 _id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "playerspawn.sqf";}];

 

without add ... just
 

replace this

_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];

 

with this 

 _id = player addEventHandler ["Respawn", {_id = [] spawn player_death; _nul = [] execVM "playerspawn.sqf";}];

 

 

 

and you forgot about :

_nul = [] execVM "playerspawn.sqf";

Share this post


Link to post
Share on other sites

Sorry for bumping an older topic, but how can I activate the intro music once a 'not dead' player joins the game?

For this you only have to put

[] execVM "playerspawn.sqf";

in your init.sqf at the bottom and the //Playermonitor Line you setup back as it was:

_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];

Share this post


Link to post
Share on other sites

 

For this you only have to put

[] execVM "playerspawn.sqf";

in your init.sqf at the bottom and the //Playermonitor Line you setup back as it was:

_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];

 

Aight, thanks!

Share this post


Link to post
Share on other sites
class CfgSounds
{
    sounds[] =
    {
		carLock;
		introSong
    };
    class carLock
    {
		name="carLock";
		sound[]={sounds\carlock.ogg,0.9,1};
		titles[] = {};
    };
	class introSong
	{
    name="introSong";
    sound[]={introSong.ogg,0.9,1};
    titles[] = {};
    };
}; 

please repair

Share this post


Link to post
Share on other sites

All working great however the song and credits play every time someone logs in not just after a player dies and respawns

 

Anyway to change this ?

 

Same here, i wish for it to only play when player dies and Re-spawns or Fresh Spawn

 

also is there by chance a way to put the .ogg server side so people dont have to download a bigger mission, already changed 1mb to 200kb .ogg but thought i ask

Share this post


Link to post
Share on other sites

In your init.sqf

 

Delete :

_nul = [] execVM "playerspawn.sqf";

at the bottom add this

waitUntil {!isNil "PVDZE_plr_LoginRecord"};
if (!isDedicated && (dayzPlayerLogin2 select 2)) then {
    if (dayzPlayerLogin2 select 2) then {execVM "playerspawn.sqf";};
};

This will make sure that the song only plays if he is a fresh spawn

Share this post


Link to post
Share on other sites
 

 

class CfgSounds
{
sounds[] =
{
        carLock;
        introSong
};
class carLock
{
        name="carLock";
        sound[]={sounds\carlock.ogg,0.9,1};
        titles[] = {};
};
    class introSong
    {
name="introSong";
sound[]={introSong.ogg,0.9,1};
titles[] = {};
};
}; 

 

please repair

 

I have the same error with this information:

http://screenshooter.net/101974150/mwteghw

The code above doesn't work. Somebody help ? :P

 

If you need... There is my description.ext

http://pastebin.com/qyhgcVdt

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...