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

[Vanilla Bug] AI sells artillery that have UndeploysInto=none when they are attacked by something out of range #1049

Open
3 tasks done
Rampastring opened this issue Feb 3, 2024 · 0 comments
Labels
vanilla-bug Something isn't working in the original game

Comments

@Rampastring
Copy link
Member

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I have attached as much information as possible (screenshots, debug and exception logs, etc).

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 and IsJuggernaut=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. Because MISSION_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 has Sellable=no.

Removing the TickTank=yes, Artillary=yes or IsJuggernaut=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

  1. Give the Deployed Tick Tank DeploysInto=none. Assign one of them to the AI (can be done through the map editor or through a standard attack script).
  2. Attack the Deployed Tick Tank with something that has higher range. Like a Juggernaut.

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 for UndeploysInto == nullptr at 0x0042C624. If that is the case, the function should jump to 0x0042C58C to exit the function instead of assigning MISSION_DECONSTRUCTION as the building's mission.

@Rampastring Rampastring added the vanilla-bug Something isn't working in the original game label Feb 3, 2024
@Rampastring Rampastring changed the title [Vanilla Bug] AI sells artillery that have UndeploysInto=none when they are attacked by something with higher range [Vanilla Bug] AI sells artillery that have UndeploysInto=none when they are attacked by something out of range Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vanilla-bug Something isn't working in the original game
Projects
None yet
Development

No branches or pull requests

1 participant