Results 1 to 4 of 4

Thread: Unable to loop animation?

  1. #1

    Red face Not able to loop many animations

    Hey everyone,
    I have been making a live base, and It has a lot of animations going. I have been using this script:
    PHP Code:
    _unit _this select 0;
    _anim _this select 1;

    while{
    alive _unit}do{
        
    _unit playMove _anim;
        
    waitUntil{animationState _unit != _anim};
    }; 
    And calling it with:
    PHP Code:
    = [this,"WhateverAnimationHere"execVM "animLoop.sqf"
    It has been working so far, but when I try some animations like:
    PHP Code:
    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:
    PHP Code:
    animLoop = {_unit _this select 0_anim _this select 1; while{alive _unit}do{_unit playMove _animwaitUntil{animationState _unit != _anim}}} 
    And then put this in the waypoint and trigger:
    PHP Code:
    = [this,"WhateverAnimationHere"spawn animLoop 
    And it still doesn't play.
    Any ideas?
    Last edited by Aodan; Dec 16 2010 at 22:18.
    VFA 31 Tomcatters- we bomb what you can't.

  2. #2
    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

    Code:
    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.

  3. #3
    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
    PHP Code:
    animLoop
    at the beginning or just whatever comes after?

  4. #4
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •