buzcut1215 0 Posted August 27, 2020 Hey guys, got a question. I am a newbie at scripting, and I am trying to script a unit to preform an animation from the menu seen in game. So, for simplicity's sake, lets say its Unit 1 and unit 2. I have a script set up so unit 1 uses a death based script to make it look like he took a bullet. So after that script is complete I need unit 2 to make a signal to move up. Problem is, I do not know how to make unit 2's animation start upon the end of unit 1's animation. Can anyone direct me to the proper scripting line, if there is one, or how to make a timed wait for unit 2's animation. Thanks folks Share this post Link to post Share on other sites
Leopard20 813 Posted August 27, 2020 1 hour ago, buzcut1215 said: Hey guys, got a question. I am a newbie at scripting, and I am trying to script a unit to preform an animation from the menu seen in game. So, for simplicity's sake, lets say its Unit 1 and unit 2. I have a script set up so unit 1 uses a death based script to make it look like he took a bullet. So after that script is complete I need unit 2 to make a signal to move up. Problem is, I do not know how to make unit 2's animation start upon the end of unit 1's animation. Can anyone direct me to the proper scripting line, if there is one, or how to make a timed wait for unit 2's animation. Thanks folks One method is to use the "AnimDone" event handler: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#AnimDone For example (replace "MyAnim" with the name of the animation you want to play): _EH = _unit1 getVariable ["AnimDone_EH",-1]; if (_EH == -1) then { //you only need one event handler, so do not add if you have created one already _EH = _unit1 addEventHandler ["AnimDone", { params ["_unit1", "_anim"]; if (_anim == "MyAnim") then { //unit2 do something } }]; _unit1 setVariable ["AnimDone_EH",_EH]; }; _unit1 playMoveNow "MyAnim" The alternative approach is to use a scheduled script with "sleep": _unit1 playMoveNow "MyMove"; //Read animation duration from config //Animation duration is the inverse of animation speed (1/speed); if it's negative or zero, it's simply: (-1*speed) _moveTime = -1*getNumber(configFile >> "CfgMovesMaleSdr" >> "States" >> "MyMove" >> "Speed"); if (_moveTime < 0) then { _moveTime = -1/_moveTime; }; sleep _moveTime; //_unit2 do something 1 Share this post Link to post Share on other sites