OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bootneckofficer on 02 May 2005, 22:43:28

Title: switchmove repeat
Post by: bootneckofficer on 02 May 2005, 22:43:28
how do i get a bloke to repeat a switchmove action in a building until he hears an enemy behind him?

bootneckofficer
Title: Re:switchmove repeat
Post by: Blanco on 03 May 2005, 00:25:26
Put the unt in safe behaviour, run a script with loop to repeat the animations and check his behaviour. When it changes to combat or aware stop the loop.  

Quick try & not tested:

Code: [Select]
_unit = _this select 0
_animtime = <duration the animation>

#start
_i = 0
#animloop
?behaviour _unit != SAFE : goto "end"
_unit switchmove "blablabla"
~1
_i = _i + 1
_i < _animtime : goto "start"

 #end
; to make sure he draws his weapon
_unit setbehaviour "AWARE"
_unit action ["WEAPONINHAND"]
exit
Title: Re:switchmove repeat
Post by: MOC_XIII on 05 May 2005, 21:21:41
Or use UnPBO and in the config, where it says "looped" put 1.
Quote
class DAANIM: Combat
      {
      file="\ANIMS\DAANIM.rtm";
      speed=-0.4;
      looped=1;
      equivalentTo="Combat";
interpolateTo[]={"CombatDying",0.100000,"CombatDyingVer2",0.100000,"CombatDyingVer3",0.100000};
the use makepbo and put it back into a PBO file.
Now it is looped. ;D
Title: Re:switchmove repeat
Post by: Blanco on 05 May 2005, 23:02:56
Pretty drastic solution, no?
and not MP compatible...

Title: Re:switchmove repeat
Post by: Kyle Sarnik on 07 May 2005, 19:42:58
Blanco, your solution is sound, in theory, however I noticed that when an AI (or any unit) is put in to safe mode, and sees an enemy and takes their weapon off their back, the game still recognizes them to be in safe mode, and they will put their weapons back on their backs when everything is all clear. Maybe you should use knowsabout or a detected by trigger...
Title: Re:switchmove repeat
Post by: 999chris on 10 May 2005, 18:10:58
What you want to do is...

create a script file? "anim.sqs" e.g.

Put this in...

Code: [Select]
fin=false
#Loop
UnitName switchmove "ANIMATION"
~TIME
?fin: goto "End"
goto "loop"
#End
UnitName switchmove "Stand"
exit

Ok, replace UnitName with the name of the Unit, ANIMATION replae with the animation name... then TIME... You'll have to tes this but change the amount of time the animation takes until it ends...

Execute the script whenever you want your loon to animate [] exec "anim.sqs" and then when you want him to stop... fin=true...

Rock on, good luck.