RemoteControlledArty / RemoteControlledArtillery

ARMA III Mod
1 stars 1 forks source link

Arty marker distance bugs when replacing or renaming (moving works fine) #17

Open RemoteControlledArty opened 6 months ago

RemoteControlledArty commented 6 months ago

Distance bugs to 29998m when replacing or renaming it (while moving it works fine). Cycling markers with 5 fixes distance, but unnoticed leads to misfires.

Example: arty1 marker is placed, engaged and removed, even minutes later if arty1 is placed again, the distance is bugged.

Tapawingo commented 6 months ago

Would that also incidentally be the distance to [0, 0, 0]? If it is, then this is probably an indexing issue. I see that in RC_UI_Loop you are passing the markers into a GVAR called RC_Current_Target and then this GVAR is used later when calculating the distance. Most likely, when you are renaming or replacing the marker the one stored in RC_Current_Target is not modified. So when you are trying to get the marker position it returns [0, 0, 0] as the stored marker no longer exists.

realfluffyuwu commented 6 months ago

After having a quick read through again I believe I accounted for situations where the marker didn't exist anymore but maybe I just didn't test it well enough?

This is checking for isNil which should reset it to index 0 but perhaps changing this to checking if the markers Position is at [0, 0, 0] which is always returned if the marker doesn't exist might prove better for this case.

Although this still doesn't solve needing to cycle through the markers to acquire the correct target.

Tapawingo commented 6 months ago

After having a quick read through again I believe I accounted for situations where the marker didn't exist anymore but maybe I just didn't test it well enough?

This is checking for isNil which should reset it to index 0 but perhaps changing this to checking if the markers Position is at [0, 0, 0] which is always returned if the marker doesn't exist might prove better for this case.

Although this still doesn't solve needing to cycle through the markers to acquire the correct target.

Yeah this should account for it. I think if you can replicate the bug you should check the value of RC_Current_Target. This should give us a better idea of what is happening under the hood.

Edit: I just tested it and RC_Current_Target is not updated to the new marker 😬