Minimum distance possible for artillery pieces?
Moderator: Moderators
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Minimum distance possible for artillery pieces?
Question: how easy is it to make artillery have a minimum range of fire? ie:
* it's a builtin parameter for units?
* It's doable with lua somehow?
* It's not possible?
* Something else?
(reason: thinking of making a mission screenplay where you go around with a radar jammer ,taking out artillery positions. Obviously would work less well if the first position blows one's pathetic commando units to smithereens)
* it's a builtin parameter for units?
* It's doable with lua somehow?
* It's not possible?
* Something else?
(reason: thinking of making a mission screenplay where you go around with a radar jammer ,taking out artillery positions. Obviously would work less well if the first position blows one's pathetic commando units to smithereens)
Re: Minimum distance possible for artillery pieces?
You can force the unit to lock up when a secondary weapon that's slaved to the primary targets something in the COB, gets more complex if you want to add proper retargetting and all that. Good luck.
Re: Minimum distance possible for artillery pieces?
You can make lua block attack commands that are within a certain range of the unit, though fi the target moves into that range hmmm, maybe it would require a little extra logic
- Guessmyname
- Posts: 3301
- Joined: 28 Apr 2005, 21:07
Re: Minimum distance possible for artillery pieces?
Not really. Isn't there a COB define that does that automatically? CHANGE_TARGET or somesuch. I'll have a look...KDR_11k wrote:You can force the unit to lock up when a secondary weapon that's slaved to the primary targets something in the COB, gets more complex if you want to add proper retargetting and all that. Good luck.
Yep. set CHANGE_TARGET to <integer>; will change the target for the <integer> weapon, ie set CHANGE_TARGET 1; will make weapon 1 look for a new target.
Okay, this is entirely theoretical, but...
Set up your artillery weapon as normal. Use the 1st weapon slot for this.
Add a second, dummy weapon (I'd use weapontype=melee; for this) with no damage and the 'inner range' you want.
Then, in the script...
Code: Select all
//At the start of the script
static-var innerRange;
//further down
AimWeapon1(heading, pitch)
{
//standard aiming stuff here
if(innerRange==1)
{
set CHANGE_TARGET to 1;
}
return(TRUE);
}
VarReset()
{
sleep 100;
innerRange=0;
}
AimWeapon2(heading, pitch)
{
innerRange = 1;
start-script VarReset();
return(TRUE);
}
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Minimum distance possible for artillery pieces?
minbarrelangle = "-25", Weapon tag... iirc this is prolly what you're looking for.
Re: Minimum distance possible for artillery pieces?
Minbarrelangle is aesthetic, not functional.
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Minimum distance possible for artillery pieces?
Ok, so I'll conclude that it's kindof possible to vaguely fudge it possibly, but far from trivial.
Re: Minimum distance possible for artillery pieces?
If the arty is big enough, it's trivial to keep it from aiming low or aiming vertically enough; it just needs an if angle < blah in the script. All the posts here have been about setting a specific range, which is tricky.
Re: Minimum distance possible for artillery pieces?
Why don't we have a minimum range tag that just works?
- Guessmyname
- Posts: 3301
- Joined: 28 Apr 2005, 21:07
Re: Minimum distance possible for artillery pieces?
Oh please. Simple, easily understood ways of implementing things are for lazy people! Real men do things the HARD WAY!
- hughperkins
- AI Developer
- Posts: 836
- Joined: 17 Oct 2006, 04:14
Re: Minimum distance possible for artillery pieces?
Oh, so you're saying it's relatively easy to make sure that an artillery piece can't shoot units near it, just not really easy to control precisely what is meant by "near"?lurker wrote:If the arty is big enough, it's trivial to keep it from aiming low or aiming vertically enough; it just needs an if angle < blah in the script. All the posts here have been about setting a specific range, which is tricky.
- Guessmyname
- Posts: 3301
- Joined: 28 Apr 2005, 21:07
Re: Minimum distance possible for artillery pieces?
You could also do that with a vertical fire-arc using a really big cone > 180 degreeslurker wrote:If the arty is big enough, it's trivial to keep it from aiming low or aiming vertically enough; it just needs an if angle < blah in the script. All the posts here have been about setting a specific range, which is tricky.
Re: Minimum distance possible for artillery pieces?
Well, did OTA have a tag for doing so? I just thought it was weird the SY's didn't have it in their original design.
Re: Minimum distance possible for artillery pieces?
Yes, it had.REVENGE wrote:Well, did OTA have a tag for doing so?
Re: Minimum distance possible for artillery pieces?
No it didn't. 
Re: Minimum distance possible for artillery pieces?
This isn't quite what it appears to be :) This script will cause the arty to jam if an enemy approaches it, even if it was firing at some other target (that stayed outside of the min range). Might be useful for some mods (for ex. if you want your melee units to be able to block enemy shooters from firing).Guessmyname wrote:...Okay, this is entirely theoretical, but...
Set up your artillery weapon as normal. Use the 1st weapon slot for this.
Add a second, dummy weapon (I'd use weapontype=melee; for this) with no damage and the 'inner range' you want.
Then, in the script... (an example script)
If you want to check for minimum range, do it in the AimWeaponX script for the arty weapon, use get TARGET_ID to find out which unit it targets, and then use get UNIT_XZ on that unit and the firing unit to calculate the distance. That's probably best kept on long-reload weapons only as all those calls can in theory slow the game down if used on a fast reload spammable units.
Re: Minimum distance possible for artillery pieces?
Lets not forget the obligatory lua script that draws the minimum distance to stop users complaining about bugs that arent really bugs at all
Re: Minimum distance possible for artillery pieces?
Then how comes guardian, thuds, and bertha, cannot fire at their feet? And that when you force fire them too close, then they go into the mode where they have extra range but you have to aim manually? (Gnug tip #41)FLOZi wrote:No it didn't.
Re: Minimum distance possible for artillery pieces?
Bug with TA's aiming code
Re: Minimum distance possible for artillery pieces?
What you call a bug, I call a feature!
