Page 1 of 1
"Freezing" units for a turn.
Posted: Sun Nov 24, 2013 9:28 pm
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
Re: "Freezing" units for a turn.
Posted: Mon Nov 25, 2013 11:06 am
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.
Re: "Freezing" units for a turn.
Posted: Mon Nov 25, 2013 12:46 pm
by Navaronegun
Merci, Amaris.
Re: "Freezing" units for a turn.
Posted: Mon Nov 25, 2013 6:53 pm
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)"?
Re: "Freezing" units for a turn.
Posted: Wed Nov 27, 2013 8:34 pm
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..
Re: "Freezing" units for a turn.
Posted: Wed Nov 27, 2013 9:19 pm
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"?
Re: "Freezing" units for a turn.
Posted: Thu Nov 28, 2013 11:04 am
by Amaris
Well my script is to freeze the units on the start of the battles only.

Re: "Freezing" units for a turn.
Posted: Tue Jan 14, 2014 5:42 pm
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
Re: "Freezing" units for a turn.
Posted: Thu Jan 16, 2014 12:56 am
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.
Re: "Freezing" units for a turn.
Posted: Thu Jan 16, 2014 3:02 am
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
