Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private _markerNames = ["Objective1", "Objective2"]; // change these to your marker names
- private _hasSpawned = [];
- { _hasSpawned pushBack false; } forEach _markerNames;
- private _allEnemiesSpawned = false;
- while { not _allEnemiesSpawned } do {
- _allEnemiesSpawned = true;
- {
- if (not (_hasSpawned select _forEachIndex)) then {
- // this marker has not yet spawned enemies, check if any players are inside marker
- _allEnemiesSpawned = false;
- private _markerName = _x;
- private _index = _forEachIndex;
- {
- if (_x inArea _markerName) exitWith {
- // a player is inside the marker
- // spawn the enemies on the other side of the marker from the player and move them to the marker center
- _hasSpawned set [_index, true];
- private _markerPos = markerPos _markerName;
- private _playerPos = getPos _x;
- private _playerDistance = _playerPos distance _markerPos;
- private _enemySpawnLocation = (_playerPos vectorFromTo _markerPos) vectorMultiply (_playerDistance * 2);
- _enemySpawnLocation set [2, 0];
- private _newGroup = [_enemySpawnLocation, east, 5] call BIS_fnc_spawnGroup;
- _newGroup move _markerPos;
- };
- } forEach allPlayers;
- };
- // wait 1 second between checking markers to reduce performance impact
- sleep 1;
- } forEach _markerNames;
- };
Advertisement
Add Comment
Please, Sign In to add comment