Can anyone give me advice as to what is wrong with this reinforcement script?
I am trying to set "i" and "j" variables as random turn values then call reinforcements based on them:
FUNCTION StartTurn(side)
{
if ( GetTurn() == GetGlobal("i"))
{
if (GetCurrentSide() == 1)
{
PlaceUnit(16, 21, 4, 1, 0, "panther");
// only show for active side
if ( GetShowSide() == GetCurrentSide() )
{
AddVizCamCenter(30, 64);
ShowUIScreenX( "BattlePop0", "Anim1", "IDS_REINF_GE1", "BP0Image:german_infantry_head") ;
SetGlobal("i", GetGlobal("i")+1);
}
}
}
if ( GetTurn() == GetGlobal("i"))
{
if (GetCurrentSide() == 0)
{
PlaceUnit(16, 66, 2, 0, 0, "m10");
// only show for active side
if ( GetShowSide() == GetCurrentSide() )
{
AddVizCamCenter(16, 66);
ShowUIScreenX( "BattlePop0", "Anim1", "IDS_REINF_US1", "BP0Image:US_infantry_head") ;
}
}
}
}
FUNCTION PreBattleSetup()
{
// set random turns for reinforcements, for now
SetGlobal("i", Rand(3, 9);
SetGlobal("j", Rand(7, 12);
}
reinforcement script help
Moderators: Slitherine Core, BA Moderators
-
- Colonel - Fallschirmjäger
- Posts: 1423
- Joined: Fri Nov 05, 2010 12:02 am
- Location: Bradenton, Florida
Re: reinforcement script help
I notice I have this:
SetGlobal("i", Rand(3, 9);
SetGlobal("j", Rand(7, 12);
Instead of this:
SetGlobal("i", Rand(3, 9));
SetGlobal("j", Rand(7, 12));
a couple missing parenthesis. but, the script did not fail.
so could it be that? or an error in my logic or variable/function calls.
Thanks
SetGlobal("i", Rand(3, 9);
SetGlobal("j", Rand(7, 12);
Instead of this:
SetGlobal("i", Rand(3, 9));
SetGlobal("j", Rand(7, 12));
a couple missing parenthesis. but, the script did not fail.
so could it be that? or an error in my logic or variable/function calls.
Thanks
-
- Site Admin
- Posts: 9714
- Joined: Wed Mar 23, 2005 10:35 pm
Re: reinforcement script help
Are you actually calling PreBattleSetup anywhere?
Cheers
Pip
Cheers
Pip
follow me on Twitter here
-
- Colonel - Fallschirmjäger
- Posts: 1423
- Joined: Fri Nov 05, 2010 12:02 am
- Location: Bradenton, Florida
Re: reinforcement script help
Ha! Pip you are a wise and gentle soul. Look here:
include "Functions.BSF"
include "tools.BSF"
include "E_FUNCTIONS.BSF"
include "promo.bsf"
// called at the start of every turn.
// You would tend to use this for events
FUNCTION StartTurn(side)
{
Smoke (side);
// if (GetTurn() == -1 )
// {
// PreBattleSetup () ;
//
// }
//
// if it is turn 0 or 1, i.e. the first turn for each player, show the briefing message.
//
if( (GetTurn() == 0 ) || ( GetTurn() == 1 ) )
{
// only show for active side
if ( GetShowSide() == GetCurrentSide() )
{
ShowUIScreenX( "BattlePop0", "Anim1", "IDS_MALMEDY_INTRO", "BP0Image:US_infantry_head") ;
}
}
}
Alas, I at some earlier point disabled that function, during trouble, and I added the "//"s
Will report shortly if that was all that is wrong, hee hee! Sorry about that
include "Functions.BSF"
include "tools.BSF"
include "E_FUNCTIONS.BSF"
include "promo.bsf"
// called at the start of every turn.
// You would tend to use this for events
FUNCTION StartTurn(side)
{
Smoke (side);
// if (GetTurn() == -1 )
// {
// PreBattleSetup () ;
//
// }
//
// if it is turn 0 or 1, i.e. the first turn for each player, show the briefing message.
//
if( (GetTurn() == 0 ) || ( GetTurn() == 1 ) )
{
// only show for active side
if ( GetShowSide() == GetCurrentSide() )
{
ShowUIScreenX( "BattlePop0", "Anim1", "IDS_MALMEDY_INTRO", "BP0Image:US_infantry_head") ;
}
}
}
Alas, I at some earlier point disabled that function, during trouble, and I added the "//"s
Will report shortly if that was all that is wrong, hee hee! Sorry about that
Last edited by jcb989 on Sat Jul 19, 2014 12:27 am, edited 1 time in total.
-
- Colonel - Fallschirmjäger
- Posts: 1423
- Joined: Fri Nov 05, 2010 12:02 am
- Location: Bradenton, Florida
Re: reinforcement script help
oddly that did not seem to be the only problem. no script errors, only ineffective code lol.. still trying to figure it out.
-
- Colonel - Fallschirmjäger
- Posts: 1423
- Joined: Fri Nov 05, 2010 12:02 am
- Location: Bradenton, Florida
Re: reinforcement script help
I figured it out thanks Pip. My reinforcement logic was outside the last bracket, } for the StartTurn() function! Oops... hell of a way to waste a couple hours of debug.