Jump to content
Sign in to follow this  
Krowkie

Animation script problems

Recommended Posts

Hi, I made a noobish script to make all my guys inside my base initiate the animations, this is the script:

{_x playMove "AmovPercMstpSnonWnonDnon_idle56kliky"} forEach 

[w1,w2,w3,w4,w5,w6,w7,w8,w9,10,w11,w12,w13,w14,w15,w16,w17,w18,w19,w20,w21,w22,w23,w24,w25]

;
{_x playMove "ActsPercSnonWnonDnon_carFixing2"} forEach [eng3,eng4];
{_x playMove "AinvPknlMstpSnonWrflDnon_medic1"} forEach [med1];
{_x playMove "AinvPknlMstpSnonWrflDr_medic5"} forEach [med2];
{_x playMove "sitUnarm_L_relaxing"} forEach [eng1];
{_x playMove "aidlpercmstpsraswrfldnon_idlesteady01n"} forEach [guard1,guard5,guard6];
{_x playMove "aidlpercmstpsraswrfldnon_idlesteady02n"} forEach [guard3,guard7];
{_x playMove "aidlpercmstpsraswrfldnon_idlesteady03n"} forEach [guard2,guard4,guard8];
{_x playMove "UnaErc_UnaErcPoslechVelitele"} forEach [eng2];

then I put execVM "USanimations.sqf" in my init.sqf, can anyone help me?

Edited by Krowkie

Share this post


Link to post
Share on other sites

At the top of the script, try waitUntil {time > 0} or add a small sleep. Not sure if it helps.

If you get an error message due to the waitUntil, you may have to spawn the contents as well (unsure).

I.e.

[] spawn {

waitUntil {time > 0};

...contents of the script...

};

Edited by CarlGustaffa

Share this post


Link to post
Share on other sites
At the top of the script, try waitUntil {time > 0} or add a small sleep. Not sure if it helps.

If you get an error message due to the waitUntil, you may have to spawn the contents as well (unsure).

I.e.

[] spawn {

waitUntil {time > 0};

...contents of the script...

};

waitUntil dind't seem to help, it's strange though. It says: error playmove, type number expected object

but sometimes w1 up to w9 do the animation and nobody else does anything...

Share this post


Link to post
Share on other sites

w10 in your array just says '10', probably why the first 1 to 9 work.

Share this post


Link to post
Share on other sites
w10 in your array just says '10', probably why the first 1 to 9 work.

Thanks! Never saw it.

Share this post


Link to post
Share on other sites

Why do you even assign a global variable to all of these units. Considering that they most likely are in one group anyway, you could replace that monster array with something like:

{
  ...
} forEach (units trainingGroup);

... assuming that you "named" that group "trainingGroup" (or whatever). You might consider to write a little function for this, passing the group to the function, so you could reuse that thing at some later point.

Sure, maybe you'd like to have some units, for example the leader, just standing still:

{
  ...
} forEach (_this - [(leader _this)]);

... assuming that _this referes to some group passed to your function. Or you might wanna filter out higher ranks, or do something different based on the units rank, which would allow to easily set this up in the editor in a more meaningful way.

Then simply call this function from the init-line of the groups leader:

_nul = (group this) call TAG_groupExercice;

At least for "bulk"-animations, I'd consider such a solution (in there you could also position the single units in some nice manner per scripting, so you wouldn't need to care much in the editor).

You could also easily randomize the single animations, by either selecting at random from an array or by a switch on a random number.

Just in case... :D

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  

×