Page 1 of 1
Can TeamArrived(side,team) work with MoveTeamCoord(side,team)?
Posted: Wed Aug 03, 2022 2:53 am
by locustmustdie
In Function.bsf
TeamArrived(side,team) means the team selected DistanceBetween the “Point”<=1 what’s that Point for?Is it the same as the (tilex,tiley)in MoveTeamCoord(side,team,tilex,tiley,aggr) ?
I wanna use it this way
Code: Select all
MoveTeamCoord(side,team,tilex,tiley,aggr);
If (TeamArrived(side,team) == 1)
{
If (GetUnitTeam(me) == team)
{
SetAttrib(me,facing);
}
}
But it doesn’t work. The “TeamArrived()” function only compatible with “MoveTeam()”(non-coord)?
Re: Can TeamArrived(side,team) work with MoveTeamCoord(side,team)?
Posted: Wed Aug 03, 2022 4:32 am
by Cronos09
locustmustdie wrote: Wed Aug 03, 2022 2:53 am
In Function.bsf
TeamArrived(side,team) means the team selected DistanceBetween the “Point”<=1 what’s that Point for?Is it the same as the (tilex,tiley)in MoveTeamCoord(side,team,tilex,tiley,aggr) ?
I wanna use it this way
Code: Select all
MoveTeamCoord(side,team,tilex,tiley,aggr);
If (TeamArrived(side,team) == 1)
{
If (GetUnitTeam(me) == team)
{
SetAttrib(me,facing);
}
}
But it doesn’t work. The “TeamArrived()” function only compatible with “MoveTeam()”(non-coord)?
I think this function only works with the AI Points which set in the Editor (open custom AI data dialog button). You can copy this function in your module with the next changes:
Code: Select all
FUNCTION TeamArrived(side, team, tilex, tiley)
{
int x1 ;
int y1 ;
int ret ;
if (IsValidTile(tilex, tiley) == 1)
{
x1 = GetTeamActiveX(side, team) ;
y1 = GetTeamActiveY(side, team) ;
// If distance to point <= 1 team has arrived, if not: it has not arrived
if( GetDistanceBetweenTiles(x1, y1, tilex, tiley) <= 1 )
{
ret = 1 ;
}
else
{
ret = 0 ;
}
}
else
{
ret = 1 ;
}
return ret ;
}
It must work in this case. The function itself is no longer found in the game scripts, so its name can be left unchanged.
Update. The final version in 4:45.
Re: Can TeamArrived(side,team) work with MoveTeamCoord(side,team)?
Posted: Wed Aug 03, 2022 4:53 am
by locustmustdie
Cronos09 wrote: Wed Aug 03, 2022 4:32 am
locustmustdie wrote: Wed Aug 03, 2022 2:53 am
But it doesn’t work. The “TeamArrived()” function only compatible with “MoveTeam()”(non-coord)?
I think this function only works with the AI Points which set in the Editor (open custom AI data dialog button). You can copy this function in your module with the next changes:
Code: Select all
{
FUNCTION TeamArrived(side, team, tilex, tiley)
int x1 ;
int y1 ;
int ret ;
if (IsValidTile(tilex, tiley) == 1)
{
x1 = GetTeamActiveX(side, team) ;
y1 = GetTeamActiveY(side, team) ;
// If distance to point <= 1 team has arrived, if not: it has not arrived
if( GetDistanceBetweenTiles(x1, y1, tilex, tiley) <= 1 )
{
ret = 1 ;
}
else
{
ret = 0 ;
}
}
else
{
ret = 1 ;
}
return ret ;
}
It must work in this case. The function itself is no longer found in the game scripts, so its name can be left unchanged.
Update. The final version in 4:45.
Thanks,Cronos!
Appreciated!
Re: Can TeamArrived(side,team) work with MoveTeamCoord(side,team)?
Posted: Wed Aug 03, 2022 5:10 am
by Cronos09
You are welcome!
If you copy Functions.BSF in your (Scenario name)/DATA/SCRIPT/ folder and change the original function in it there will no conflict in this case. If you copy the function in your (Scenario name)/SCENARIOS/ Scenario.BSF you should change its name (eg. FUNCTION TeamArrived1(side, team, tilex, tiley)