Changing base morale using a .BSF?

Download scenarios and talk about scenario design.

Moderators: Slitherine Core, BA Moderators

Post Reply
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Changing base morale using a .BSF?

Post by GottaLove88s »

Guys,

I'm trying to set up a campaign where the Germans will suffer a morale penalty in some games.

Is there a way to change the base morale of units from within a Scenario.BSF?

For example, how could I reduce the base morale of all volksgrenadiers on the map, from 75 to 50? Can it be done?

The other way is to change squads.csv, but then I would end up with one squads.csv for games where the Germans are not penalised, and another squads.csv for the games where the Germans are penalised... I can't figure out how to have more than one squads.csv for different scenarios in the same campaign???

Thanks for any ideas at all... :D
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
Amaris
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 929
Joined: Fri Jul 23, 2010 11:08 am
Location: France
Contact:

Re: Changing base morale using a .BSF?

Post by Amaris »

Easy :

In your scenario.BSF put the following code into the FUNCTION PreBattleSetup():

Code: Select all

FUNCTION PreBattleSetup()
{
...
int side;
int count;
int id;

	for(side=0; side<=1; side++)
	{
		for(count=0; count<GetUnitCount(side); count++)
		{
			id = GetUnitID(side, count) ;
			if ((GetUnitDead(id) == 0) && (IsUnitType(id, "volksgrenadier") == 1))
			{
					SetAttrib(id, "Morale", 50);
			}		
		}
	}
}
“Take care, my friend; watch your six, and do one more roll… just for me.”
GottaLove88s
Lieutenant-General - Do 217E
Lieutenant-General - Do 217E
Posts: 3151
Joined: Fri Apr 06, 2012 6:18 pm
Location: Palau

Re: Changing base morale using a .BSF?

Post by GottaLove88s »

Thanks for your help Amaris.

If I understand, this runs two loops, one for each side, working through all of the units for one side, then the other side.
And I could put different unit types in at the if (IsUnitType(id, "volksgrenadier")==1)) stage.
NICE. :-)

Looking at the code, will this set the current morale to eg. 50?
Or will this set the base morale to 50?
I want to set the base morale.

Un grand merci (comme d'hab! ;-))
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
Amaris
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 929
Joined: Fri Jul 23, 2010 11:08 am
Location: France
Contact:

Re: Changing base morale using a .BSF?

Post by Amaris »

Yeah you can have multiple test like if (IsUnitType(id, "volksgrenadier")==1)) ; changing the type of unit.

The SetAttrib() function attrib a new values on the unit into parameters. So it will set the current morale to 50.
A check anyway by a test.I'm at work now, and I can not test. :P
“Take care, my friend; watch your six, and do one more roll… just for me.”
Post Reply

Return to “Battle Academy : Scenario Design”