2025-09-05 23:10 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003219Spring engineGeneralpublic2012-07-23 18:10
Reportergajop 
Assigned ToKloot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
Product Version89.0 
Target VersionFixed in Version 
Summary0003219: AllowWeaponTarget is ignored for most units
DescriptionTried it in BA and BAR.
Most ground, water and air units seem to ignore if AllowWeaponTarget retuns false, and attack the unit anyhow.
The only exception is the com, who respects that until something fires at it, at which point it will return fire.
Buildings never attack first, but they, much like the com will still fire back.


Steps To ReproduceCreate a gadget with these two methods. Add one a com and a builder (different teams), com will not attack the builder. Add any dmg-capable vehicle. It will attack the com and the com will fire back.

function gadget:AllowWeaponTarget(attackerID, targetID, attackerWeaponNum, attackerWeaponDefID, defaultPriority)
    return false, 1000
end

function gadget:AllowWeaponTargetCheck(attackerID, attackerWeaponNum, attackerWeaponDefID)
    return true
end
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0009078

gajop (developer)

Also, would like to add that BA and BAR don't have any gadgets that contain AllowWeaponTarget and AllowWeaponTargetCheck. Also, I've added some Spring.Echo-lines in the springcontent.sdz, in those two functions to verify that I'm getting the correct results, and indeed, AllowWeaponTarget is passing false for both units.

~0009079

Kloot (developer)

you don't seem to understand what returning false from AllowWeaponTarget does and does not do...

IT DOES:

* block a specific target from being considered during a weapon's periodic auto-targeting sweep

IT DOES NOT:

* prevent a weapon from auto-generating a target for itself (that's the job of the AllowWeaponTargetCheck callin / commandfire WeaponDef key / unit states other than fire-at-will), unless false is always returned for all targets

* prevent a unit from returning fire at its last attacker (that's what the hold-fire unit state is for)

* prevent a unit's command "AI" from picking a target when the unit is idle (which is again controlled by a unit's fire- and movestate)
+Notes

-Issue History
Date Modified Username Field Change
2012-07-23 17:12 gajop New Issue
2012-07-23 17:22 gajop Note Added: 0009078
2012-07-23 18:04 Kloot Note Added: 0009079
2012-07-23 18:10 Kloot Status new => closed
2012-07-23 18:10 Kloot Assigned To => Kloot
2012-07-23 18:10 Kloot Resolution open => no change required
+Issue History