Jump to content
  • 0

Adding sound to a dance script, need help


btakasper

Question

So basically im using this dance script that i found on open dayz that allows players to dance when they scroll on a firepit.  Everything works great but they didn't mention where you put your .ogg file for it play a short clip when activated. Below is the script for the dance.sqf file

private["_ent"];
_ent = _this select 3;
player removeAction s_player_dance;
s_player_dance = -1;

_danceMoves = ["ActsPercMstpSnonWnonDnon_DancingDuoStefan","ActsPercMstpSnonWnonDnon_DancingDuoIvan","ActsPercMstpSnonWnonDnon_DancingStefan"] call BIS_fnc_selectRandom;
player playMove _danceMoves;

_nul = [objNull, player, rSAY, "music"] call RE;
 
cutText ["You can dance if you want to!","PLAIN DOWN"];

r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
_finished = false;

    while {r_doLoop} do {
        _animState = animationState player;
        _isDancing = [_danceMoves,_animState] call fnc_inString;
        if (_isDancing) then {
            _started = true;
        };
        if (_started and !_isDancing) then {
            r_doLoop = false;
            _finished = true;
        };
        if (r_interrupt) then {
            r_doLoop = false;
        };
        sleep 0.1;
    };
    r_doLoop = false;
 
if (_finished) then {
 
cutText ["WTF are you doing mate ?","PLAIN DOWN"];
 
} else {
r_interrupt = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
cutText ["Dance Cancelled! ;(","PLAIN DOWN"];
};

Below code is in fn_selfActions.sqf

// ---------------------------------------FIRE DANCE START------------------------------------
if (inflamed cursorTarget and _canDo) then {
        if (s_player_dance < 0) then {
        s_player_dance = player addAction ["Dance!","scripts\dance.sqf",cursorTarget, 0, false, true, "",""];
    };
} else {
    player removeAction s_player_dance;
    s_player_dance = -1;
};
// ---------------------------------------FIRE DANCE END------------------------------------

But when you're in game and start the dance a window pops up that says "cannot find file music" and you click ok but start dancing.  I'm not exactly sure where to put my little 15 second .ogg clip.  If someone wouldn't mind giving me a little info on where to put it that would be great.  I'm new to scripting but im not sure where or what to add that would tell the dance script that "music" is located, say in addons\music.ogg in the mpmissions pbo.

 

Thanks

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

well the dance.sqf and music.ogg file is in the scripts folder. 

 

they said this line

_nul = [objNull, player, rSAY, "music"] call RE;

 

is what calls the music file to play, should i change "music" to "scripts\music.ogg"

 

Not sure how to call the music file in the fn_selfActions.sqf.  I noticed other sound files are called from the description.ext but have no idea what to script, basically i just copy and paste and edit simple things like where the files are and such when a tutorial has them in different places.

 

thanks for the reply

Link to comment
Share on other sites

  • 0

I understand how to add this script and even add multiple options for dance (EG Dance Trance, Dance Metal etc) with each calling a seperate dance routine and music track..but I'm sure there is a more efficient way of doing this in a single script?

 

How do you add sub-menus to FN-Selfactions?

So choose dance - then get the options dance Metal etc?

I've tried to pull apart another script that has sub menus but it's not written in a way I can easily disect, it's just a wall of text and all my attempts have failed :(

Link to comment
Share on other sites

  • 0

I have done all of this but do not get the dance option in my scroll menu when looking at an enflamed fire. What am I doing wrong? I added the code in self actions to point to the dance script.. 

 

EDIT: I got the menu to come up and I start dancing. But no sound is played.. Also no error messages.

Link to comment
Share on other sites

  • 0

open up description.ext look for class CfgSounds if you dont have it add it layout is like so

 

class CfgSounds
{
    sounds[] =
    {
        carLock, siren, nitro, z_wzombie1, z_wzombie2, music
    };
    class carLock
    {
        name="carLock";
        sound[]={CfgSounds\carlock.ogg,0.9,1};
        titles[] = {};
    };
    class siren
    {
        name = "siren";
        sound[] = {CfgSounds\siren.ogg,0.5,1};
        titles[] = {};
    };
    class nitro  {
        name="nitro";
        sound[]={CfgSounds\nitro.ogg,0.9,1};
        titles[] = {};
    };

    class z_wzombie1 {
        name = "";
        sound[] = {"custom\walkamongstthedead\dayz_sfx\femalezombie_attack_04.ogg",0.3,1,40};
        titles[] = {0, ""};
    };
    class z_wzombie2 : z_wzombie1 {
        sound[] = {"custom\walkamongstthedead\dayz_sfx\femalezombie_spotted_01.ogg",0.3,1,40};
    };

     class music  {
        name="music";
        sound[]={scripts\music.ogg,0.9,1};
        titles[] = {};
    }; 
};

I know with the siren addon you add the action to fnselfactions and add the sound file to description.ext well all the addons you add the sound file to  description.ext try adding

 

     class music  {
        name="music";
        sound[]={scripts\music.ogg,0.9,1};
        titles[] = {};
    };

 

to your class CfgSounds

and music to this part

 

    sounds[] =
    {
        carLock, siren, nitro, z_wzombie1, z_wzombie2, music
    };

 

This action menu has all dance movements LINK:

Link to comment
Share on other sites

  • 0

I was looking at another topic on http://opendayz.net/threads/cctv.12808/ Look at post #10

Quote:{

If you want to add sound when the surveillance is activated just add this line at the bottom of the cctv/ init file...
"playSound "cctv"

And then add the below code to your description.ext

 

class CfgSounds
{
    sounds[] =
    {
    cctv
    };
    class cctv
    {
    name="cctv";
    sound[]={cctv.ogg,0.9,1};
    titles[] = {};
    };
};

///////////////////////////////

So try adding: "playSound "music"

at the bottom of your dance.sqf And add in description.ext

 

     class music  {
        name="music";
        sound[]={scripts\music.ogg,0.9,1};
        titles[] = {};
    };

 

to your class CfgSounds

and music to this part

 

    sounds[] =
    {
        carLock, siren, nitro, z_wzombie1, z_wzombie2, music
    };

 

///////////////////////////////////////

If that is how sound is added to the cctv mod then i would say this will work for your dance mod make sure sound[]={scripts\music.ogg this file path is correct music.ogg is in the scripts folder i hope this helps man

Link to comment
Share on other sites

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
  • Advertisement
  • Discord

×
×
  • Create New...