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

Fault with 'nochasecategory' sometimes incorrectly invalidating viable targets #1471

Open
TheSilverHornet opened this issue Apr 25, 2024 · 2 comments

Comments

@TheSilverHornet
Copy link

To prune a long story short, fight command uses Enemy_InLos_ValidTarget to see if a target is valid, which in turn uses
bool CMobileCAI::IsValidTarget

Which contains

if (owner->unitDef->noChaseCategory & enemy->category) return false

therefore in 'some cases' (I can't see why not all, however), fight commands will not realise an enemy that is in the 'nochasecategory' is something it should consider as a real target and stop moving when in range of.

Nochasecategory is intended to be what it says on the tin, eg a unit will still shoot and engage with units there, but not pursue if they run away. The code seems to not always amount to that end result.

* the nearest enemy is an invalid target. (e.g. noChaseCategory)

bool CMobileCAI::IsValidTarget(const CUnit* enemy, CWeapon* weapon) const {

Discord discussions and more clips start around here: https://discord.com/channels/549281623154229250/724924957074915358/1233044341866369074

Example, this unit has 'nochasecategory="ALL"', will shoot a target as expected, but will not halt when fight-moved into range.
(However razorbacks with same tag, do halt correctly when given same command, so there is something else at play too)

When the nochasecategory tag is removed, they will halt at fight distance correctly.

nochaseonweaponon.mp4
nochaseoffweaponon.mp4
@TheSilverHornet
Copy link
Author

Units.zip
corvoyr.zip
( Unit bos/cob and unitdef for the test unit above )

@sprunk
Copy link
Collaborator

sprunk commented Apr 25, 2024

Make a new tag because this behaviour (shoot a unit but don't stop for it) is useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants