Code: Select all
{
if(side==1)
{
If(PlayerUnitIn(30,41,36,36,0,0,1)==1)
{
MoveTeamCoord(1,0,-1,-1,920);
As before, any help appreciated, thanks.
Code: Select all
{
if(side==1)
{
If(PlayerUnitIn(30,41,36,36,0,0,1)==1)
{
MoveTeamCoord(1,0,-1,-1,920);
Code: Select all
// Function to report if any unrouted enemy unit is within the specified rectangle - with optional exclusions.
FUNCTION PlayerUnitIn(x1, y1, x2, y2, excludeFoot, excludeMounted, excludeLights)
Ah, its a rectangle. Adjusting for your advice made it work.rbodleyscott wrote: ↑Tue Aug 14, 2018 8:25 pm
As far as the script is concerned, your rectangle does not exist. You need to specify the coordinates of the lower corner of the rectangle, followed by the coordinates of the higher corner. x2 needs to be higher than x1, and y2 needs to be higher than y1. You need to use 30,36,36,41 not 30,41,36,36. This is probably the reason nothing at all is happening.
An error on my part - that's what I get for trying to do mental maths. Was attempting to add together a few of the 'ignore except close' - upon reflection ignore lights, seek and destroy is all I need.rbodleyscott wrote: ↑Tue Aug 14, 2018 8:25 pm However, I am not sure what you are trying to achieve with an Aggression code of 920. Can you explain?
Yes.rbodleyscott wrote: ↑Tue Aug 14, 2018 8:25 pm Also your MoveTeamCoord() order is to Team 0. Are the AI troops that you want to move in Team 0?
No. PlayerUnitIn() is a function call, not a variable.desicat wrote: ↑Thu Apr 30, 2020 12:28 am I want to do kind of the same thing, but just a line breach instead of a triangle. The AI Team "0" has a code 4 to hold, and I want them to seek and destroy (16, 16+4=20) after the line is breached. This is what I have. Was I supposed to add; "int IfPlayerUnitIn"?
FUNCTION StartTurnPost(side)
{
int IfPlayerUnitIn
// Scenario-specific AI code goes here - you can look at some of the historical scenarios for examples.
if (side == 1)
{
IfPlayerUnitIn(18,33,24,33,1)==1)
{
MoveTeamCoord(1,0,-1,-1,20);
}
}
}
Took it out and still does not work. Error message states; Failed to find IfPlayerUnitIn, did you predefine it?rbodleyscott wrote: ↑Thu Apr 30, 2020 8:02 amNo. IfPlayerUnitIn() is a function call, not a variable.desicat wrote: ↑Thu Apr 30, 2020 12:28 am I want to do kind of the same thing, but just a line breach instead of a triangle. The AI Team "0" has a code 4 to hold, and I want them to seek and destroy (16, 16+4=20) after the line is breached. This is what I have. Was I supposed to add; "int IfPlayerUnitIn"?
FUNCTION StartTurnPost(side)
{
int IfPlayerUnitIn
// Scenario-specific AI code goes here - you can look at some of the historical scenarios for examples.
if (side == 1)
{
IfPlayerUnitIn(18,33,24,33,1)==1)
{
MoveTeamCoord(1,0,-1,-1,20);
}
}
}
desicat wrote: ↑Thu Apr 30, 2020 10:48 amTook it out and still does not work. Error message states; Failed to find IfPlayerUnitIn, did you predefine it?rbodleyscott wrote: ↑Thu Apr 30, 2020 8:02 amNo. IfPlayerUnitIn() is a function call, not a variable.desicat wrote: ↑Thu Apr 30, 2020 12:28 am I want to do kind of the same thing, but just a line breach instead of a triangle. The AI Team "0" has a code 4 to hold, and I want them to seek and destroy (16, 16+4=20) after the line is breached. This is what I have. Was I supposed to add; "int IfPlayerUnitIn"?
FUNCTION StartTurnPost(side)
{
int IfPlayerUnitIn
// Scenario-specific AI code goes here - you can look at some of the historical scenarios for examples.
if (side == 1)
{
IfPlayerUnitIn(18,33,24,33,1)==1)
{
MoveTeamCoord(1,0,-1,-1,20);
}
}
}
That is because the syntax is wrong. The function is called PlayerUnitIn(), not IfPlayerUnitIn().desicat wrote: ↑Thu Apr 30, 2020 10:48 amTook it out and still does not work. Error message states; Failed to find IfPlayerUnitIn, did you predefine it?rbodleyscott wrote: ↑Thu Apr 30, 2020 8:02 amNo. IfPlayerUnitIn() is a function call, not a variable.desicat wrote: ↑Thu Apr 30, 2020 12:28 am I want to do kind of the same thing, but just a line breach instead of a triangle. The AI Team "0" has a code 4 to hold, and I want them to seek and destroy (16, 16+4=20) after the line is breached. This is what I have. Was I supposed to add; "int IfPlayerUnitIn"?
FUNCTION StartTurnPost(side)
{
int IfPlayerUnitIn
// Scenario-specific AI code goes here - you can look at some of the historical scenarios for examples.
if (side == 1)
{
IfPlayerUnitIn(18,33,24,33,1)==1)
{
MoveTeamCoord(1,0,-1,-1,20);
}
}
}
Code: Select all
if (PlayerUnitIn(18,33,24,33,1)==1)
Code: Select all
IfPlayerUnitIn(18,33,24,33,1)==1)
Sorry, at the moment I can't remember what those two 0s do. I did that script over two and a half years ago, I might have got it from one of the Pike and Shot scenarios, if I find it I will let you know.desicat wrote: ↑Thu Apr 30, 2020 6:49 pm Richard, That sort of worked - but then a error code asked for 7 parameters instead of 5.
if (PlayerUnitIn(18,33,24,33,1)==1)
So I looked at Pauls scenario and added the two zeros that he had;
if (PlayerUnitIn(18,33,24,33,0,0,1)==1)
Paul, I have no idea what those two 0's do - but it did run and let me open the editor. Can you tell me what they do? (In your bsf example thread you defined the 5 digits for MoveTeamCoord, but this appears to be different.
I hope to get time to playtest it in the next day or so. Thank you both for the help, I know you are busy.
When using a function you need to find the function definition to see what the parameters mean. In this case the function definition is in MoreScenarioTools.BSFdesicat wrote: ↑Thu Apr 30, 2020 6:49 pm Richard, That sort of worked - but then a error code asked for 7 parameters instead of 5.
if (PlayerUnitIn(18,33,24,33,1)==1)
So I looked at Pauls scenario and added the two zeros that he had;
if (PlayerUnitIn(18,33,24,33,0,0,1)==1)
Paul, I have no idea what those two 0's do - but it did run and let me open the editor. Can you tell me what they do? (In your bsf example thread you defined the 5 digits for MoveTeamCoord, but this appears to be different.
Code: Select all
FUNCTION PlayerUnitIn(x1, y1, x2, y2, excludeFoot, excludeMounted, excludeLights)