Dancing Script?

im having problems. what do i put in the dance file that i create? these?
_moveit = "player playMove ""ActsPercMstpSnonWnonDnon_DancingDuoIvan"";";
[_moveit] execVM "scr\exec.sqf";
 
Well i tried to put ^ in the Dance.sqf and it didnt work so then i put this in it
private["_ent"];
_ent = _this select 3;
player removeAction s_player_dance;
s_player_dance = -1;

player playMove "ActsPercMstpSnonWnonDnon_DancingStefan";

cutText ["Let the party begin!","PLAIN DOWN"];

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

while {r_doLoop} do {
_animState = animationState player;
_isDancing = ["ActsPercMstpSnonWnonDnon_DancingStefan",_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 ["Awesome performance mate!","PLAIN DOWN"];

} else {
r_interrupt = false;
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
cutText ["Dance Canceled! ;(","PLAIN DOWN"];
};

And it didnt work...
What am i doing wrong ya think?
 
I added a couple more animations which I have had working but am unsure if the code is write or there is a better way to write it. below is what am using in my selfactions.

Code:
//DANCE
if (inflamed cursorTarget and _canDo) then {
        if (s_player_dance < 0) then {
        s_player_dance = player addAction ["Dance!","Scripts\dance\dance.sqf",cursorTarget, 0, false, true, "",""];
        s_player_fight = player addAction ["Fight!","Scripts\dance\boxing.sqf",cursorTarget, 0, false, true, "",""];
        s_player_fight = player addAction ["Workout!","Scripts\dance\workout.sqf",cursorTarget, 0, false, true, "",""];
    };
} else {
    player removeAction s_player_dance;
    player removeAction s_player_fight;
    player removeAction s_player_workout;
    s_player_dance = -1;
    s_player_fight = -1;
    s_player_workout = -1;
};
 
I added a couple more animations which I have had working but am unsure if the code is write or there is a better way to write it. below is what am using in my selfactions.

Code:
//DANCE
if (inflamed cursorTarget and _canDo) then {
        if (s_player_dance < 0) then {
        s_player_dance = player addAction ["Dance!","Scripts\dance\dance.sqf",cursorTarget, 0, false, true, "",""];
        s_player_fight = player addAction ["Fight!","Scripts\dance\boxing.sqf",cursorTarget, 0, false, true, "",""];
        s_player_fight = player addAction ["Workout!","Scripts\dance\workout.sqf",cursorTarget, 0, false, true, "",""];
    };
} else {
    player removeAction s_player_dance;
    player removeAction s_player_fight;
    player removeAction s_player_workout;
    s_player_dance = -1;
    s_player_fight = -1;
    s_player_workout = -1;
};










did this work?
 
They work but The Player RemoveAction sometimes does not work. IE you look at the fire then walk away sometimes the player action is still in the scroll menu. This is could be due to the amount of different scripts I have running as I have seen this happen before with self bloodbag. I have edited the above to only have 2 dance moves which seems to solve the problem and have added music for the dance it self.
 
Bottom of self actions:
Code:
// ---------------------------------------FIRE DANCE START------------------------------------
if (inflamed cursorTarget and _canDo) then {
        if (s_player_dance < 0) then {
        s_player_dance = player addAction ["Dance!","Scripts\dance\dance.sqf",cursorTarget, 0, false, true, "",""];
        s_player_fight = player addAction["Fight!","Scripts\dance\boxing.sqf",cursorTarget, 0, false, true, "",""];
    };
} else {
    player removeAction s_player_dance;
    player removeAction s_player_fight;
    s_player_dance = -1;
    s_player_fight = -1;
};
// ---------------------------------------FIRE DANCE END------------------------------------

My dance.sqf with sound, without sound just delete _nul = [objNull, player, rSAY, "fox"] call RE;

Code:
private["_ent"];
_ent = _this select 3;
player removeAction s_player_dance;
s_player_dance = -1;
 
player playMove "ActsPercMstpSnonWnonDnon_DancingDuoIvan";
_nul = [objNull, player, rSAY, "fox"] call RE;
 
cutText ["What does the FOX SAY!","PLAIN DOWN"];
 
r_interrupt = false;
_animState = animationState player;
r_doLoop = true;
_started = false;
_finished = false;
 
    while {r_doLoop} do {
        _animState = animationState player;
        _isDancing = ["ActsPercMstpSnonWnonDnon_DancingDuoIvan",_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 Canceled! ;(","PLAIN DOWN"];
};
 
I made some changes to the dance script.
This version selects one of the three possible dance animations each time you click Dance ;)

Code:
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, "fox"] call RE;
 
cutText ["What does the FOX SAY!","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 Canceled! ;(","PLAIN DOWN"];
};
 
This script works great and everything but for adding music/sound to when players click dance how do I do this? I seen where WES said without sound remove _nul = [objNull, player, rSAY, "fox"] call RE;

So i'm assuming the "fox" is the sound file that's suppose to play, but where do i put this file with my custom sound and not sure what else I have to add for it to play that sound when they do start dancing.

Thanks
 
This worked flawlessly, thank you for outlining the 'how' part. I'm going to extend this into mission messages and a whole lot more now that I understand how it's done. Kudos to you guys for sharing!
 
Appreciate the info WES. When I implemented this into the code it would cause a Wait For Host screen with the RPT telling me that cfgsounds has already been defined. As i took a deeper look into my mission pbo i realized an addon I'm using already has a whole sounds.hpp file which defines the cfgsounds. So i edited that and added danceSong into it and location of the file and i had to delete your
_nul = [objNull, player, rSAY, "fox"] call RE; and added playSound "danceSong"; below cutText ["Show Me Your Moves!","PLAIN DOWN"];

So if anyone else is using the EVR Blowout storms on other maps and added this fun little script to it and wish to have a little song to play when players start to dance, that's how i did it. Edit the sounds.hpp and add your music .ogg file into the sounds folder.

Thanks for the help WES and everyone else that shared this information on this thread. I also have to thank someone on another forum who suggested using playSound. There's such a huge wealth of information on these forums that since starting my own server I've learned a lot. Thanks again
 
Ok, so I have a question.

This is working perfectly for me, using UrbanSkaters' version of the dance.sqf. I run an Epoch server and on it I have survivor parties that run as an Epoch event. At these parties, there's a camp fire with AI dancing. I based it on the survivor dance party script I found here at opendayz.net. When you approach the survivor party, there is music playing. I am using the same .ogg to play music as I use for this dance script.

My question is this: How can I prevent the music that this dance script uses from playing for a player at the survivor party when they select the Dance! option? I don't want the song to be playing at the party, then the player starts dancing and it's playing twice. Does that make sense? I hope so! :)
 
Use say or playSound locally, not via RE.

Wysłane z mojego Nexus 5

The player will still hear it twice, though. Maybe a trigger that prevents the music from playing when a player dances if the song is already playing at the survivor party and they are within distance of it?

Maybe you guys can help me with something else. I tried to make it so the song plays in a loop. I based it on the survivor party script:

Code:
if (!_isDancing} do {
    _nul = [objNull, player, rSAY, ['danceMusic',30]] call RE;
    sleep 30;
    };

Here's what it looks like inserted in the dance.sqf:

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

if (!_isDancing} do {
    _nul = [objNull, player, rSAY, ['danceMusic',30]] call RE;
    sleep 30;
    };

cutText ["What does the FOX SAY!","PLAIN DOWN"];

When I use this, it doesn't play the music at all. Any idea what I'm doing wrong?
 
Last edited:
use setVariable/getVariable on the FirePlace or whatever is calling the dance script and then check via an if/else statemt if the sound should be triggered once more.
 
I had this installed with 1.0.4.2 and just decided to try it with 1.0.5.1 and the music doesn't play. I know the music is set up correctly because it's set up the same as it was in 1.0.4.2. Any ideas?
 
Back
Top