Phobos icon indicating copy to clipboard operation
Phobos copied to clipboard

Allow vehicles to retain target on move command

Open Starkku opened this issue 1 year ago • 3 comments

Retain target on movement command

  • It is now possible for vehicles to retain their target when issued movement command by setting KeepTargetOnMove to true.
    • Note that no check is done whether or not the vehicle or the weapon can actually fire while moving, this is on modder's discretion.
    • The target is automatically reset if the vehicle moves beyond the weapon's range from the target.
  • KeepTargetOnMove.ExtraDistance can be used to modify the distance considered 'out of range' from target (it is added to weapon range), negative values work to reduce the distance.

In rulesmd.ini:

[SOMEVEHICLE]                     ; VehicleType
KeepTargetOnMove=false            ; boolean
KeepTargetOnMove.ExtraDistance=0  ; floating point value, distance in cells

Starkku avatar Jul 07 '24 10:07 Starkku

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

github-actions[bot] avatar Jul 07 '24 10:07 github-actions[bot]

Very useful improvement. Adding a global version tag in [General] would be better I think, as the flags may be used by many UnitTypes.

TaranDahl avatar Sep 07 '24 09:09 TaranDahl

In this build I had a weird instance of a subterranean harvester getting stuck underground and only able to move around, but never back up to the ground. And after a while, the game crashed, but it might not be related to that harvester. Here's the link: https://drive.google.com/file/d/1Zbul8kBow3Q-zuzHt__L86NkuqHpqYLJ

mevitar avatar Sep 23 '24 23:09 mevitar

https://drive.google.com/file/d/111p6BCPOZ2Js3qFYof9DcgTjbJOj1iYm Another crash in this newest build available. No idea what's the reason. The except.txt looks very similar (3 topmost elements on the stack are the same).

mevitar avatar Dec 16 '24 22:12 mevitar

Besides these crashes (that might or might not be related to the build), both tags seem to work fine.

mevitar avatar Dec 16 '24 22:12 mevitar

Adding a global version tag in [General] would be better I think, as the flags may be used by many UnitTypes.

@Starkku what do you think?

Metadorius avatar Jan 26 '25 19:01 Metadorius

This was added with designing specific units in mind, not for general application - think units like Cyclone in SC2. Giving this to all globally would very likely not improve general unit behavior at all and annoy many players when a lot of imprecise "target out of range" situations happens and combat gets interrupted. But you can try, though definitely not instead of the unit-specific tag.

Speederovsky avatar Jan 26 '25 19:01 Speederovsky

Yeah in no way that is going to be "instead".

Metadorius avatar Jan 26 '25 19:01 Metadorius

Yeah in no way that is going to be "instead".

This sounds like a worse version of queue move.

ZivDero avatar Jan 26 '25 19:01 ZivDero

Yeah in no way that is going to be "instead".

This sounds like a worse version of queue move.

image Waiting for the day ZivDero restores proper Q-Move

Metadorius avatar Jan 26 '25 19:01 Metadorius

Yeah in no way that is going to be "instead".

This sounds like a worse version of queue move.

image Waiting for the day ZivDero restores proper Q-Move

As far as I can see, it's a matter of 2 hooks, each maybe a couple lines long. I can instruct you on it :P

ZivDero avatar Jan 26 '25 20:01 ZivDero

This was pretty much explicitly trying to imitate Terran Cyclone's behaviour from SC2 rather than aiming for any sort of general unit behaviour improvement just like @Speederovsky stated so I am somewhat hesitant to add the global control and consider it to be a poor idea but if there are people who insist on it I guess I could.

Do not come complaining it plays like shit if you do though.

Starkku avatar Jan 26 '25 20:01 Starkku

No global control it is then.

Metadorius avatar Jan 26 '25 20:01 Metadorius