Skip to content
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

AI function fixes and improvements #440

Merged
merged 3 commits into from
Jul 17, 2016
Merged

AI function fixes and improvements #440

merged 3 commits into from
Jul 17, 2016

Conversation

kymckay
Copy link
Contributor

@kymckay kymckay commented Jul 16, 2016

When merged this pull request will:

  • Fix infinite building searches caused by taskSearchArea (AI would search the same building ad infinitum)
  • Fix incorrect building position storage in taskDefend
  • Improve group behaviour of taskDefend

@@ -38,13 +38,12 @@ _position = [_position,_group] select (_position isEqualTo []);
_position = _position call CBA_fnc_getPos;

[_group] call CBA_fnc_clearWaypoints;
_group enableAttack false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason behind this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's now using _unit disableAI "PATH"; this allows units not assigned to a position to counterattack in the case of contact

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the commit message to more clearly reflect the reasoning

If a building search was enacted, the waypoint would be locked by the searchNearby function before it is actually considered completed. This would result in AI repeatedly going back to the same waypoint and triggering the onCompletion statement causing another building search.
The array of building positions stored by the function would be set to `nil` then subsequently set to an empty array in the event of all positions being used up. This would result in the building never being used again by future calls to the function.
- Minor optimization
- Using the new `disableAI "PATH"` simplifies the code and allows it to be easily reverted unlike `doStop`
- If patrol is enabled then units should patrol regardless of how many are assigned, otherwise they end up standing around
- Units in position are told to stay upright for better use of windows and more engaging combat
- No longer need to `enableAttack false` since no longer using `doStop` - which allows unassigned units to counterattack in case of contact
@commy2 commy2 added this to the 3.0.1 milestone Jul 16, 2016
@commy2
Copy link
Contributor

commy2 commented Jul 16, 2016

merge?

@commy2 commy2 merged commit d730fba into CBATeam:master Jul 17, 2016
@kymckay kymckay deleted the aiFixes branch July 17, 2016 09:34
@commy2 commy2 mentioned this pull request Sep 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants