View Issue Details

IDProjectCategoryView StatusLast Update
0000363Spring engineGeneralpublic2007-01-28 05:42
Reporterlippy Assigned ToILMTitan  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Summary0000363: [patch] Attacking from height with unit with projectile weapon
DescriptionPosted here on forum: http://taspring.clan-sy.com/phpbb/viewtopic.php?t=8748

Here is my original post:

When you have a unit with a projectile weapon on high ground it allows it to shoot further (The attack range reflects this) When the unit sees an enemy within it's range it will automatically fire at it. However when you try and manually tell it to fire at the enemy within its extended range, it will start moving towards the unit until it comes into its range as it would be on flat ground.
For example: place armfido and radar on top of hill in small divide, place an enemy just within its extended range; the fido will fire at it automatically, but if you manually try to attack it, the fido walks ALL the way down the hill and then fires.

The fire stance does not affect this behaviour (i.e. using hold position does not help) nor does LOS (i.e. same thing happens with LOS or just radar dot)
TagsNo tags attached.
Attached Files
MobileCAI.patch (Attachment missing)
MobileCAIv2.patch (Attachment missing)
Checked infolog.txt for Errors

Activities

Kloot

2007-01-07 04:01

developer   ~0000536

Last edited: 2007-01-07 12:00

Patch uploaded.

Important note: ALL units will now only move as close to a target as necessary for their longest-ranged weapon to hit it (if the target isn't already in range) when told to attack; you'll have to tell them explicitly to get closer if you don't want the range penalties.

(Sorry for again mixing whitespace cleanup with the actual patch code, but this function wasn't very readable in its original form.)

EDIT: just realized the two CWeapon* temp vars are not initialized to zero, so the patch needs to be patched a bit I'm afraid :]

Kloot

2007-01-11 21:38

developer   ~0000551

Will this still be committed? I have another patch which prevents units from stopping in their tracks when told to attack a target and the target dies while they are enroute (as many people consider this a bug), but it modifies the same function, so having this one applied first would be preferable.

lippy

2007-01-12 01:43

reporter   ~0000552

Was going to ask the same thing. Kloot, has the patch been patched, to fix the initialization of the temp vars? (the Issue history has no record of an updated MobileCAI)

BTW thanks a lot for fixing this! (It was very annoying indeed)

ILMTitan

2007-01-12 06:11

reporter   ~0000553

For most of my additions having to do with weapons, I had been working under the convention that weapon.front() was the one that mattered.

For instance, if we give an attack order to a lightning tank, we want it to run up and blast away with it's lightning gun, not peck from a distance with it's AA missiles.

Conversely, we don't want an Artillery piece to run up to a tank because it has a light machine gun on it as well.

I agree that neither firing nor movement stance should affect this behavior.

KDR_11k

2007-01-13 10:40

reporter   ~0000556

The first weapon should always be the one that matters. Would be nice if it was script-adjustable to use another weapon as the reference in case your units have weapons that get disabled or enabled under certain conditions.

lippy

2007-01-20 02:07

reporter   ~0000589

So how's progress (if any) on this going?

Kloot

2007-01-28 01:53

developer   ~0000633

New patch uploaded by request. The code now checks if a unit can hit its target with the weapon that comes first in its weapon-list (which is assumed to be the one that matters, eg. the Panther's lightning gun) rather than with *any* weapon, and will only move closer if it cannot.

ILMTitan

2007-01-28 05:42

reporter   ~0000636

Patch committed. Thank you.

I removed the weapon range check from the unit stop condition (but kept the weapon can hit check). I also inlined some variables so they are only calculated when needed.

Issue History

Date Modified Username Field Change
2007-01-05 03:30 lippy New Issue
2007-01-07 04:01 Kloot Note Added: 0000536
2007-01-07 04:01 Kloot File Added: MobileCAI.patch
2007-01-07 12:00 Kloot Note Edited: 0000536
2007-01-11 21:38 Kloot Note Added: 0000551
2007-01-12 01:43 lippy Note Added: 0000552
2007-01-12 06:11 ILMTitan Note Added: 0000553
2007-01-13 10:40 KDR_11k Note Added: 0000556
2007-01-20 02:07 lippy Note Added: 0000589
2007-01-27 16:05 tvo Summary Attacking from height with unit with projectile weapon => [patch] Attacking from height with unit with projectile weapon
2007-01-28 01:48 Kloot File Added: MobileCAIv2.patch
2007-01-28 01:53 Kloot Note Added: 0000633
2007-01-28 04:24 ILMTitan Status new => assigned
2007-01-28 04:24 ILMTitan Assigned To => ILMTitan
2007-01-28 05:42 ILMTitan Status assigned => resolved
2007-01-28 05:42 ILMTitan Resolution open => fixed
2007-01-28 05:42 ILMTitan Note Added: 0000636