OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: stephen271276 on 13 Feb 2011, 19:10:30

Title: SOLVED How to make an animation loop?
Post by: stephen271276 on 13 Feb 2011, 19:10:30
Im putting an animation of a guard beating a civilian into my mission via a trigger using....
<<<<<civ switchMove "ActsPercMstpSnonWpstDnon_sceneBardak02"; guard1 switchMove "CtsDoktor_Vojak_uder1"; >>>>>
Now it works great but only happens once, but I want it to keep happening? How can I do this?
Ive tried repeatedly on trigger it doesnt work?
Title: Re: How to make an animation loop?
Post by: Zipper5 on 13 Feb 2011, 19:16:34
Code: [Select]
civAnim = true;
guard1Anim = true;

[] spawn {
while {civAnim} do {
civ switchMove "ActsPercMstpSnonWpstDnon_sceneBardak02";
waitUntil {(animationState civ != "ActsPercMstpSnonWpstDnon_sceneBardak02") && civAnim};
};
};

[] spawn {
while {guard1Anim} do {
guard1 switchMove "CtsDoktor_Vojak_uder1";
waitUntil {(animationState guard1 != "CtsDoktor_Vojak_uder1") && guard1Anim};
};
};
Put that in a SQF script and execute it in the mission. The unit named civ will loop the animation until civAnim is set to false, and the unit named guard1 will loop the animation until guard1Anim is set to false.
Title: Re: How to make an animation loop?
Post by: stephen271276 on 13 Feb 2011, 19:21:47
Cheers man Ill try it now.....
Works but how do I set them to false via a trigger ie <<<<<<!alive guard>>>>>>> condition in the trigger....
Basically Id want the anims to loop till the guard is killed
Title: Re: How to make an animation loop?
Post by: Zipper5 on 13 Feb 2011, 19:39:28
Ah, well, in that case, use this:
Code: [Select]
[] spawn {
while {alive civ && alive guard1} do {
civ switchMove "ActsPercMstpSnonWpstDnon_sceneBardak02";
waitUntil {(animationState civ != "ActsPercMstpSnonWpstDnon_sceneBardak02") && alive civ && alive guard1};
};
};

[] spawn {
while {alive guard1} do {
guard1 switchMove "CtsDoktor_Vojak_uder1";
waitUntil {(animationState guard1 != "CtsDoktor_Vojak_uder1") && alive guard1};
};
};

[] spawn {
waitUntil {!(alive guard1)};
civ switchMove "AmovPercMstpSnonWnonDnon";
guard1 switchMove "AmovPercMstpSlowWrflDnon";
};
That will make it so that when the guard is killed both units' animations will reset and the loop will stop.
Title: Re: How to make an animation loop?
Post by: stephen271276 on 13 Feb 2011, 20:02:36
Lifesaver, thanks pal
Title: Re: SOLVED How to make an animation loop?
Post by: COL. Alderman on 14 Jun 2013, 01:46:44
On This Same Note I Am Trying To Make A Script To Make My Realism Members Stand At Attention With Hands Behind Their Backs i Got the script working but it does not want to keep them in that position


while in game scroll and click Attention and the animation should play untill you scroll and click At ease

p1 switchMove "AmovPercMstpSnonWnonDnon_Ease";

for the Attention


p1 switchmove"AmovPercMstpSnonWnonDnon_Easeout"

for the At Ease