Jump to content
MacRae

Script To Loop Animations

Recommended Posts

Im Trying to loop an sitting animation because of the fact once the timer runs out the player stands up?

Im just wondering is there anyway to add an Initialization script for the script to repeat?

Share this post


Link to post
Share on other sites

In init line:

nul = this spawn {while{true} do {this switchMove "SomeAnimation"; sleep 2;};};

This will play "SomeAnimation" each 2 seconds.

Share this post


Link to post
Share on other sites

Thankyou SaMatra - But do i replace "SomeAnimation" with the name of my animation?

Share this post


Link to post
Share on other sites

Yes, of course. You can as well change 2 seconds to whatever you need so animation will be smooth.

Share this post


Link to post
Share on other sites

Could also do it like BIS did in one of their missions:

removeAllWeapons this; 
this setBehaviour "CARELESS"; 
0 = this spawn {
   waitUntil {time > 0}; 
   _this switchMove "InBaseMoves_HandsBehindBack2"; 
   while {alive _this} do {
       waitUntil {animationState _this != "InBaseMoves_HandsBehindBack2"}; 
       _this switchMove "InBaseMoves_HandsBehindBack2"}
   };

Edited by kylania
  • Thanks 1

Share this post


Link to post
Share on other sites

So Kylania, Do i put that into the Initialization ?

Share this post


Link to post
Share on other sites

When i pase that in it says:

Missing ;

Share this post


Link to post
Share on other sites

Thanks so much for your help, but that is not what im looking for sadly :/

Share this post


Link to post
Share on other sites

Could also do it like BIS did in one of their missions:

 

removeAllWeapons this; 
this setBehaviour "CARELESS"; 
0 = this spawn {
    waitUntil {time > 0}; 
    _this switchMove "InBaseMoves_HandsBehindBack2"; 
    while {alive _this} do {
        waitUntil {animationState _this != "InBaseMoves_HandsBehindBack2"}; 
        _this switchMove "InBaseMoves_HandsBehindBack2"}
    };

Sorry to resurrect an old post but how do I enable this animation to stop as soon as they hear/see people.

Share this post


Link to post
Share on other sites


removeAllWeapons this;

this setBehaviour "CARELESS";

0 = this spawn

{

waitUntil {time > 0};

_this switchMove "InBaseMoves_HandsBehindBack2";

while {alive _this} do

{

if (toLower (behaviour _this) == "careless") then

{

waitUntil {animationState _this != "InBaseMoves_HandsBehindBack2"};

_this switchMove "InBaseMoves_HandsBehindBack2";

}

else

{

_this switchMove "";

waitUntil { sleep 1; toLower (behaviour _this) == "careless"};

};

};

};

  • Like 1

Share this post


Link to post
Share on other sites
On 7/1/2013 at 7:39 AM, kylania said:

Could also do it like BIS did in one of their missions:

 


removeAllWeapons this; 
this setBehaviour "CARELESS"; 
0 = this spawn {
   waitUntil {time > 0}; 
   _this switchMove "InBaseMoves_HandsBehindBack2"; 
   while {alive _this} do {
       waitUntil {animationState _this != "InBaseMoves_HandsBehindBack2"}; 
       _this switchMove "InBaseMoves_HandsBehindBack2"}
   };
 

 

Hey there kylania. Apologies for dredging up an old post but I have a few questions regarding this cool little script. Would appreciate your input.
So I've got this in a trigger's onAct, all is good. 
Is it possible to add in the "In" and "out" parts of the animations while keeping them in the loop as is here?
And then secondly. By ticking the 'server only' checkbox in the trigger's options, is that enough to make it global and synced on a Dedi server? Or does something like (isMultiplayer && isDedicated) need to be slipped into the switchMove? 

Appreciate any help,
Cheers,
Ved

Share this post


Link to post
Share on other sites

Ho can I make this code "global" so that I can call the script with the execution function? 🙂
 

Cheers

Share this post


Link to post
Share on other sites

Hi @lucasvdb; welcome to the forums!

The effects of an animation command like switchMove are usually Global. That is, all players can see them. You see this marked at the top of the BIKI for every command. 

If you want to generalize the code so you can easily use it multiple times during a mission, you can make a Function out of it.  

  • Like 1

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

×