Can TeamArrived(side,team) work with MoveTeamCoord(side,team)?

Moderator: rbodleyscott

Post Reply
locustmustdie
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 117
Joined: Fri Mar 05, 2021 11:33 am

Can TeamArrived(side,team) work with MoveTeamCoord(side,team)?

Post 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)?
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 337
Joined: Thu Feb 22, 2018 4:28 pm

Re: Can TeamArrived(side,team) work with MoveTeamCoord(side,team)?

Post 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.
Last edited by Cronos09 on Mon Aug 15, 2022 3:56 pm, edited 1 time in total.
locustmustdie
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 117
Joined: Fri Mar 05, 2021 11:33 am

Re: Can TeamArrived(side,team) work with MoveTeamCoord(side,team)?

Post 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!
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 337
Joined: Thu Feb 22, 2018 4:28 pm

Re: Can TeamArrived(side,team) work with MoveTeamCoord(side,team)?

Post 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)
Post Reply

Return to “Field of Glory II: Medieval - Scenario Design”