[Vanilla Bug] AI sells artillery that have UndeploysInto=none
when they are attacked by something out of range
#1049
Labels
vanilla-bug
Something isn't working in the original game
First Check
Description
When the AI has a deployed Tick Tank, Artillery or Juggernaut that is attacked by a ground-based object that is out of the deployed unit's range, the AI undeploys the unit to move their "artillery" unit into range so they can retaliate. This behaviour is tied to the keys
TickTank=yes
,Artillary=yes
andIsJuggernaut=yes
.The undeploying is done by assigning
MISSION_DECONSTRUCTION
to the deployed unit (building).Normally, this is desired behaviour. However, if you, as a modder, create an artillery unit that has
UndeploysInto=none
in its deployed form, iow. you remove the artillery's ability to undeploy, this behaviour still applies. BecauseMISSION_DECONSTRUCTION
is used not only for undeploying, but also for selling the unit, the AI ends up selling the deployed unit. This happens regardless of whether the building type hasSellable=no
.Removing the
TickTank=yes
,Artillary=yes
orIsJuggernaut=yes
keys from the object is no proper solution either, because those keys are necessary for the unit's deploy facing and deploy offset when it's turned into a building.Required Code (optional)
No response
Steps To Reproduce
DeploysInto=none
. Assign one of them to the AI (can be done through the map editor or through a standard attack script).Expected Behaviour
The Tick Tank should remain in place, since it cannot undeploy into any unit.
Actual Behaviour
The AI sells the Tick Tank.
Additional Context
BuildingClass::Assign_Target
is missing a check forUndeploysInto == nullptr
at0x0042C624
. If that is the case, the function should jump to0x0042C58C
to exit the function instead of assigningMISSION_DECONSTRUCTION
as the building's mission.The text was updated successfully, but these errors were encountered: