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

Unable to loop animation?

Recommended Posts

Hey everyone,

I have been making a live base, and It has a lot of animations going. I have been using this script:

_unit = _this select 0;
_anim = _this select 1;

while{alive _unit}do{
_unit playMove _anim;
waitUntil{animationState _unit != _anim};
};

And calling it with:

0 = [this,"WhateverAnimationHere"] execVM "animLoop.sqf";

It has been working so far, but when I try some animations like:

LHD_midDeck

Where the guy is talking and looking to his right, it doesn't even want to play. I do it the traditional way (Make a trigger, add "this switchmove "animation", make a waypoint add "this switchmove "animation") and it works fine, but it doesn't loop. I tried this to see if it would loop:

animLoop = {_unit = _this select 0; _anim = _this select 1; while{alive _unit}do{_unit playMove _anim; waitUntil{animationState _unit != _anim}}}

And then put this in the waypoint and trigger:

0 = [this,"WhateverAnimationHere"] spawn animLoop

And it still doesn't play.

Any ideas?

Edited by Aodan

Share this post


Link to post
Share on other sites

I take some script errors if I run animLoop. It is missing 3 semicolons. Here is the corrected version, sorry the style is different, just easier for me :)

animLoop = 
{
_unit = _this select 0;
_anim = _this select 1;
while{alive _unit} do
{
	_unit playMove_anim;
	waitUntil {animationState _unit != _anim};
};
};

Anyway, it's the last 3 end braces.

Also if you're not doing it, you can pass -showScriptErrors in the command line with Arma when it loads.

Share this post


Link to post
Share on other sites

Thanks mate testing that out right now. Hoping that'll fix it, but I didn't change the script at all. I could run it fine with some of the other animations. maybe I changed something accidentally. Thanks a bunch!

---------- Post added at 09:23 PM ---------- Previous post was at 09:21 PM ----------

Oh and sorry I'm a bit of a newbie with the scripting but do I put

animLoop=

at the beginning or just whatever comes after?

Share this post


Link to post
Share on other sites

animLoop is fine the way you have it, that creates a function which you can call wherever.... if I'm understanding the question. You don't look like a newbie with those scripts :)

Share this post


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

×