TedHo 53 Posted November 8, 2014 ArmA 3 UnitCapture/UnitPlay functions for Infantry Units I was frustrated with the fact that the BIS unitCapture/unitPlay functions do not work well with infantry units. They would simply slide across the ground without any animation. I decided to make an improved version that also records and plays back infantry animations along with movements and weapon firing. HLF_fnc_infUnitCapture and HLF_fnc_infUnitPlay allows infantry movement, firing and animation data to be captured and replayed on a player or AI infantry unit. Instructions 1. Capture data To capture player movement, call function "HLF_fnc_infUnitCapture". (If you are using it in your own mission, make sure to define the function in your "description.ext"). Function parameters: Unit - Unit to capture movement data from Duration - Duration to capture for OPT:FPS - OPTIONAL: Frames recorded Per Second (default 20). Limit is 1 - 100 OPT:Firing - OPTIONAL: If true, will record the input unit's weapon fire data as well OPT:StartTime - OPTIONAL: Starting time offset for the frame time Example: [player, 60, 20, true, 2] spawn HLF_fnc_infUnitCapture; Once recording starts, you can move, change stances, fire weapons, etc... Hit "ESC" to stop recording. Then hit "F1/F2/F3" to copy infantry unit movement, firing and animation data to clipboard. 2. Save data Save the movement/firing/anim data to three separate variables in an .sqf file. For an example, refer to "captureData.sqf" in the example mission. 3. Playback To preload the captured data, add the following line to your mission "init.sqf" (assuming you stored your captured data in "captureData.sqf"): call compile preprocessFile "captureData.sqf"; To make a unit called "joe" play back your recorded movements/firing/animations, run the following code. {joe disableAI _x;} forEach ["ANIM","MOVE","FSM","TARGET","AUTOTARGET"]; [joe, HLF_moveData] spawn BIS_fnc_UnitPlay; [joe, HLF_fireData, true] spawn HLF_fnc_infUnitPlayFiring; [joe, HLF_animData, true] spawn HLF_fnc_infUnitPlayAnim; Example mission To see an example of the playback effects, run the example mission in mission editor and execute: [joe] execVM "play.sqf"; The AI named joe should repeat what I did and recorded in "captureData.sqf". Known Issues 1. Due to issues with the A3 engine, when playback is forced on an AI instead of a player, animations can appear laggy when BIS_fnc_UnitPlay and HLF_fnc_infUnitPlayAnim are run simultaneously. 2. Infantry actions that do not trigger an animation state change (e.g. Weapon switching, reloading, leaning, head movements...) do not get recorded. (Will fix these in the future). 3. Initial animation not recorded. Will fix in the future. If you find more issues/glitches or features you wish to be included in future versions, feel free to leave a comment. Update Log v0.1 - Initial release. Allows for infantry unit movement/animation/firing events to be recorded and replayed. Download Link MEGA 3 Share this post Link to post Share on other sites
IndeedPete 1038 Posted November 8, 2014 Now that looks brilliant! Had the idea to create a script like that as well. I'm glad you made this one. Are there plans to expand it on ground vehicles in the (far) future? Share this post Link to post Share on other sites
TedHo 53 Posted November 9, 2014 Thanks, IndeedPete. I'm a bit unfamiliar with animating vehicle parts (wheels, engine, dirt trails...). But I might do ground vehicles in the future if I ever figure out an easy way to do that. 1 Share this post Link to post Share on other sites
iceman77 18 Posted November 9, 2014 Wow I overlooked this. The title was a bit mis-leading to me because every time I glanced I thought it was a help thread regarding BI unitCapture & unitPlay functions.. Looks really neat in any case. Cheers. Share this post Link to post Share on other sites
Guest Posted November 9, 2014 Thanks for sending us the release yesterday :cool: Release frontpaged on the Armaholic homepage. ArmA 3 UnitCapture/UnitPlay functions for Infantry Units v0.1 ================================================ We have also "connected" these pages to your account on Armaholic. This means soon you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have. When you have any questions already feel free to PM or email me! Share this post Link to post Share on other sites
TedHo 53 Posted November 10, 2014 Hey Iceman77, thanks for the comment! I had imagined the thread title would be misleading but I couldn't really think of a proper title... Anyway I'm glad you find this interesting. It's nowhere near complete right now, and I'll be making improvements along the way. Thanks. ---------- Post added at 21:35 ---------- Previous post was at 21:34 ---------- Hi Foxhound! Thanks for posting the armaholic page! Much appreciated! :) Share this post Link to post Share on other sites
seth0351 11 Posted February 12, 2015 This works awesome for the most part, thanks for your effort. There is a slight issue I have been having, I dont know if its on my part or not, but the AI wont aim up when the script is running, they always are looking to the horizon. Is this on my side or script side? Share this post Link to post Share on other sites
TedHo 53 Posted February 14, 2015 There is a slight issue I have been having, I dont know if its on my part or not, but the AI wont aim up when the script is running, they always are looking to the horizon. Is this on my side or script side? No the script does not record/playback where a unit is looking/aiming. To my knowledge there isn't any simple way to record aiming/head movement in Arma 3. Not unless BIS comes up with cripting commands like "getHeadDir/setHeadDir" and "getWeaponDir/setWeaponDir". Anyway if you need the AI to aim at something try using doTarget. Share this post Link to post Share on other sites
Amit 17 Posted November 28, 2015 I have used the author's test mission to play back his sample data to make sure it works and it works great. The problem is that when I record my own data and replace the original with mine, the AI does nothing. Anyone have any idea what's going wrong? EDIT: The problem was that the instructions did not say to add semi colons to the end of the data set after copying and pasting it. After adding them, the character moved as expected. Share this post Link to post Share on other sites
Erwin23p 34 Posted July 21, 2016 Hello, I was wondering how to make and use different records or paths? in different units. Thanks a lot. Share this post Link to post Share on other sites
Gooch159 1 Posted July 21, 2016 Can anyone confirm whether or not this still works? Seems broken to me. Share this post Link to post Share on other sites
lexx 1363 Posted July 21, 2016 Just tried it. Seems to work partly- running animation is wonky as hell. Rotating works, shooting too, changing animations when not moving around does seem to work as well. If the walking doesn't really work, then it's not that useful, imo. Share this post Link to post Share on other sites
Erwin23p 34 Posted July 23, 2016 but how to run 2 or more path? just like with unit capture... I know with just movement of helicopter for example, I can record multiple paths and run them at the same time. Share this post Link to post Share on other sites
RagingGamer 3 Posted February 7, 2017 (edited) Edit: The ai won't shoot their weapon (RHS RPG7) even tho it's recorded. But it will shoot it's primary weapon (CUP AK-47). Everything else functions properly, it just won't shoot the RPG The target in question is a Blackhawk, with the code this setCaptive true; so that other enemy AI won't shoot at it before it gets to a trigger. Would that make a difference? Because I don't know how else to make AI ignore it. Edit2 Apparently RHS doesn't work well with this... for whatever reason. That, or adding this setCaptive false; to the on deactivation tab in the trigger fixed it. Edited February 7, 2017 by RagingGamer 1 Share this post Link to post Share on other sites
TMG_On_YT 2 Posted November 23, 2017 Spoiler recording shooting doesnt work Share this post Link to post Share on other sites
Rich_R 1087 Posted December 27, 2017 Just started using this script and I hope the more seasoned users can answer my problem. Following the direction in the first post and other tutorials I can get the character to move, however them seem to have the jitters, most notable when in a crouch. Here's a video of what's happening. Any help would be appreciated! Share this post Link to post Share on other sites
Bolitho3rdID 9 Posted January 7, 2018 Hey, whenever I try to follow this tutorial and go to record, the Movement is tracked fine however the Anim and Firing comes up blank, or just one line, any solutions? Mission : https://drive.google.com/drive/folders/14OL8UbEm91K1DuFUCxrJ7kW8gINczH2D?usp=sharing The mission does use RHS Models,However I also tried with just the vanilla game,same issue. Share this post Link to post Share on other sites
Rich_R 1087 Posted January 7, 2018 Sorry I haven't replied to your PM and thanks for the tips with my issue. I wanted to try them before replying as well as helping with your issue, but I've been away from my PC for a few days. Try this tutorial, its the one I followed and seems to work/fix your issue. Good luck! Share this post Link to post Share on other sites
Bolitho3rdID 9 Posted January 7, 2018 12 hours ago, Rich_R said: Sorry I haven't replied to your PM and thanks for the tips with my issue. I wanted to try them before replying as well as helping with your issue, but I've been away from my PC for a few days. Try this tutorial, its the one I followed and seems to work/fix your issue. Good luck! Hey thanks man, Personally I tried this already and I am still getting they issue where It only records the Movement and the first part of the Animation, and I'm struggling to see where the script has gone wrong. Share this post Link to post Share on other sites
Rich_R 1087 Posted January 7, 2018 That's strange. Its works perfectly for me. My current versions are loaded with a bunch of mods, but I'll try your solution to fix my issue with just vanilla. If it works I'll send you the mission file via DM. That'll happen sometime this week. Share this post Link to post Share on other sites
Bolitho3rdID 9 Posted January 7, 2018 50 minutes ago, Rich_R said: That's strange. Its works perfectly for me. My current versions are loaded with a bunch of mods, but I'll try your solution to fix my issue with just vanilla. If it works I'll send you the mission file via DM. That'll happen sometime this week. Oh okay thanks man, Ill keep trying, what mods did you have loaded I probably already use/have the mods/ Share this post Link to post Share on other sites
Rich_R 1087 Posted January 7, 2018 Just now, Chris Along said: Oh okay thanks man, Ill keep trying, what mods did you have loaded I probably already use/have the mods/ A bunch of personal stuff....retextures for a (possible) new group. 1 Share this post Link to post Share on other sites
Bolitho3rdID 9 Posted January 7, 2018 4 minutes ago, Rich_R said: A bunch of personal stuff....retextures for a (possible) new group. Ahh okay. :) Share this post Link to post Share on other sites
froggyluv 2136 Posted January 7, 2018 @0:38 of that video you see a bullet hole and blood appear at an exact location -how was that done!? Share this post Link to post Share on other sites
johnnyboy 3795 Posted January 7, 2018 2 hours ago, Rich_R said: That's strange. Its works perfectly for me. My current versions are loaded with a bunch of mods, but I'll try your solution to fix my issue with just vanilla. If it works I'll send you the mission file via DM. That'll happen sometime this week. @Rich_R, are you saying that replay of animations and firing is working for you? 1 hour ago, froggyluv said: @0:38 of that video you see a bullet hole and blood appear at an exact location -how was that done!? Good eye. I'd like to know that too. Share this post Link to post Share on other sites