Fix missing unit param for SpecificUnitsInArea objective type #6931
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.
Issue
Normally when an objective has reached some kind of result (success, failure), depending on its type, it provides the result, and additional data for callback functions to use, like units.
The
SpecificUnitsInArea
type however is missing that extra data, specifically the destroyed unit if it triggers objective failure.Right now this oversight breaks the Seraphim mission Tha-Atha-Aez, as the callbacks tries to reference the
unit
, which is justnil
, and basically softlocking the death camera mission failure cinematics. The game has to be closed.Description of the proposed changes
Simply add the
unit
as a parameter forOnResult
when it's called via the unit's death.Not only it fixes the map (mostly), it also prevents the same errors for future missions where mission developers want to use the unit via objective callbacks.
Testing done on the proposed changes
The mission Tha-Atha-Aez is relevant for this.
The first 2 allied ACU escort mission failures should trigger proper.
The 3rd however has an error in the map script, there's no
unit
param defined in theAddResultCallback
section, so it's map specific.