gigglebok Posted February 16, 2020 Share Posted February 16, 2020 Could this happen if the _waypoint array doesn't hold values becuase it couldn't make a good one? I only get this error once every 20 or so missions, but I am using a custom map. Edit: I suspect if _wps is set to 0, the loop "for "_w" from 1 to _wps do" must make _wp negative on the second iteration. Should I just make the code safe by trapping a count of 0 for _newWp? 12:49:03 Bad conversion: array 12:49:03 Error in expression <estWp"]; _dist = 0; _testWp = _waypoint select (_w-1); if (!isNil "_testWp") the> 12:49:03 Error position: <select (_w-1); if (!isNil "_testWp") the> 12:49:03 Error Zero divisor 12:49:03 File functions\Units\fn_taskCircPatrol.sqf [AW_fnc_taskCircPatrol]..., line 116 12:49:03 Error in expression <estWp"]; _dist = 0; _testWp = _waypoint select (_w-1); if (!isNil "_testWp") the> 12:49:03 Error position: <select (_w-1); if (!isNil "_testWp") the> 12:49:03 Error Zero divisor 12:49:03 File functions\Units\fn_taskCircPatrol.sqf [AW_fnc_taskCircPatrol]..., line 116 12:49:03 Error in expression <estWp"]; _dist = 0; _testWp = _waypoint select (_w-1); if (!isNil "_testWp") the> 12:49:03 Error position: <select (_w-1); if (!isNil "_testWp") the> 12:49:03 Error Zero divisor 12:49:03 File functions\Units\fn_taskCircPatrol.sqf [AW_fnc_taskCircPatrol]..., line 116 12:49:03 Error in expression <6 do { if ( !(surfaceIsWater (_waypoint select _w)) && !((_waypoint select _w) i> 12:49:03 Error position: <select _w)) && !((_waypoint select _w) i> 12:49:03 Error Zero divisor 12:49:03 File functions\Units\fn_taskCircPatrol.sqf [AW_fnc_taskCircPatrol]..., line 138 12:49:03 Error in expression <6 do Link to comment Share on other sites More sharing options...
Stanhope Posted February 16, 2020 Share Posted February 16, 2020 I have no idea what exactly is causing this but it doesn't seem to break anything so I've not yet taken the time to look at it. I've been aware of it basically since I put that function in, probably more than 40 versions ago. Link to comment Share on other sites More sharing options...
gigglebok Posted February 16, 2020 Author Share Posted February 16, 2020 If it errors, doesn't it stop that routine being used from then on? I see broken missions after this error, trying to set up a campaign for "any" with a coord of 0,0. I'm going to try adding a check on line 112 to see if _wps is zero, if it is, would an exitwith true do the trick? Link to comment Share on other sites More sharing options...
Stanhope Posted February 16, 2020 Share Posted February 16, 2020 It may, idk, I've never had that problem. Did you change any other parts of the mission? Link to comment Share on other sites More sharing options...
gigglebok Posted February 16, 2020 Author Share Posted February 16, 2020 I am using a custom map, but I don't go anywhere near the mission folders, I just adjust AO definitions and the description. It's possible as I have some partially flooded towns (1-2m floods in places ) that it can't calculate a valid waypoint as this calculation seems to weight against sea, quite logically. But I think the possibility still exists (if you've noticed it too from time to time), so I'll try this defensive patch and see if that stops all the errors - there may be some edge cases in vanilla maps but maybe I'm getting it more on mine becuase of the environment? I'll report back after thrashing it today. By all means feel free drop it in the master code if it works, I guess it wouldn't hurt? Link to comment Share on other sites More sharing options...
Stanhope Posted February 16, 2020 Share Posted February 16, 2020 Yea that script will never put a waypoint down in water. So if the entire AO is under water it's probably not gonna know what to do. Link to comment Share on other sites More sharing options...
gigglebok Posted February 16, 2020 Author Share Posted February 16, 2020 Not the entire AO, but just the waypoints around the group leader, looking at the code, is that right? I need to find a way that it still works with fording/wading depth water, I guess. Not coming up with errors or glitches so far, but early days yet Link to comment Share on other sites More sharing options...
gigglebok Posted February 16, 2020 Author Share Posted February 16, 2020 Well, it all looks swimmingly good now (pardon the pun) Here it is in patch diff format, the two plusses seemed to do the trick. at least it fails gracefully without borking the machine now PS Thank you Stanhope and all the others for I&A, I'm your biggest fan, our small and sad clan idolise your program, it's all we play! $ diff -Naru ../../../AW_Invade__Annex_3_3_50.Altis/Functions/Units/fn_taskCircPatrol.sqf fn_taskCircPatrol.sqf --- ../../../AW_Invade__Annex_3_3_50.Altis/Functions/Units/fn_taskCircPatrol.sqf 2020-01-23 16:02:16.000000000 +0100 +++ fn_taskCircPatrol.sqf 2020-02-16 17:13:55.000575400 +0100 @@ -109,7 +109,7 @@ { _wps = 5; } else { _wps = count _newWp; }; - + if ( ( _wps < 2 ) || isNil("_wps") || isNil("_waypoint") ) exitWith {debugLog "No waypoints calculated"; false}; // B0K for "_w" from 1 to _wps do { private ["_dist", "_testWp"]; _dist = 0; @@ -133,6 +133,7 @@ }; }; }; +if ( isNil "_wp" || isNil "_waypoint" || ( count _waypoint ) < 6 ) exitWith {debugLog "No waypoints calculated at all"; false}; // B0K for "_w" from 1 to 6 do { if ( !(surfaceIsWater (_waypoint select _w)) && !((_waypoint select _w) isEqualTo [0,0]) ) exitWith Link to comment Share on other sites More sharing options...
gigglebok Posted February 16, 2020 Author Share Posted February 16, 2020 Belt, brace, and extra braces. I keep finding edge conditions! if ( ( _wps < 2 ) || ( ( count _waypoint ) < _wps ) || isNil("_wps") || isNil("_waypoint") ) exitWith {debugLog "No waypoints calculated"; false}; // B0K Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now