"Freezing" units for a turn.

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
Navaronegun
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 946
Joined: Sun Sep 22, 2013 5:39 pm
Location: Arizona, USA -7 GMT

"Freezing" units for a turn.

Post by Navaronegun »

Does anyone know how to immobilize on map units for a turn? I'm simulating an offensive where one side is surprised, and only a few units can move. Its PBEM, so AI commands are of no use. It would be at the beginning of the scenario, preventing units from moving but releasing units for movement on a later turn.

Thanks,

Nav
I think the best way to describe our operations to date is that they have violated every recognized principle of war.
General Eisenhower, Supreme Commander Allied Expeditionary Force, on the Tunisian Campaign, 27 DEC 1942.
Amaris
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 929
Joined: Fri Jul 23, 2010 11:08 am
Location: France
Contact:

Re: "Freezing" units for a turn.

Post by Amaris »

Well may be with a specific function called on PreBattleSetup() into the scenario .bsf file ?

But this will be set 0 to AP to ALL units of the specified side.
So I you want to have some unit active on the 1st turn, you must re-active them by a code like as:

Code: Select all

FUNCTION DISABLE_SIDE(side)
{
int max;
int count;
int unit;

	//Set 0 AP TO ALL UNITS
	max = GetUnitCount(side);
	
	for (count = 0 ; count < max; count++)
	{
		unit = GetUnitID(side, count);
		if (IsUnitValid(unit) == 1)
		{
			SetAttrib(unit, "AP", 0);
		}
	}
	
	// Set BASE AP FOR THE SPECIFIC UNIT
	
	unit = GetUnitOnTile(TILE_X, TILE_Y);
	if (IsUnitValid(unit) == 1)
	{
		SetAttrib(unit, "AP", GetBaseAttrib(unit, "AP));
	}	
	
	.....
}
You must specific the TILE_X and TILE_Y of each unit which is active.
“Take care, my friend; watch your six, and do one more roll… just for me.”
Navaronegun
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 946
Joined: Sun Sep 22, 2013 5:39 pm
Location: Arizona, USA -7 GMT

Re: "Freezing" units for a turn.

Post by Navaronegun »

Merci, Amaris.
I think the best way to describe our operations to date is that they have violated every recognized principle of war.
General Eisenhower, Supreme Commander Allied Expeditionary Force, on the Tunisian Campaign, 27 DEC 1942.
Navaronegun
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 946
Joined: Sun Sep 22, 2013 5:39 pm
Location: Arizona, USA -7 GMT

Re: "Freezing" units for a turn.

Post by Navaronegun »

Amaris wrote:Well may be with a specific function called on PreBattleSetup() into the scenario .bsf file ?

But this will be set 0 to AP to ALL units of the specified side.
So I you want to have some unit active on the 1st turn, you must re-active them by a code like as:

Code: Select all

FUNCTION DISABLE_SIDE(side)
{
int max;
int count;
int unit;

	//Set 0 AP TO ALL UNITS
	max = GetUnitCount(side);
	
	for (count = 0 ; count < max; count++)
	{
		unit = GetUnitID(side, count);
		if (IsUnitValid(unit) == 1)
		{
			SetAttrib(unit, "AP", 0);
		}
	}
	
	// Set BASE AP FOR THE SPECIFIC UNIT
	
	unit = GetUnitOnTile(TILE_X, TILE_Y);
	if (IsUnitValid(unit) == 1)
	{
		SetAttrib(unit, "AP", GetBaseAttrib(unit, "AP));
	}	
	
	.....
}
You must specific the TILE_X and TILE_Y of each unit which is active.
Is "(unit)" the Number or the UNITID name from the Squads.CSV,m or is it just "(unit)"?
I think the best way to describe our operations to date is that they have violated every recognized principle of war.
General Eisenhower, Supreme Commander Allied Expeditionary Force, on the Tunisian Campaign, 27 DEC 1942.
jcb989
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1423
Joined: Fri Nov 05, 2010 12:02 am
Location: Bradenton, Florida

Re: "Freezing" units for a turn.

Post by jcb989 »

Amaris wrote:You must specific the TILE_X and TILE_Y of each unit which is active.
That will be tough, if anything moved. lol.

I was thinking about this type of code for a Pearl Harbor scenario for your Pacific mod.
Instead I suppose the right thing to do is surround most of the ships with coastal water, so they can't move..
Navaronegun
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 946
Joined: Sun Sep 22, 2013 5:39 pm
Location: Arizona, USA -7 GMT

Re: "Freezing" units for a turn.

Post by Navaronegun »

jcb989 wrote:
Amaris wrote:You must specific the TILE_X and TILE_Y of each unit which is active.
That will be tough, if anything moved. lol.

I was thinking about this type of code for a Pearl Harbor scenario for your Pacific mod.
Instead I suppose the right thing to do is surround most of the ships with coastal water, so they can't move..
That does sound tough. It'd have to be units which have zero chance of contact. Unless there is an "if" for "unit fired upon" or "has LOS of enemy unit"?
I think the best way to describe our operations to date is that they have violated every recognized principle of war.
General Eisenhower, Supreme Commander Allied Expeditionary Force, on the Tunisian Campaign, 27 DEC 1942.
Amaris
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 929
Joined: Fri Jul 23, 2010 11:08 am
Location: France
Contact:

Re: "Freezing" units for a turn.

Post by Amaris »

Well my script is to freeze the units on the start of the battles only. :wink:
“Take care, my friend; watch your six, and do one more roll… just for me.”
LandMarine47
Major-General - Tiger I
Major-General - Tiger I
Posts: 2490
Joined: Sun Oct 28, 2012 10:44 pm
Location: Texas

Re: "Freezing" units for a turn.

Post by LandMarine47 »

Pearl Harbor? I doubt the US would win that one.... Too many bombers.... Unless we have (unrealistic) fighter escorts or AA guns nearby! Best that be a Japanese scenario
jcb989
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1423
Joined: Fri Nov 05, 2010 12:02 am
Location: Bradenton, Florida

Re: "Freezing" units for a turn.

Post by jcb989 »

Well I was thinking something for single player, lol. something with a goal of how many battleships get sunk, I figured have DD protecting them in harbor.
LandMarine47
Major-General - Tiger I
Major-General - Tiger I
Posts: 2490
Joined: Sun Oct 28, 2012 10:44 pm
Location: Texas

Re: "Freezing" units for a turn.

Post by LandMarine47 »

jcb989 wrote:Well I was thinking something for single player, lol. something with a goal of how many battleships get sunk, I figured have DD protecting them in harbor.
I doubt the DD would save those Battleships! But you never know what an American is capable of :)
Post Reply

Return to “Battle Academy : Modders Corner ”