Tweaked assignment of defense waypoints

In Song Bin Tanh the waypoints where always assigned to the sector center.
Couldn't be reproduced on other maps.
Changed the creation to a different way, which works fine on Song Bin Tanh.
This commit is contained in:
Wyqer 2019-07-26 00:32:54 +02:00
parent 5f59cd979b
commit 012e59cf44
No known key found for this signature in database
GPG Key ID: D7E2F8BD7F1E48FA
2 changed files with 35 additions and 16 deletions

View File

@ -2,7 +2,7 @@ _grp = _this select 0;
_flagpos = _this select 1;
_basepos = getpos (leader _grp);
_is_infantry = false;
if ( vehicle (leader _grp) == (leader _grp) ) then { _is_infantry = true };
if (vehicle (leader _grp) == (leader _grp)) then {_is_infantry = true;};
sleep 5;
while {(count (waypoints _grp)) != 0} do {deleteWaypoint ((waypoints _grp) select 0);};
@ -10,22 +10,29 @@ sleep 1;
{_x doFollow leader _grp} foreach units _grp;
sleep 1;
if ( _is_infantry ) then {
_waypoint = _grp addWaypoint [_flagpos, 150];
if (_is_infantry) then {
private _wpPositions = [
_flagpos getPos [random 150, random 360],
_flagpos getPos [random 150, random 360],
_flagpos getPos [random 150, random 360],
_flagpos getPos [random 150, random 360],
_flagpos getPos [random 150, random 360]
];
_waypoint = _grp addWaypoint [_wpPositions select 0, 10];
_waypoint setWaypointType "MOVE";
_waypoint setWaypointBehaviour "SAFE";
_waypoint setWaypointCombatMode "YELLOW";
_waypoint setWaypointSpeed "LIMITED";
_waypoint setWaypointCompletionRadius 10;
_waypoint = _grp addWaypoint [_flagpos,150];
_waypoint = _grp addWaypoint [_wpPositions select 1, 10];
_waypoint setWaypointType "MOVE";
_waypoint = _grp addWaypoint [_flagpos, 150];
_waypoint = _grp addWaypoint [_wpPositions select 2, 10];
_waypoint setWaypointType "MOVE";
_waypoint = _grp addWaypoint [_flagpos, 150];
_waypoint = _grp addWaypoint [_wpPositions select 3, 10];
_waypoint setWaypointType "MOVE";
_waypoint = _grp addWaypoint [_flagpos, 150];
_waypoint = _grp addWaypoint [_wpPositions select 4, 10];
_waypoint setWaypointType "CYCLE";
} else {
_waypoint = _grp addWaypoint [_basepos, 1];
@ -40,26 +47,37 @@ _grp setCurrentWaypoint [_grp, 0];
waitUntil {
sleep 10;
( { alive _x } count (units _grp) == 0 ) || !(isNull ((leader _grp) findNearestEnemy (leader _grp)))
({alive _x} count (units _grp) == 0) || !(isNull ((leader _grp) findNearestEnemy (leader _grp)))
};
if ( { alive _x } count (units _grp) > 0 ) then {
while {(count (waypoints _grp)) != 0} do { deleteWaypoint ((waypoints _grp) select 0) };
if ({alive _x} count (units _grp) > 0) then {
while {(count (waypoints _grp)) != 0} do {deleteWaypoint ((waypoints _grp) select 0)};
sleep 1;
{_x doFollow leader _grp} foreach units _grp;
sleep 1;
_waypoint = _grp addWaypoint [_basepos, 150];
private _wpPositions = [
_basepos getPos [random 150, random 360],
_basepos getPos [random 150, random 360],
_basepos getPos [random 150, random 360],
_basepos getPos [random 150, random 360],
_basepos getPos [random 150, random 360]
];
_waypoint = _grp addWaypoint [_wpPositions select 0, 10];
_waypoint setWaypointType "SAD";
_waypoint setWaypointBehaviour "COMBAT";
_waypoint setWaypointCombatMode "YELLOW";
_waypoint setWaypointSpeed "LIMITED";
_waypoint = _grp addWaypoint [_basepos, 150];
if (_is_infantry) then {
_waypoint setWaypointSpeed "NORMAL";
} else {
_waypoint setWaypointSpeed "LIMITED";
};
_waypoint = _grp addWaypoint [_wpPositions select 1, 10];
_waypoint setWaypointType "SAD";
_waypoint = _grp addWaypoint [_basepos, 150];
_waypoint = _grp addWaypoint [_wpPositions select 2, 10];
_waypoint setWaypointType "SAD";
_waypoint = _grp addWaypoint [_basepos, 150];
_waypoint = _grp addWaypoint [_wpPositions select 3, 10];
_waypoint setWaypointType "SAD";
_waypoint = _grp addWaypoint [_basepos, 150];
_waypoint = _grp addWaypoint [_wpPositions select 4, 10];
_waypoint setWaypointType "CYCLE";
_grp setCurrentWaypoint [_grp, 0];
};

View File

@ -207,6 +207,7 @@ class Missions
* Tweaked: Weather is now only handled by the server.
* Tweaked: Gear check after leaving the arsenal or load a loadout improved to not strip you completely. Thanks to [Zharf](https://github.com/zharf)
* Tweaked: Build tool now also adds the correct map name to the mission name, like in the release files.
* Tweaked: Sector defenders waypoint creation.
* Fixed: Intel value could get corrupted if leaving the secondary dialog directly after starting a mission.
* Fixed: "All is red" for first player after a server restart. (just a visual bug, doesn't affect gameplay)