HOW TO : Start the Scenario with Veteran or Elite Units

Download scenarios and talk about scenario design.

Moderators: Slitherine Core, BA Moderators

Post Reply
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

HOW TO : Start the Scenario with Veteran or Elite Units

Post by Merr »

This code allows ALL your Units to begin the scenario at either Veteran or Elite status.
No longer need to include the DrillSgt bonus card (if you were using the card for that design intention).

Cut and paste the code into your scenarios BSF, in the FUNCTION StartTurn(side), at very end.
Adding it at the end ensures that any units placed in turn (-1) before this code are ALL promoted.
I added comments to help understand the code if you want to ; change sides, only promote specific units, or only promote to veteran level. (default is Elite).

Hope this helps !
Enjoy!

Code: Select all

	//  Now we need to Promote all of side 0 units before game starts
	if( GetTurn() == -1 )
	{
	int id ;
	int i ;
	int x ;
	int y ;
	
		id = GetUnitID(0, i) ; // setting the id to side 0

		for ( x=GetUnitX(id) ; x < GetMapWidth() ; x++)
		{
			for ( y=GetUnitY(id) ; y < GetMapHeight() ; y++)
			{
				if(id != -1)  // use ID from Squads.csv to promote specific unit
				{
					// promote to Elite
					if( GetUnitStatus(id) < 2) // to promote to veteran use,  if( GetUnitStatus(id) < 1)
					{
						for(i=0; i<GetUnitCount(0);i++)
						{
							id = GetUnitID(0, i) ;  // again, sets id to side 0
						
							if ( ( x >= 0 ) && ( x < GetMapWidth()) && ( y >= 0 ) && ( y < GetMapHeight()) )
							{
							// Level up all units 
							CallUnitFunctionDirect(id, "GainExperience", id, -1) ;
							}
						}
					}
				}
			}
		}
	}
Last edited by Merr on Mon Sep 13, 2010 8:16 pm, edited 1 time in total.
adherbal
The Artistocrats
The Artistocrats
Posts: 3900
Joined: Fri Jun 24, 2005 6:42 pm
Location: Belgium

Post by adherbal »

IIRC you can press 1-2-3 while hovering over a unit to set its level in the editor? Unless that's not what you wanted to achieve.
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

adherbal wrote:IIRC you can press 1-2-3 while hovering over a unit to set its level in the editor? Unless that's not what you wanted to achieve.
That doesn't appear to work (for me at least).

What mode do you have to be in?
adherbal
The Artistocrats
The Artistocrats
Posts: 3900
Joined: Fri Jun 24, 2005 6:42 pm
Location: Belgium

Post by adherbal »

Unit mode. Use the numeric keys on the left side of the keyboard, not the numpad keys.
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

adherbal wrote:Unit mode. Use the numeric keys on the left side of the keyboard, not the numpad keys.
Ok ... Thanks!

The trick is .... BEFORE ADDING THE UNIT ... hold the numeric key down.

Oh well .... :oops:

Perhaps the code can be used in other aspects, such as during the game on a particular turn.
Of course, there are a billion ways to code it.

I'm such a noob.
pipfromslitherine
Site Admin
Site Admin
Posts: 9929
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

That shouldn't be necessary - I'll double check, but you should only need to hover over the unit and press the key.

Cheers

Pip
Post Reply

Return to “Battle Academy : Scenario Design”