Page MenuHomeFeedback Tracker

Command/EH to obtain artillery (computer) target position
New, NormalPublic

Description

There is no good way to know what position an artillery unit is going to fire at. This is a two part problem...

  1. If the gunner is a player, then there is no clean way to know the selected map position in the artillery computer, or the position at the time of firing. MapSingleClick EH doesn't work, and getArtilleryComputerSettings doesn't return target position. You have to resort to somewhat complicated loops and process the UI, like in this forum post.
  2. If gunner is AI, there is no way to know where the unit is firing. Of course, if you're making it fire via doArtilleryFire etc then you will already know the target, but not if the gun is firing by itself. Fired EH doesn't work for this purpose.

Possible solutions:

  1. In the player case, getArtilleryComputerSettings could be made to return the currently targeted position, or some variant of MapSingleClick EH that works with the artillery computer.
  2. However, that won't apply to the AI gunner (I assume). In which case, perhaps an ArtilleryFired EH or similar could be helpful that returns the target position and other artillery computer settings if applicable, along with the projectile, gunner etc. If this method covers both AI and player cases then I think it will be preferred than #1 above.

These are lay-person suggestions, there might be better ways to do this!

Details

Severity
Trivial
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
10.0.19045.4291
Category
Scripting
Steps To Reproduce

Try obtaining the target position in script while firing artillery yourself via the artillery computer, or when the AI fires.

Additional Information

@NikkoJT suggested on discord

It would definitely be useful to be able to get an artillery vehicle's current target position without going through the UI, so it can work with AI artillery and not just players

@revo suggested on discord:

Speaking of artillery UI. It would be nice if it had an IDD so we can actually identify it without looping though all displays and controls to find it.

Event Timeline

I wonder if we can just get general engine-driven calculation for predicted projectile hit position? This way you could run it in Fired to find out where AI was firing. This will differ a bit from where AI *wanted* to fire though.

dedmen added a subscriber: dedmen.Thu, Apr 25, 2:07 PM

getArtilleryComputerSettings sounds good place to put this.
The position is stored in global UI, "GetAtilleryTarget"
the settings command could also return a reference to the UI display? Like shownArtilleryComputer checks.
Its actually a dialog, the dialog that https://community.bistudio.com/wiki/dialog checks. That could've also just returned the dialog display (which can then be checked for null), but alas we have 20 years of tech debt.

Using getArtilleryComputerSettings makes sense for players, but I'm not sure how it'd work for AI artillery since they don't use the UI (and there can be more than one of them on a machine). I'd prefer to have a solution that can also work for AI.

What I'd personally like to see for this would be:

  • unit EH for artillery firing that gives info about the target (possibly could skipped as can be replicated with Fired EH + following items)
  • a command to get what an artillery unit is currently aiming at
  • a command to get an AI's current fire mission (as set with e.g. doArtilleryFire)