Page 1 of 1

Defending a line

Posted: Fri Feb 16, 2018 12:48 am
by Odenathus
Hi again

I want side 1,Team 5 to defend a line of wagons, so initially set them to 64. The line runs from 39,47 to 39,26.

After (if) the line is breached by any of Side 0 except light troops, Team 5 needs to be released to attack them wherever they are on general attack 16, + ignoring light troops 128: is this...

{
if(side==0)
{IfPlayerUnitIn(39,47,39,26,1)==1)
{MoveTeamCoord(1,5,-1-1,144);
}
}
}

Cheers

Re: Defending a line

Posted: Fri Feb 16, 2018 8:16 am
by rbodleyscott
Odenathus wrote:Hi again

I want side 1,Team 5 to defend a line of wagons, so initially set them to 64. The line runs from 39,47 to 39,26.

After (if) the line is breached by any of Side 0 except light troops, Team 5 needs to be released to attack them wherever they are on general attack 16, + ignoring light troops 128: is this...

{
if(side==0)
{IfPlayerUnitIn(39,47,39,26,1)==1)
{MoveTeamCoord(1,5,-1-1,144);
}
}
}

Cheers
Looks about right to me. Try it and let me know if it doesn't work as you wish.

Re: Defending a line

Posted: Fri Feb 16, 2018 10:36 pm
by Odenathus
No joy unfortunately, the BSF accepted the script after some wrestling with the right number of {, but it didn't affect Team 5's actions in the battle, they weren't triggered by Side 0's units entering that area..

Do I dimly remember from our P&S days that these areas can't be single lines, but have to be a box, i.e. at least one square wide/deep? I may be making that up.

Re: Defending a line

Posted: Sat Feb 17, 2018 12:16 am
by rbodleyscott
Odenathus wrote:No joy unfortunately, the BSF accepted the script after some wrestling with the right number of {, but it didn't affect Team 5's actions in the battle, they weren't triggered by Side 0's units entering that area..
Best email me the scenario and let me try it. Or at least the scripts.

Re: Defending a line

Posted: Sat Mar 17, 2018 1:16 pm
by Paul59
Odenathus wrote:Hi again

I want side 1,Team 5 to defend a line of wagons, so initially set them to 64. The line runs from 39,47 to 39,26.

After (if) the line is breached by any of Side 0 except light troops, Team 5 needs to be released to attack them wherever they are on general attack 16, + ignoring light troops 128: is this...

{
if(side==0)
{IfPlayerUnitIn(39,47,39,26,1)==1)
{MoveTeamCoord(1,5,-1-1,144);
}
}
}

Cheers
I think "if(side==0)" should actually read "if(side==1)". That might be the problem?

Re: Defending a line

Posted: Mon Mar 19, 2018 12:36 am
by Odenathus
That was it Paul, Richard solved via a direct e-mail. Ta.