Code: Select all
include "Functions.BSF"
// called at the start of every turn.
// You would tend to use this for events
FUNCTION StartTurn(side)
{
int i ;
int x ;
int y ;
int id ;
int playerCount ;
if (GetTurn() == -1 )
{
// Setup VPs, damaged tiled, ...
PreBattleSetup() ;
}
else
{
// Check if any victory conditions are met
VictoryConditions() ;
}
// Reinforcements
if( (GetTurn() == 1) )
{
if(side == 1)
{
// AddUnit with more options : FUNCTION PlaceUnit(x, y, facing, side, team, type)
PlaceUnit(42, 62, 4, 1, 0, "German_truck") ;
PlaceUnit(42, 79, 8, 1, 0, "German_Infantry") ;
PlaceUnit(42, 63, 4, 1, 0, "German_truck") ;
PlaceUnit(42, 78, 8, 1, 0, "German_Infantry") ;
ShowUIScreenX( "BattleHead0", "Anim1", "IDS_REINF", "BHead0Image:pilot_head") ;
AddVizCamCenter(42, 62);
}
}
if( (GetTurn() == 2) )
{
if(side == 1)
{
// AddUnit with more options : FUNCTION PlaceUnit(x, y, facing, side, team, type)
PlaceUnit(24, 48, 7, 1, 0, "GERMAN_INFANTRY") ;
PlaceUnit(26, 48, 7, 1, 0, "GERMAN_INFANTRY") ;
PlaceUnit(24, 50, 4, 1, 0, "WAFFEN_SS") ;
PlaceUnit(26, 50, 4, 1, 0, "WAFFEN_SS") ;
ShowUIScreenX( "BattleHead0", "Anim1", "IDS_REINF", "BHead0Image:pilot_head") ;
AddVizCamCenter(25, 49);
}
}
if(side == 1)
{
}
if(side == 0)
{
}
}
FUNCTION PreBattleSetup()
{
//For instance, play with the us (1) and german (4) sides
SetGlobal("gNation0", 1) ;
SetGlobal("gNation1", 4) ;
//Victory Points
SetGlobal("vp1", 0) ;
SetGlobal("vp2", 1) ;
SetGlobal("vp3", 1) ;
SetGlobal("vp4", 1) ;
//Here we place the flags and the text in the vp
//x1,x2,x3 are the coordinates
//you must add to the text1 file these lines:
//example: IDS_LOC_German_Base, "GERMAN BASE",
//example: IDS_LOC_US_Base, "US BASE",
//changing the names and the content at will
ShowTextMarker(1, 37, 18, "IDS_LOC_US_FWD_BASE", 8, "FFFFFF", 1);
ShowTextMarker(2, 40, 35, "IDS_LOC_BRIDGE_RED", 8, "FFFFFF", 1);
ShowTextMarker(3, 28, 34, "IDS_LOC_BRIDGE_GOLD", 8, "FFFFFF", 1);
ShowTextMarker(4, 34, 59, "IDS_LOC_GERMAN_HQ", 8, "FFFFFF", 1);
// Amount of VPs held by player:
SetGlobal("vps", 1) ;
}
FUNCTION VictoryConditions()
{
int i ;
int j ;
int id ;
int counter ;
if (GetGlobal("vps") == 3)
{
EndBattle(0) ;
}
if (GetGlobal("vps") == 0)
{
EndBattle(1) ;
}
}
// called every game tick.
// You would tend to use this for reactive logic and
// win situations etc
FUNCTION Tick(side)
{
CheckVP(-1, GetGlobal("vp1"), 37, 18) ;
CheckVP(-2, GetGlobal("vp2"), 40, 35) ;
CheckVP(-3, GetGlobal("vp3"), 28, 34) ;
CheckVP(-4, GetGlobal("vp4"), 34, 59) ;
}
// this callback allows us to display any misc data we want on the screen
FUNCTION DrawScenarioUI()
{
int turns ;
int i ;
int id ;
int kills ;
// only draw in our turn
if( GetCurrentSide() == 0 )
{
// work out how many of the enemy we have killed
// we will display it later
for(i=0; i<GetUnitCount> 0 )
{
PrintString("IDS_TURNS") ;
PrintStringLiteral(": ") ;
turns = GetGlobal("gSkirmishTurns") - GetTurn() ;
turns /= 2 ;
// deal with any overflow
if(turns < 0)
{
turns = 0 ;
}
// print out the value of the variable to the string
PrintInt(turns) ;
}
else
{
// otherwise just show a normal turn counter
PrintString("IDS_TURN_COUNTER") ;
PrintStringLiteral(": ") ;
turns = GetTurn() ;
// remember - a turn for each side
turns /= 2 ;
PrintInt(turns) ;
}
// add our kill count to the string
// 2 newlines
PrintStringLiteral("\n\n") ;
PrintString("IDS_KILL_COUNTER") ;
PrintStringLiteral(": ")
PrintInt(kills) ;
// now render the string to the screen, remembering that all coordinates
// are based on a nominal 1024x768 screen size.
RenderString(12, 90, 5, "fffee37c", "ff000000") ;
}
}
FUNCTION WIN_SCENARIO_CALLBACK(winner)
{
// use the normal logic of last man standing
// if we win because of the turn limit, we will never call this
return winner ;
}