Page 1 of 1

How to restrict units from turning?

Posted: Sun Apr 28, 2013 6:23 pm
by GottaLove88s
Is there a way to prevent certain units (or all units of a given class, eg.152mm Coast Guns) from turning?

And then limiting their firing angle to, say, 60 degrees either side of front? (ie. blind to the sides and behind).

The 152mm Coastal Guns that I've added to Ouistreham and Sword beaches are, frankly, too nimble at shooting behind and to their sides, so they're proving indecently good at taking out tanks that should be able to sneak up from non-facing directions... Players would be able to choose the facing direction during deployment, but once they're deployed, that's the way they'll face...

Re: How to restrict units from turning?

Posted: Mon Apr 29, 2013 11:57 am
by Amaris
GottaLove88s wrote:Is there a way to prevent certain units (or all units of a given class, eg.152mm Coast Guns) from turning?
Yes with changing the script TURN.BSF:

original CHECK_ALL_TURN:

Code: Select all

FUNCTION CHECK_ALL_TURN(me, unit, tilex, tiley) 
{
int ret ;

	// turns are free
	ret = 0 ;
	
	if( GetDistanceFromUnit(me, tilex, tiley) != 1)
	{
		ret = -2 ;
	}
	
	// StartString() ;
	// PrintStringLiteral("LOS CHECK") ;
	// PrintInt( GetUnitLOS( me, tilex, tiley) ) ;
	// AddTileTooltip() ;
	
	// ret = -1 ;
	
	return ret ;
}
So modify it for have :

Code: Select all

FUNCTION CHECK_ALL_TURN(me, unit, tilex, tiley) 
{
int ret ;

	// turns are free
	ret = 0 ;
	
	if( GetDistanceFromUnit(me, tilex, tiley) != 1)
	{
		ret = -2 ;
	}
	
	if ((IsUnitType(me, "XXXXXXX") == 1)
	{
		ret = -2;
	}
	
	// StartString() ;
	// PrintStringLiteral("LOS CHECK") ;
	// PrintInt( GetUnitLOS( me, tilex, tiley) ) ;
	// AddTileTooltip() ;
	
	// ret = -1 ;
	
	return ret ;
}
}
Where 'XXXX' is the name of desired unit in squad.csv.