Loading...
  OR  Zero-K Name:    Password:   

Why different commands give different values for weapon range for the same unit?

3 posts, 330 views
Post comment
Filter:    Player:  
sort

19 months ago
Swift: wiki says: laser range 667, missile 530.

With a swift selected in game, UnitDefs[GetUnitDefID(uid)].maxWeaponRange gives 667.

But GetUnitMaxRange(uid) gives 600.

Also Spring.GetUnitWeaponState( uid, 1, "range" ) gives 600
while Spring.GetUnitWeaponState( uid, 2, "range" ) gives 530

So I'm totally confused with these 3 different values for 2 weapons.

May be 600 is the ground projection of 667 with default altitude of the swift = 300? But sqrt(667^2-300^2)=595, not exactly 600...

Can anybody help?
+0 / -0
19 months ago
According to the unit file, the ranges of the two weapons are 667 and 530. The 600 must be something strange. I'd first check the C++ implementation of Spring.GetUnitWeaponState, then Spring.GetUnitMaxRange. If this remains unconclusive, maybe there is a gadget that applies some strange things on the unitDef, maybe in an attempt to prohibit Swift fire while landed.
+0 / -0


19 months ago
Max Weapon range is the range the unit will walk into to fire. This can be altered via a custom param (combat range?). What you want is UnitDefs[unitDefID].weapons[i].range where i is the weapon number with starting index 1 or WeaponDefs[UnitDefs[unitDefID].weapons[i].id].range .
+0 / -0