武装突袭3

武装突袭3

46 个评价
TT Scripted Movement Functions
   
奖励
收藏
已收藏
取消收藏
Data Type: Mod
Mod Type: Mechanics
文件大小
发表于
更新日期
509.331 KB
6 月 30 日 上午 12:16
8 月 13 日 上午 9:20
9 项改动说明 ( 查看 )

订阅以下载
TT Scripted Movement Functions

描述
Tired of Arma 3 AI running around unpredictably? This mod fixes that!



Overview
Are you tired of AI running around unpredictably when creating scenarios in Arma 3? This mod is here to fix that problem!

Currently, the main way to ensure AI in Arma 3 reaches a designated location is by setting their behavior to “Never fire” and “Safe.” However, this causes the AI to do nothing when encountering enemies, which can severely impact the player's experience. Even with these settings, Arma 3’s pathfinding issues often cause AI to wander off, disrupting the flow of the mission.
Of course, there are many other drawbacks — something scenario creators are all too familiar with.

This mod moves units using scripted displacement combined with animations to ensure that AI follow a designated path without wandering off.
While this method still prevents infantry from returning fire during movement, it works perfectly for vehicles — since the vehicle follows the set path, but all turrets remain fully operable for AI to aim and shoot.

It’s also highly useful for close air support: the animation can guide aircraft along a precise route and drop specific bombs at designated locations.

In short, this is an essential mod for anyone looking to create Call of Duty-style linear missions in Arma 3.




How to Use

This mod includes two types of functions:

1. Record and Play Back Animations
This method is perfect for crafting natural-looking animations for units close to the player. It allows detailed and immersive movement and firing sequences. However, recording for each unit individually can be time-consuming if many AIs are involved.

2. Direct Path-Based Animations
This method skips the recording process. Just set the path and the unit will animate along it — just like placing waypoints in Eden Editor.
Note: This method only works with infantry.




1. Record and Replay Animations

To start recording, use:
unit1 spawn TT_fnc_startCapture;

