Page MenuHomeFeedback Tracker

BIS_fnc_scriptedMove doesn't work in Arma 3 and can be easily fixed.
Closed, ResolvedPublic


I was on Arma 3 discord yesterday, reporting that BIS_fnc_scriptedMove doesn't work on Arma 3 despite having Arma 3 logo on it (in the biki page), one of the discord admins did indeed add a note that it wouldn't work because it was scripted fro Arma 2 multiplayer framework.

Of course I was in dire need of that function to work in arma 3, and it was REALLY EASY to fix it! I easily fixed it to work on Arma 3 by changing just two lines, so could this "working version" of the function be implmented on the next update? as it is easy to do.

Lets take a look at the source code of BIS_fnc_scriptedMove, :
Take a look at lines 39 and 63,

				while {(abs _degs > abs _step) && BIS_scriptedMoveEnabled} do {    //line 39

	while {(_i <= _animLoops && !(isPlayer _guy)) && BIS_scriptedMoveEnabled} do {  //line 63

We can see both of these lines have the BIS_scriptedMoveEnabled variable which must be set to true before we can use the command, I think it was placed here so that the loop (for the walking animation at line 63 and for turning the soldier towards waypoints on line 39) can be stopped at any time by doing BIS_scriptedMoveEnabled = false; BUT
I tried using BIS_scriptedMoveEnabled = false; while the function was running the walking animation, but the loop didn't stop anyways, so the BIS_scriptedMoveEnabled is really useless and should just be removed from the while loop conditions at both line 39 and line 63

so line 39 and line 63 should be

				while {(abs _degs > abs _step)} do {    //line 39

	while {(_i <= _animLoops && !(isPlayer _guy))} do {  //line 63

This way when somebody tries to use BIS_fnc_scriptedMove they don't have to put BIS_scriptedMoveEnabled = true; before it, because BIS_scriptedMoveEnabled in this case is useless anyways due to the reasons mentioned above.

Now to the second and last part of this report:

Please take a look at line 64 of the function's source code:

		_nic = [objNull, _guy, rPLAYMOVE, _walkAnim] call RE;  //line 64

Thats why the discord admin I spoke with added this note to the biki page,

This function is broken in Arma 3 as its code relies on Arma 2: Multiplayer Framework.

because of the usage of RE command in the function's source code, since RE command doesn't exist in Arma 3 (replaced by RemoteExec) so the easy way I used to fix this is to simply just use playMove BECAUSE playMove has global effect, so we are basically doing the same thing that RE was supposed to do in the original code (broadcast the animation globally so everyone on the arma 2 server back then can see the walking animation) but playMove already has global effect so we don't need to RemoteExec that .

So we can just replace line 64 in the function's source code with:

		_nic = _guy playMove _walkAnim;   //and that will compensate for RE and make the function finally work for Arma 3!

So look dear poor feedback dev I know I speak like a stupid parrot putting an entire text wall just to explain why I replaced these lines, but we all know that I had to do this to be clear to everyone reading this so sorry if I wasted your time in unnecessary typing.

Well now lets just take a look at the function's source code before changing it and after changing it:
Before any changes (doesn't work on Arma 3) :
After changes (works on Arma 3) :
(in the after changes version , I changed lines 69 and 72 too, because at 69 the previous code was waitUntil {speed _guy < 0.25}; but the condition was not true until the unit passes the last point by about 10 meters because the animation loop adds additional animations that run after the unit reaches the desired position, so the guy's speed only goes below 0.25 when he passes the point by 10 meters, so I changed line 69 to waitUntil {((_guy distance2d (_wps select ((count _wps) - 1))) < 0.8)}; basically select the last waypoint and when the unit is about 0.8 meters away from that point the condition will be true.
then we come to line 72 that I also changed, I added a semicolon at the end of call _code and then added another line below it, _guy playmove ""; this additional line I added makes it so that the unit stops doing the moving animation after the previous waitUntil {((_guy distance2d (_wps select ((count _wps) - 1))) < 0.8)}; becomes true)

Thank you, and have a very safe and productive day (please include this in the next update).


Operating System
Windows 10 x64
Operating System Version
Steps To Reproduce

Put in the unit's init:

BIS_scriptedMoveEnabled = true;
[this, [getpos this, [0,0,0]]] call BIS_fnc_scriptedMove;

Or you can just put this in the debug console while aiming at the unit

BIS_scriptedMoveEnabled = true;
[this, [getpos this, [0,0,0]]] call BIS_fnc_scriptedMove;
Additional Information

I talk a lot.

Event Timeline

Troalinism updated the task description. (Show Details)Apr 30 2022, 1:07 AM

Rewritten to work with Arma 3, should be available in the next dev, please test properly in SP and MP

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.May 1 2022, 1:57 PM
BIS_fnc_KK changed the task status from New to Feedback.
BIS_fnc_KK added a subscriber: BIS_fnc_KK.

Rewritten to work with Arma 3, should be available in the next dev, please test properly in SP and MP

Thank you sir, so you want me to run the development build for arma 3 to test this?

Sure, but wait for the next update

Sure, but wait for the next update

Alright I test it, came with two videos, please read the description of each for extra info on how to reproduce and such:

Turning should be improved in next update (hopefully)

Turning should be improved in next update (hopefully)

great job, how can I MP test this in the dev version?

Just like in normal version, either launch preview in multiplayer from eden or start dedicated server

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.May 11 2022, 10:43 AM

We are done here then, can I get this ticket closed?

BIS_fnc_KK closed this task as Resolved.Jun 19 2022, 9:27 AM
BIS_fnc_KK changed Resolution from Open to Fixed.