OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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
-
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:
_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
-
Or use UnPBO and in the config, where it says "looped" put 1.
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
-
Pretty drastic solution, no?
and not MP compatible...
-
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...
-
What you want to do is...
create a script file? "anim.sqs" e.g.
Put this in...
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.