I'm giving you special mention in the credits for your troubles! I'd be lost without you buddy.
A few general design questions
Moderators: Slitherine Core, BA Moderators
-
pipfromslitherine
- Site Admin

- Posts: 9925
- Joined: Wed Mar 23, 2005 10:35 pm
-
pipfromslitherine
- Site Admin

- Posts: 9925
- Joined: Wed Mar 23, 2005 10:35 pm
-
pipfromslitherine
- Site Admin

- Posts: 9925
- Joined: Wed Mar 23, 2005 10:35 pm
-
pipfromslitherine
- Site Admin

- Posts: 9925
- Joined: Wed Mar 23, 2005 10:35 pm
-
pipfromslitherine
- Site Admin

- Posts: 9925
- Joined: Wed Mar 23, 2005 10:35 pm
They are just updated on the Modding Portal, the Engine Documentation is what you want, near the bottom of the page.
http://www.slitherine.com/modding/bbc_ba_pc
Cheers
Pip
http://www.slitherine.com/modding/bbc_ba_pc
Cheers
Pip
if you are including Functions.BSF you can use PlaceUnit function:When bringing in reinforcements via a script, what command would I use to bring in a transport, a US halftrack, for example, with infantry already inside when it appears on the map?
PlaceUnit(x, y, facing, side, team, type) ;
The facing parameter allows you to define the unit's orientation (in steps of 45° with the values 0 to 7). But if you use "8" for the facing it will attempt to load the unit into the last unit created with a "PlaceUnit" command.
For example:
PlaceUnit(16, 16, 0, 0, 0, "SDKFZ251_HALFTRACK") ; // creates a halftrack
PlaceUnit(0, 0, 8, 0, 0, "GERMAN_ENGINEER") ; // creates german engineers and loads it into previous unit = the halftrack
Note that you must place the to-be-loaded infantry unit on an unoccupied tile. The best way is to use a tile outside of the map borders - for example (0,0) - because those are always unoccupied (unless you've actualy put a unit there). If a previous unit exists it will be loaded into that no matter how far away it is. If no previous unit exists the to-be-loaded unit will automatically be deleted (you'll never even see it).
Beautiful, thank you! You made it so simple.adherbal wrote:if you are including Functions.BSF you can use PlaceUnit function:When bringing in reinforcements via a script, what command would I use to bring in a transport, a US halftrack, for example, with infantry already inside when it appears on the map?
PlaceUnit(x, y, facing, side, team, type) ;
The facing parameter allows you to define the unit's orientation (in steps of 45° with the values 0 to 7). But if you use "8" for the facing it will attempt to load the unit into the last unit created with a "PlaceUnit" command.
For example:
PlaceUnit(16, 16, 0, 0, 0, "SDKFZ251_HALFTRACK") ; // creates a halftrack
PlaceUnit(0, 0, 8, 0, 0, "GERMAN_ENGINEER") ; // creates german engineers and loads it into previous unit = the halftrack
Note that you must place the to-be-loaded infantry unit on an unoccupied tile. The best way is to use a tile outside of the map borders - for example (0,0) - because those are always unoccupied (unless you've actualy put a unit there). If a previous unit exists it will be loaded into that no matter how far away it is. If no previous unit exists the to-be-loaded unit will automatically be deleted (you'll never even see it).
Here's a question for you:
I'm obviously no scripting genius, but I noticed something interesting. Between the SkipFirstPlayerTurn() command and the Rand(min, max) command, would it be possible to somehow create a random 'who goes first' in a (multiplayer) scenario mechanic?
-
pipfromslitherine
- Site Admin

- Posts: 9925
- Joined: Wed Mar 23, 2005 10:35 pm
I don't think so. The issue would be that who goes first in MP is actually defined by who gets the game first (if that makes sense) and that comes from which side each of you choose. There isn't a way in MP to force the first player to end their turn if it's not their turn (again, if that makes sense). So you could end up playing the wrong side. It's not something I've tried! 
Cheers
Pip
Cheers
Pip
Any idea why I can't get both of these reinforcements to come in?
Note that the turns I have them coming in on are just for testing purposes.
Here's a copy of the .BSF file if needed; it's still work in progress.
http://dl.dropbox.com/u/10165676/RIVER_OF_BLOOD.BSF
Note that the turns I have them coming in on are just for testing purposes.
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 ;
}
Here's a copy of the .BSF file if needed; it's still work in progress.
http://dl.dropbox.com/u/10165676/RIVER_OF_BLOOD.BSF
The problem is this:
if( (GetTurn() == 2) )
{
if(side == 1)
{
...
}
}
GetTurn() returns:
0 = first player turn
1 = first AI turn
2 = second player turn
3 = second AI turn
4 = third player turn
...
So, during GetTurn() == 2, it is always a side 0 (player) turn. So the "if(side == 1)" condition is never true. If you remove this condition the reinforcements will arrive, albeit during the second player's turn, not during an AI turn.
Using both the GetTurn and then the if(side == x) conditions is probably vest avoided, because any specific turn ALWAYS belongs to a specific side. So either both conditions are true or - if not - nothing will happen.
if( (GetTurn() == 2) )
{
if(side == 1)
{
...
}
}
GetTurn() returns:
0 = first player turn
1 = first AI turn
2 = second player turn
3 = second AI turn
4 = third player turn
...
So, during GetTurn() == 2, it is always a side 0 (player) turn. So the "if(side == 1)" condition is never true. If you remove this condition the reinforcements will arrive, albeit during the second player's turn, not during an AI turn.
Using both the GetTurn and then the if(side == x) conditions is probably vest avoided, because any specific turn ALWAYS belongs to a specific side. So either both conditions are true or - if not - nothing will happen.

