View Issue Details

IDProjectCategoryView StatusLast Update
0000675Spring engineGeneralpublic2007-11-14 20:55
ReporterKDR_11k Assigned Toimbaczek  
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Summary0000675: [patch] BlockShotX can force a retarget
DescriptionThis patch adds a third argument to BlockShotX that, like the second, reacts to being changed in the function itself.

If this argument is changed to true the weapon will avoid the target BlockShotX was called on, i.e. it acts as if the target was in the badTargetCategory: Retarget regularly and greatly reduce their targetting priority.

This is very useful for any script that wants to prevent a weapon from shooting at certain targets without having it lock down completely every time an unwanted target is chosen (because it can't shoot at the target but the weapon keeps aiming at it), e.g. when BlockShotX enforces minimum ranges.
Additional InformationBlockShotX gets called when the list of targets is compiled now to affect the weighting.
TagsNo tags attached.
Attached Files
blockTarget.patch (Attachment missing)
changeTarget.patch (Attachment missing)
changeTarget1.patch (Attachment missing)
changeTarget_updated.patch (Attachment missing)
Checked infolog.txt for Errors

Activities

imbaczek

2007-11-10 19:15

reporter   ~0001408

IMO this should be a separate function, say BlockTargetChoice or something similar. BlockShot is too suggestive and should do just what its name implies. Anything more will be confusing.

Other than that I like the idea. A more complete patch also should provide a Lua call-in (perhaps also a call-out to register receivers of a call-in for performance reasons) so modders won't have to change BOS of every unit they want this behaviour on - but that's more of a suggestion.

KDR_11k

2007-11-10 20:12

reporter   ~0001409

BlockTarget would also have to be able to block shots since there are loads of cases where the same condition should cause a blocked shot and a changed target. I thought of it more in that context, i.e. "stop shooting and look for something else".

imbaczek

2007-11-10 21:49

reporter   ~0001410

Maybe BlockTarget should be called before any BlockShotX and somehow change/discard the attack command that the unit is executing?

KDR_11k

2007-11-10 22:19

reporter   ~0001411

Okay, I restarted the idea from scratch.

Now it introduces the COB call-in TargetWeight(targetID, weight), weight defaults to 65536 which represents 1.0 and is multiplied with the target's value to determine priorities.

It also adds the set constant CHANGE_TARGET:
set CHANGE_TARGET to x makes weaponX pick a new target.

KDR_11k

2007-11-11 08:40

reporter   ~0001412

Added a minor change that gives less priority (instead of the default, more) to the last target when set CHANGE_TARGET was used, this improves the behaviour for weapons without TargetWeight.

imbaczek

2007-11-12 01:02

reporter   ~0001417

I quite like the idea, does what it says it does.

I'll check this out Tuesday or so.

imbaczek

2007-11-14 16:02

reporter   ~0001422

unfortunately it seems that the patch has suffered from bitrot already. please resubmit?

KDR_11k

2007-11-14 16:34

reporter   ~0001424

Must have been corrupted on your end, tombom reports he can use it just fine and Diff says it's identical to the file I uploaded. Or do you mean I should take it against a newer revision or something?

imbaczek

2007-11-14 17:06

reporter   ~0001425

yes, I mean it conflicts in newer revisions (apparently trepan changed some COB stuff in r4781.)

KDR_11k

2007-11-14 17:25

reporter   ~0001427

Okay, fixed it. Trepan changed some whitespaces in the area.

imbaczek

2007-11-14 19:27

reporter   ~0001428

applied and compiled cleanly. testing now.

imbaczek

2007-11-14 20:54

reporter   ~0001431

committed this.

I can't seem to get repeatable behavior with TargetWeightX (I didn't try to dig deep into target selection code though.) Gave it the benefit of doubt; it doesn't break existing functionality.

r4788.

Issue History

Date Modified Username Field Change
2007-11-10 18:33 KDR_11k New Issue
2007-11-10 18:33 KDR_11k File Added: blockTarget.patch
2007-11-10 19:15 imbaczek Note Added: 0001408
2007-11-10 20:12 KDR_11k Note Added: 0001409
2007-11-10 21:49 imbaczek Note Added: 0001410
2007-11-10 22:09 KDR_11k File Added: changeTarget.patch
2007-11-10 22:19 KDR_11k Note Added: 0001411
2007-11-11 08:38 KDR_11k File Added: changeTarget1.patch
2007-11-11 08:40 KDR_11k Note Added: 0001412
2007-11-12 01:02 imbaczek Note Added: 0001417
2007-11-14 16:02 imbaczek Note Added: 0001422
2007-11-14 16:34 KDR_11k Note Added: 0001424
2007-11-14 17:06 imbaczek Note Added: 0001425
2007-11-14 17:24 KDR_11k File Added: changeTarget_updated.patch
2007-11-14 17:25 KDR_11k Note Added: 0001427
2007-11-14 19:27 imbaczek Note Added: 0001428
2007-11-14 20:54 imbaczek Status new => resolved
2007-11-14 20:54 imbaczek Resolution open => fixed
2007-11-14 20:54 imbaczek Assigned To => imbaczek
2007-11-14 20:55 imbaczek Note Added: 0001431