-
-
Notifications
You must be signed in to change notification settings - Fork 323
v0.96.8 AA turrets #838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nicoman35
wants to merge
10
commits into
KillahPotatoes:v0.96.8
Choose a base branch
from
nicoman35:v0.96.8-AA-turrets-v2
base: v0.96.8
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
v0.96.8 AA turrets #838
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
622ff5d
Define AA spawn point class
Nicoman55 cad5357
Add AA turrets to custom preset
Nicoman55 2f1e732
Add AA turrets to apex preset
Nicoman55 3fc8ed7
Add AA turret manager loop
Nicoman55 7ae7e43
Start AA turret manager on server
Nicoman55 8205a25
Demanded corrections / additions
Nicoman55 332db37
Update AA_turret_manager.sqf
Nicoman55 d21fc86
Update AA_turret_manager.sqf
Nicoman55 6803889
Merge branch 'v0.96.8' into v0.96.8-AA-turrets-v2
Nicoman55 2fc16cc
Merge branch 'v0.96.8' into v0.96.8-AA-turrets-v2
Wyqer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| waitUntil {!isNil "save_is_loaded"}; | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| waitUntil {!isNil "GRLIB_vehicle_to_military_base_links"}; | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| waitUntil {!isNil "blufor_sectors"}; | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| waitUntil {save_is_loaded}; | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if (GRLIB_difficulty_modifier == 0) exitWith {}; // no AA turrets on easiest difficulty level | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (isNil "KPLIB_o_AA_Turrets") exitWith {}; // leave, if there are no AA turrets defined in currently played preset | ||
| private _AA_Killed_Turrets = 0; // counter of killed AA turrets | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (isNil "AA_used_positions") then {AA_used_positions = []}; // define array containing all currently used positions | ||
| if (isNil "AA_backland_turrets") then {AA_backland_turrets = []}; // define array containing all turrets corresponding to a used position | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| while {GRLIB_endgame == 0} do { | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| private _sleeptime = (1800 + (random 1800)) / (([] call KPLIB_fnc_getOpforFactor) * GRLIB_csat_aggressivity); | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if (combat_readiness >= 80) then {_sleeptime = _sleeptime * 0.75}; | ||
| if (combat_readiness >= 90) then {_sleeptime = _sleeptime * 0.75}; | ||
| if (combat_readiness >= 95) then {_sleeptime = _sleeptime * 0.75}; | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| sleep _sleeptime; | ||
|
|
||
| // Check and clear turret array for any destroyed or unmanned units | ||
| private _turret = objNull; | ||
| { | ||
| if (typeName _x == "ARRAY") then { | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| _turret = _x select 0; // in case turret is an array, choose first element of array as turret | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } else { | ||
| _turret = _x; | ||
| }; | ||
| if (!alive _turret || !alive gunner _turret) then { | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (typeName _x == "ARRAY") then { | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| if (alive _x) then {_x setDamage 1}; | ||
| } forEach _x; | ||
| }; | ||
| AA_backland_turrets deleteAt _forEachIndex; // delete any destroyed or unmanned AA turret from turret array | ||
| AA_used_positions deleteAt _forEachIndex; // delete corresponding position from used positions array | ||
| _AA_Killed_Turrets = _AA_Killed_Turrets + 1; // raise kill counter | ||
| }; | ||
| } forEach AA_backland_turrets; | ||
|
|
||
| // If AA turrets were destroyed, add a 'punishment' time for the enemy. This extra time is ment to be a dampening of the production of AA turrets | ||
| if (_AA_Killed_Turrets > 0) then { | ||
| _sleeptime = _sleeptime * _AA_Killed_Turrets; | ||
| sleep _sleeptime; // killing AA turrets 'damps' placement of further turrets | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| _AA_Killed_Turrets = 0; // reset kill counter after performing 'damp' sleep | ||
| }; | ||
|
|
||
| // Calculate maximum amount of AA turrets | ||
| private _maxAAnumber = round (GRLIB_difficulty_modifier * 2); | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (_maxAAnumber > 12) then {_maxAAnumber = 12}; | ||
| if (combat_readiness > 0 && _maxAAnumber > 0) then { | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| _maxAAnumber = _maxAAnumber * round (combat_readiness / 30); | ||
| if (_maxAAnumber > 20) then {_maxAAnumber = 20}; | ||
| if (_maxAAnumber > (count sectors_allSectors - count blufor_sectors)) then {_maxAAnumber = count sectors_allSectors - count blufor_sectors}; // maximum amount of AA turrets should not exceed number of opfor sectors | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }; | ||
|
|
||
| // If maximum amount of AA turrets has not been reached yet, add one to the map | ||
| if (count AA_backland_turrets < _maxAAnumber) then { | ||
| private _spawn_marker = [] call KPLIB_fnc_getOpforAASpawnPoint; // get a sector for spawning an AA turret | ||
| if (_spawn_marker == "") exitWith {diag_log formatText ["%1%2", time, "s (AA_turret_manager) _spawn_marker: Could not find AA position"];}; | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| private _rndTurret = selectRandom KPLIB_o_AA_Turrets; // choose an opfor turret to be spawned | ||
|
|
||
| // The lower the difficulty level is, the less it is likely to have 'heavy' AA defenses | ||
| if (GRLIB_difficulty_modifier < 4 && typeName _rndTurret == "ARRAY") then { | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| private _i = 4 - GRLIB_difficulty_modifier; | ||
| while {typeName _rndTurret == "ARRAY" && _i > 0} do { | ||
| _rndTurret = selectRandom KPLIB_o_AA_Turrets; | ||
| _i = _i - 1; | ||
| }; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (with deprecated variable) for "_i" from 1 to (4-GRLIB_difficulty_modifier) do {_rndTurret = selectRandom KPLIB_o_AA_Turrests;}; |
||
| }; | ||
|
|
||
| private _vehicle = objNull; | ||
| AA_used_positions pushBack _spawn_marker; | ||
| if (typeName _rndTurret == "ARRAY") exitWith { | ||
| private _group = createGroup [GRLIB_side_enemy, true]; | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| private _groupVehicles = []; | ||
| { | ||
| _vehicle = [markerpos _spawn_marker, _x] call KPLIB_fnc_spawnVehicle; | ||
| _groupVehicles pushBack _vehicle; | ||
| [_vehicle] joinSilent _group; | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } forEach _rndTurret; | ||
| AA_backland_turrets pushBack _groupVehicles; | ||
| _group setBehaviour "AWARE"; | ||
| }; | ||
| private _vehicle = [markerpos _spawn_marker, _rndTurret] call KPLIB_fnc_spawnVehicle; | ||
| AA_backland_turrets pushBack _vehicle; | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| _vehicle setBehaviour "AWARE"; | ||
Wyqer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.