Page 1 of 1
What does Spring.SetUnitMaxRange() do exactly?
Posted: 07 Nov 2015, 12:39
by KingRaptor
My initial assumption was that you can use it to force a unit with long-ranged weapons to close in to a shorter range when having an Attack order.
e.g. unit has three weapons, longest ranged one has 600 range, so it normally tries to close to 600 range and then stops
but with Spring.SetUnitMaxRange(unitID, 100), it closes to 100 range.
However, in Spring 100 and 100.0.1-289-g236a068, all it actually seems to do is change the leash range at which units which are idle or have Fight/Patrol orders move to attack nearby enemies. The unit will always camp at its longest weapon range when Attacking, no matter what.
Do I mantis this? Is there a way to do the thing described in the first paragraph?
Re: What does Spring.SetUnitMaxRange() do exactly?
Posted: 07 Nov 2015, 12:42
by FLOZi
I think you'll have to make your own custom attack command to do it properly, MaxRange only sets leash for patrol/fight as you said, though this is also tied to movestate, so you will get different results for hold / manuever / roam.
Re: What does Spring.SetUnitMaxRange() do exactly?
Posted: 07 Nov 2015, 16:21
by hokomoko
You're correct, units stop trying to close distance once they can fire at their target with any weapon, so as FLOZi said, you must implement a custom command.
Re: What does Spring.SetUnitMaxRange() do exactly?
Posted: 13 Nov 2015, 07:17
by Google_Frog
Didn't units once stop once their first weapon is in range? Have we lost functionality somewhere?
Re: What does Spring.SetUnitMaxRange() do exactly?
Posted: 13 Nov 2015, 10:43
by hokomoko
Google_Frog wrote:Didn't units once stop once their first weapon is in range? Have we lost functionality somewhere?
That's the current situation as well.
Re: What does Spring.SetUnitMaxRange() do exactly?
Posted: 13 Nov 2015, 19:29
by FLOZi
hokomoko wrote:Google_Frog wrote:Didn't units once stop once their first weapon is in range? Have we lost functionality somewhere?
That's the current situation as well.
Are you sure?
I think it is now the longest ranged weapon (though may depend on movestate)
Re: What does Spring.SetUnitMaxRange() do exactly?
Posted: 13 Nov 2015, 21:07
by hokomoko
Ah, communication issue! I thought:
First weapon = the first to be in range
and not
First weapon = weapons[1]
Re: What does Spring.SetUnitMaxRange() do exactly?
Posted: 14 Nov 2015, 01:05
by Forboding Angel
I'm guessing that it completely ignores categories? I hope not. Otherwise you might have a long range aa unit with a shorter range ground weapon happily stopping short of a ground target with it's thumb lodged directly up it's ass.
That's of course just one scenario... What if it is a ground unit with a ground weapon but can't fire at a target due to categories? Spring allows targeting of things that the unit can't fire at when there is no better target around, it just isn't able to fire at those things it has targeted. This behavior is especially irritating with air units.
Re: What does Spring.SetUnitMaxRange() do exactly?
Posted: 14 Nov 2015, 08:48
by Silentwings
GF is right though, it used to be first weapon and was changed, a long time ago, afaik by accident since I never saw it in the changelog. BAs chickens suffers a bit as a result.
Re: What does Spring.SetUnitMaxRange() do exactly?
Posted: 14 Nov 2015, 12:59
by FLOZi
My hope was for the function to allow us to set it arbitrarily but I didn't go deep enough
Re: What does Spring.SetUnitMaxRange() do exactly?
Posted: 14 Nov 2015, 18:36
by raaar
last time I checked, if you make a gunship-type aircraft with both a med range weapon and a long range weapon (ex: 450 range rockets and 700 range missiles), it'll hover at the longest weapon range instead of closing in to fire with both.