How to prevent bombard unit firing behind?
Moderators: Slitherine Core, BA Moderators
-
GottaLove88s
- Lieutenant-General - Do 217E

- Posts: 3151
- Joined: Fri Apr 06, 2012 6:18 pm
- Location: Palau
How to prevent bombard unit firing behind?
Is there a way to limit the arc of bombardment so that a certain unit-type can only bombard 75 degrees either side of the direction that it is facing...?
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
-
pipfromslitherine
- Site Admin

- Posts: 9928
- Joined: Wed Mar 23, 2005 10:35 pm
Re: How to prevent bombard unit firing behind?
Hmmm - I don't think so. There isn't really any concept of fixed orientation units IIRC. You could potentially do it by re-writing its scripts to remove any attempts to turn-to-face the enemy, but that's not a simple job 
Cheers
Pip
Cheers
Pip
-
Amaris
- Captain - Heavy Cruiser

- Posts: 929
- Joined: Fri Jul 23, 2010 11:08 am
- Location: France
- Contact:
Re: How to prevent bombard unit firing behind?
Um well I would not want to contradict Pip
but I think it's easy to make.
Just modify the CHECK_ALL_INDIRECT_FIRE() function in the IndirectFire.BSF:
And remplace MYUNIT by your string unit desired.

Just modify the CHECK_ALL_INDIRECT_FIRE() function in the IndirectFire.BSF:
Code: Select all
FUNCTION CHECK_ALL_INDIRECT_FIRE(me, tilex,tiley, unit)
{
int ret ;
int distance ;
ret = -2 ;
//NO REAR BOMBARD FOR MYUNIT
if (IsUnitType(me, "MYUNIT") == 1)
{
if (GetAngleFromTile(tilex,tiley, me) > 90)
{
return ret;
}
}
//END OF NO REAR BOMBARD FOR MYUNIT
if ( ( GetAttrib(me, "BOMBARD_SHOTS") > 0 ) && ( GetAttrib(me, "AP") >= GetBaseAttrib (me, "AP") ) )
{
if( (GetUnitSide(me) != GetUnitSide(unit) ) && ( IsUnitSuppressed(me) == 0 ) )
{
ret = -1 ;
if ( ( GetAttrib (me, "Shots") >= GetBaseAttrib (me, "Shots") ) && ( GetAttrib (me, "BombardReload") == 0 ) )
{
distance = GetDistanceFromUnit(me, tilex, tiley) ;
if ( ( distance <= GetAttrib(me, "BombardRange") ) && ( distance >= GetAttrib(me, "MinRange") ) )
{
ret = GetAttrib(me, "BOMBARD_SHOTS") ;
}
}
}
}
return ret ;
}
“Take care, my friend; watch your six, and do one more roll… just for me.”
-
pipfromslitherine
- Site Admin

- Posts: 9928
- Joined: Wed Mar 23, 2005 10:35 pm
Re: How to prevent bombard unit firing behind?
Yes, that would work I think. But that does require custom scripts.
Cheers
Pip
Cheers
Pip
-
GottaLove88s
- Lieutenant-General - Do 217E

- Posts: 3151
- Joined: Fri Apr 06, 2012 6:18 pm
- Location: Palau
Re: How to prevent bombard unit firing behind?
That's pretty cute code, Amaris! Nice.
How is GetAngleFromTile calculated? Is 0 degrees the DirectionFacing?
How is GetAngleFromTile calculated? Is 0 degrees the DirectionFacing?
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
-
Amaris
- Captain - Heavy Cruiser

- Posts: 929
- Joined: Fri Jul 23, 2010 11:08 am
- Location: France
- Contact:
Re: How to prevent bombard unit firing behind?
0: looking straight me
90: side
180: behind
90: side
180: behind
“Take care, my friend; watch your six, and do one more roll… just for me.”
-
GottaLove88s
- Lieutenant-General - Do 217E

- Posts: 3151
- Joined: Fri Apr 06, 2012 6:18 pm
- Location: Palau
Re: How to prevent bombard unit firing behind?
So all we need to do is...
...combine the limitation on bombardment angles above...
...with your limitation on turning (here -> viewtopic.php?f=104&t=42205#p397971)...
...and a defender will never be able to bombard behind.
PERFECT!!
Is there an equivalent code to put the same limitation on direct fire in AP or HE mode?
...combine the limitation on bombardment angles above...
...with your limitation on turning (here -> viewtopic.php?f=104&t=42205#p397971)...
...and a defender will never be able to bombard behind.
PERFECT!!
Is there an equivalent code to put the same limitation on direct fire in AP or HE mode?
SCENARIO LINKS
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
Seelow'45 -> www.slitherine.com/forum/viewtopic.php?f=313&t=55132
Normandy'44 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42094
Dieppe'42 -> www.slitherine.com/forum/viewtopic.php?f=87&t=42347
-
Amaris
- Captain - Heavy Cruiser

- Posts: 929
- Joined: Fri Jul 23, 2010 11:08 am
- Location: France
- Contact:
Re: How to prevent bombard unit firing behind?
Well, well. Yes I suppose.GottaLove88s wrote:So all we need to do is...
...combine the limitation on bombardment angles above...
...with your limitation on turning (here -> viewtopic.php?f=104&t=42205#p397971)...
...and a defender will never be able to bombard behind.
PERFECT!!
Is there an equivalent code to put the same limitation on direct fire in AP or HE mode?
Simply add to CHECK_UNIT_FIREAP function (Fire_AP.BSF) and CHECK_UNIT_FIREHE function (Fire_HE.BSF) the following code:
Code: Select all
if (IsUnitType(me, "MYUNIT") == 1)
{
if (GetAngleFromTile(tilex,tiley, me) > 90)
{
return ret;
}
}
“Take care, my friend; watch your six, and do one more roll… just for me.”