unit1 can be infantry or a vehicle. (The object corresponding to unit1 must have a global variable name. otherwise, the function won't work properly.)

Control the unit to perform actions — the system will record movement, animations, and weapon fire.

To stop recording, press Esc (or the function stops automatically if the unit dies).

After recording ends, the screen will instruct you to press:

F1: all the code required to play the animation will be copied to your clipboard at once.

This will make the unit exactly repeat the recorded behavior.




2. Simple Path-Based Animation

recording each animation individually can be time-consuming when many AI units are involved. To solve this, the second type of function allows you to skip the recording step. Instead, you simply define a path, and the unit will move along it using animations. This method is as convenient as placing waypoints in 3den, but it only works for infantry — vehicles are not supported with this method.

Example usage:

[] spawn { _handle = [ man1, [waypoint_1, waypoint_2, waypoint_3] ] spawn TT_fnc_scripted_stand_Run_rifle; waitUntil { isNull _handle}; hint str "The script move has completed."; };

man1: the infantry unit (vehicles not supported)

[waypoint_1, waypoint_2, waypoint_3]: objects acting as waypoints; the unit will move along them in order

The function name determines the animation — in this case, the soldier runs while standing and holding a rifle.

Available Animation Types

Crouch:

TT_fnc_scripted_crouch_Run_pistol

TT_fnc_scripted_crouch_Run_rifle

Prone:

TT_fnc_scripted_prone_Run_pistol

TT_fnc_scripted_prone_Run_rifle

Standing (Fast Run):

TT_fnc_scripted_stand_fastRun_pistol

TT_fnc_scripted_stand_fastRun_rifle

Standing (Normal Run):

TT_fnc_scripted_stand_Run_pistol

TT_fnc_scripted_stand_Run_rifle

More animations will be added in future updates!




⚠ Important Note
At the moment, there is a critical limitation — you cannot save the game while a unit is executing a recorded animation.
If you load a save that was made during animation playback, the unit will appear stuck in place and will not resume the animation. [color=red]Avoid saving the mission during playback to prevent this issue.[/color]

👤 Human Units

All human animation playback functions in this mod will automatically execute the following two commands after finishing:

_man disableAI "PATH"; _man setUnitPos "UP";

This prevents the unit from wandering after the animation.

If you want the unit to resume native AI behavior, restore it manually with:

_man enableAI "PATH"; _man setUnitPos "AUTO";


🚗 Ground Vehicles and Boats

All ground vehicles and boats will automatically have the following applied to their driver during animation playback:

driver _vehicle disableAI "ALL"; driver _vehicle enableSimulation false;

This ensures that the vehicle follows the exact animation path without interruption.

To restore the vehicle driver's AI after the animation ends, use:

driver _vehicle enableAI "ALL"; driver _vehicle enableSimulation true;



Conclusion
In summary, the main reason I created this mod is because I was fed up with Arma 3's native AI constantly running off and ruining mission flow.

If you want to see what fully scripted unit movement looks like in action, check out my Workshop missions — all unit movements in those scenarios are controlled purely by script.

Here are some tips for mission makers:

Make sure all units that directly affect mission objectives are controlled by scripted movement. This guarantees they won’t wander off or behave unpredictably, ensuring the mission progresses smoothly.

That said, you can still add regular AI units to increase difficulty and enhance battlefield atmosphere. Just be sure that whether those AIs live, die, or run off somewhere, it has no impact on the mission objectives.

This balance gives you both a stable mission structure and the dynamic chaos of a real battle.

Issue and Solution:

1. While recording tanks and other vehicles in the East Asia War, 1937 - 日中戦争 - 抗日战争 MOD, I noticed that the tracks would only rotate for the first few seconds and then stop. After analysis, I believe this may be an AI-related issue specific to that MOD, as it does not occur in the vanilla game or other MODs.The solution is to move the tank by rapidly tapping the “W” key continuously, rather than holding it down, when recording its movement. This way, the recorded data will avoid this issue.

Changelog for v1.4 version

In the latest version, it's now possible to record turret rotation animations for vehicles with turrets, including the elevation and depression of the gun barrel. Note: By default, only the animation of the primary weapon turret will be recorded.You can use currentWeapon _vehicle to detect which turret is the primary weapon turret.

However, the pitch (up and down) movement of a soldier's weapon still cannot be recorded. If anyone knows how to record this, feel free to share it in the comments.
24 条留言
TT  [作者] 10 月 13 日 上午 11:53 
@VIKINGbeast557

That shouldn’t be the case. Please record a video for me so I can reproduce the issue.
VIKINGbeast557 10 月 5 日 下午 9:03 
Loving the mod. The only issue im having right now is getting the vehicles to do anything again after the recording ends. i tried copying the enable ai scripts as you posted and running it on a trigger, and in the debug, and right in the unit init. no combination of enabling ai and pathing allows them to move once the recording is finished. thanks for any help!
TT  [作者] 10 月 2 日 上午 12:37 
@@Ivan Dupilon / Sèche Chevaux

However, if there is a large amount of recorded data, I recommend placing it into an SQF file and then using execVM within the trigger to execute that file.
TT  [作者] 10 月 2 日 上午 12:35 
@Ivan Dupilon / Sèche Chevaux

By definition, a trigger continuously loops to check whether the specified condition has been met. If so, it executes the designated code. You only need to place the recorded data in the code section that the trigger will execute.
Ivan Dupilon / Sèche Chevaux 10 月 1 日 下午 1:27 
great mode TT
how to use it with triggers ? like if i run most of the eden editor scenario with basic waypoints how to use this mode without using the debug console but using it with triggers ?
Hoss 9 月 4 日 下午 9:13 
I'm not sure if maybe I missed something in your video or the instructions but I'm having an issue.

When I put a unit in a record the actions and I do something like a full auto mag dump, the unit when I play it back doesn't do it. Is there something I missed? I want to use this mod for cinematic/machinima stuff and it would make life much easier. It's really awesome btw!
TT  [作者] 8 月 25 日 上午 11:28 
@Barkas47

I don't understand what you mean. Please explain the error you ran into in more detail.
Barkas47 8 月 20 日 上午 2:48 
@TT

oh it's super that the tanks and other vehicles will move their turrets and cannons, and the soldiers will continue to do so, but the cutscene will not be large enough. However, when you copy and paste into a text document, something happens, and when you paste everything that was copied, an error occurs, and you have to delete everything and start over. Even restarting the game does not solve the problem.
TT  [作者] 7 月 30 日 上午 6:02 
@Barkas47

In the latest version, it's now possible to record turret rotation animations for vehicles with turrets, including the elevation and depression of the gun barrel. However, the pitch (up and down) movement of a soldier's weapon still cannot be recorded.
TT  [作者] 7 月 29 日 上午 6:28 
@Barkas47

Actions like opening doors or getting into vehicles also can't be recorded.
You can only play an animation where the character runs to the door or the vehicle, and then use scripting to make them get in or open the door.