Vampurica / DZMS-DayZMissionSystem

A logic and useability rewrite of the DayZChernarus Mission System
17 stars 22 forks source link

Mission Location Blacklists #11

Closed Vampurica closed 10 years ago

Vampurica commented 10 years ago

Should be a simple array of coordinates with a foreach checking the distance is greater than a certain amount.

Maybe there is a way to do it with invisible markers, but it should be as simple as the end user defining coords instead of adding markers to a file like DZAI or Sarge.

mudzereli commented 10 years ago

I had some code that did this for the original Chernarus Mission System, an array of positions + radius in the config. When finding a mission spot it would keep trying if until it was outside all the blacklisted zones.

mudzereli commented 10 years ago

found it -- probably would need to be adjusted slightly but most likely could work

array in the config file:

DZ_MISSION_BLACKLIST_ZONES = 
[
    ["Stary" ,[06325,07807],500],
    ["Klen"  ,[04063,11664],500],
    ["Bash"  ,[11447,11364],500],
    ["Hero"  ,[01606,07803],400],
    ["Bandit",[12944,12766],400]
];

blacklist code:

    _safeCoords = false;
    while {!_safeCoords} do {
        _safeCoords = true;
        _coords     = [getMarkerPos "center",0,5000,10,0,1250,0] call BIS_fnc_findSafePos;
        _coordsX    = _coords select 0;
        _coordsY    = _coords select 1;
        {
            _cityName    = _x select 0;
            _cityCoords  = _x select 1;
            _cityRadius  = _x select 2;
            _cityCoordsX = _cityCoords select 0;
            _cityCoordsY = _cityCoords select 1;
            _minCoordsY  = _cityCoordsY - _cityRadius;
            _maxCoordsY  = _cityCoordsY + _cityRadius;
            _minCoordsX  = _cityCoordsX - _cityRadius;
            _maxCoordsX  = _cityCoordsX + _cityRadius;
            _insideCityX = _coordsX < _maxCoordsX && _coordsX > _minCoordsX;
            _insideCityY = _coordsY < _maxCoordsY && _coordsY > _minCoordsY;
            _insideCity  = _insideCityX && _insideCityY;
            if (_insideCity) then { _safeCoords = false; };
        } forEach DZ_MISSION_BLACKLIST_ZONES;
    };
Vampurica commented 10 years ago

I'm thinking something like this in the Functions findSafePos.

DZMSblackAreas = [
[[06325,07807,0], 500],
[[04063,11664,0], 500]
];

_okBlack = true;
{
    if ((_coords distance (_x select 0)) <= (_x select 1)) then {_okBlack = false;};
} forEach DZMSblackAreas;

Although I don't think the forEach is correct.

Vampurica commented 10 years ago

Added e9e7fb09e0d9fce3027beaf33d48ef8ec0ea0501.

Jokaru88 commented 10 years ago

This not work, bots now spawn in\or near protected zones only...

//DZMSFindPos loops BIS_fnc_findSafePos until it gets a valid result _coords = call DZMSFindPos; while {((_coords distance zonestary) < 800) or ((_coords distance zonebash) < 800) or ((_coords distance zoneklen) < 800) or ((_coords distance zonebandit) < 800) or ((_coords distance zonehero) < 800)} do {_coords = call DZMSFindPos;};

This work and tested, only need to add in each mission. No missions near trade zones ever.