findSafePos failsafe?

Vampire

OpenDayZ Rockstar!
I'm trying to make a function that will loop BIS_fnc_findSafePos comparing it to coordinates to make sure they do not match to stop the "Novy Sobor" bug with the Mission Systems.

Is there a code snippet out there already? I get an error with the attempt I made.

Here's what I tried:
Code:
DZ_FindPos = {
    private["_findRun","_pos"];
    _findRun = true;
    while {_findRun} do {
        _pos = [getMarkerPos "center",0,5500,100,0,20,0] call BIS_fnc_findSafePos;
        if (!(_pos == (getMarkerPos "center"))) then {
            _findRun = false;
        };
        sleep 2;
    };
  
    _pos
};

And this is the error I get:
Code:
19:43:40 Error in expression <0] call BIS_fnc_findSafePos;
if (!(_pos == (getMarkerPos "center"))) then {
_fin>
19:43:40   Error position: <== (getMarkerPos "center"))) then {
_fin>
19:43:40   Error ==: Type Array, expected Number,String,Object,Side,Group,Text,Config entry,Display (dialog),Control,Team member,Task,Location

Apparently getMarkerPos "center" didn't simply return coordinates as I believed it did, so I need a way to get the coordinates of the map center.
 
how do you call the function?

try fetching the markerpos before attempting to find safepos or maybe try parsing it to the function in _this variable like this:
Code:
_pos=getmarkerpos "center";
[_pos] call DZ_FindPos;
 
I'm trying to redo the logic behind the mission systems, so if there is a better way to get the center of the map, I'd rather use it.
I want the missions to still work on every map, so I can't use static coordinates.

And Halv, I am calling it correctly as far as I know, but getMarkerPos is not returning an array that the game doesn't see as a worldspace when comparing the two.

I looked at the code for heli crashes and it loops for a position checking for AllVehicles within 10meters. If there are any then it reruns the loop for a new position again until it finds a position that returns 0 vehicles. I could do something similar in my function but I'd like to try what I attempted originally.
 
What about setting a fixed coord for center, using safe coords like ebay suggested, then taking the coords findsafepos returns and doing a compare to the fixed coords. If they match, have findsafepos call again and get new coords. Rinse repeat until coords are different then pass it through.
 
Also regarding the part about using it on different maps and not using a static coord. I am guessing for ease of use for other users? If so you could take a few mins and go get all the center coords for all the maps you want the mission to work on and create an array with them and just set a variable for map name. So whoever edits the script all they do is change the map name variable and it uses the correct coords for the map. Add that to your coords check for findsafepos and viola`
 
I've decided i'm going to take the time to go through all the currently used maps and get the centerPosition from the map.cfg and make the failsafe have a set of coordinates based on the map to compare to. It'll take longer but I think the end result will be worth it.

Thanks for the suggestions.
 
Back
Top