OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: ZapBrannigan on 01 Oct 2011, 17:54:35

Title: build up of Queued animations
Post by: ZapBrannigan on 01 Oct 2011, 17:54:35
Hello,
I have a scene where i need to loop the sprinting animation every .3 seconds.  it needs to be every .3 seconds for what im doing to work.  The problem is that the running animation takes longer than .3 seconds to complete.  So as the scene is progressing im accumulating a lot of queued sprinting animations. and when the scene is finished and i want him to stop. He keeps playing the animation a few hundred times before he finally stops.   How can i cancel all the queued animations or otherwise make him stop.

thanks 
Title: Re: build up of Queued animations
Post by: bedges on 01 Oct 2011, 21:06:54
loon switchmove (http://www.ofpec.com/COMREF/index.php?action=details&id=363&game=All) ""
Title: Re: build up of Queued animations
Post by: ZapBrannigan on 02 Oct 2011, 04:03:50
I tried it, it doesn't work :/
Title: Re: build up of Queued animations
Post by: bedges on 02 Oct 2011, 12:04:16
The alternative would be to have the sprinting animation controlled by a separate script which doesn't loop every .3 seconds but loops for the length of the sprinting animation. You control when the running animation script stops by setting a global variable.

Or you could deletevehicle the running guy and recreate him with all the properties of the old version, except standing still.
Title: Re: build up of Queued animations
Post by: ZapBrannigan on 02 Oct 2011, 13:03:01
oh perfect both of those work. Nice work bedges.

thanks
Title: Re: build up of Queued animations
Post by: johnnyboy on 12 Oct 2011, 19:47:19
Hi zap,

Could you post an example of your working anim loop please?  Thanks.
Title: Re: build up of Queued animations
Post by: ZapBrannigan on 13 Oct 2011, 02:14:08
Code: [Select]
_unit = _this select 0
_tgt = _this select 1
#loop
? (_unit distance _tgt)<5: exit


? (((GetPos _Tgt select 1) - (GetPos _Unit select 1)) > 0): _Ang = ATan (((GetPos _Tgt select 0) - (GetPos _Unit select 0)) / ((GetPos _Tgt select 1) - (GetPos _Unit select 1)))
? (((GetPos _Tgt select 1) - (GetPos _Unit select 1)) < 0): _Ang = ATan (((GetPos _Tgt select 0) - (GetPos _Unit select 0)) / ((GetPos _Tgt select 1) - (GetPos _Unit select 1))) + 180
? _Ang < 0: _Ang = _Ang + 360

_unit setdir _ang
_unit playmove "AmovPercMevaSrasWrflDf"

~.5
goto "loop"
Title: Re: build up of Queued animations
Post by: johnnyboy on 13 Oct 2011, 02:40:30
Thanks Zap.  I've been thinking about such a script to get a unit to move to a precise location.