Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Jewpiter

Problem with animations

Recommended Posts

I am trying to make a script that will allow me to start dancing to a music and stop dancing whenever I would like (multiplayer compatible).

I made 2 scripts, one for the dancing action and another one which controls the "stop dancing" action

this is dance.sqf

_caller= _this select 1;
_id = _this select 2;
playmusic "song";
_caller removeAction _id;
_stopdance = _caller addaction ["Stop Dancing","stopdance.sqf"];
_caller setVariable ["dance",true];

_caller playmove "ActsPercMstpSnonWnonDnon_DancingDuoStefan";
_dance=_caller getvariable "dance";
for [{_x=1},{((_x<=42) and (_dance))},{_x=_x+1}] do 
{
sleep 1;
_dance=_caller getvariable "dance";
};
_dance=_caller getvariable "dance";
if (_dance) then {
_caller playmove "ActsPercMstpSnonWnonDnon_DancingDuoIvan";	
for [{_x=1},{((_x<=39) and (_dance))},{_x=_x+1}] do 
{
	sleep 1;
	_dance=_caller getvariable "dance";
};
};
_dance=_caller getvariable "dance";
if (_dance) then {
_caller playmove "ActsPercMstpSnonWnonDnon_DancingDuoIvan";	
for [{_x=1},{((_x<=39) and (_dance))},{_x=_x+1}] do 
{
	sleep 1;
	_dance=_caller getvariable "dance";
};
};
_dance=_caller getvariable "dance";
if (_dance) then {
_caller playmove "ActsPercMstpSnonWnonDnon_DancingDuoStefan";	
for [{_x=1},{((_x<=35) and (_dance))},{_x=_x+1}] do 
{
	sleep 1;
	_dance=_caller getvariable "dance";
};
};
_dance=_caller getvariable "dance";
if (_dance) then {
_caller playmove "ActsPercMstpSnonWnonDnon_DancingDuoIvan";	
for [{_x=1},{((_x<=30) and (_dance))},{_x=_x+1}] do 
{
	sleep 1;
	_dance=_caller getvariable "dance";
};
};

playmusic ["song",206];
_caller switchmove "";
try
{
_caller removeaction _stopdance;
};
_caller addaction ["Dance","dance.sqf"];

and this is stopdance.sqf:

_caller= _this select 1;
_id = _this select 2;
_caller setVariable ["dance",false];
_caller removeaction _id;

If I push the stop dancing action or the entire dancing ends the character should return to normal status (as in standing with weapon in hand)

I have tried using this code:

_caller switchmove "";

but whenever this code executes the character returns to normal status and a dancing animation is restarted (not the entire script,just the one animation which played right before the switchmove command)

this brings me to my question:

How can I stop the character performing an animation?

Edited by Jewpiter

Share this post


Link to post
Share on other sites

Hey,

i tried to resolve that thing, but it seems the command switchmove "" doesn't affect the playmove "ActsPercMstpSnonWnonDnon_DancingDuoIvan".

If somebody have the solution, can he write it here, i'm very interested too.

Share this post


Link to post
Share on other sites

This works for me:

g1 playMoveNow "AmovPercMstpSlowWrflDnon";

g1 would of course be _caller in your script. playMoveNow forces a playMove to execute immediately, and AmovPercMstpSlowWrflDnon is a basic standing in place move.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×