Direct enemy unit movement precisely
Moderators: Slitherine Core, BA Moderators
Direct enemy unit movement precisely
I am trying to find a way to make a unit move directly to a specific tile. When moving teams it appears they move to a point close to the target, and using SetUnitDestination for a unit seems to do the same. Is there another way to make a unit move to a specific tile directly?
-
Amaris
- Captain - Heavy Cruiser

- Posts: 929
- Joined: Fri Jul 23, 2010 11:08 am
- Location: France
- Contact:
Re: Direct enemy unit movement precisely
Well dont' know what you want but you can try:
//place this unit on the tile. Fails if the tile is occupied.
SetUnitTile(id, x, y)
or may be use:
//Set a squad to route to the designated tile. react denotes whether the move triggers reaction fire.
SetRoute(id, x, y, [react])
//place this unit on the tile. Fails if the tile is occupied.
SetUnitTile(id, x, y)
or may be use:
//Set a squad to route to the designated tile. react denotes whether the move triggers reaction fire.
SetRoute(id, x, y, [react])
“Take care, my friend; watch your six, and do one more roll… just for me.”
Re: Direct enemy unit movement precisely
I want to make a unit capture a VP directly, they seem to move around it a bit before moving into the flag. Will try that second function to see if it is any better, thanks.
Re: Direct enemy unit movement precisely
I have used SetRoute(id, x, y, [react]) on AI units and it seems to do what I am looking for. Just wondering if there are any side effects of doing it vs the MoveTeam and similar functions. Will this function move the specific unit before the rest? Can it be used to override a TeamOrder for the current turn?
-
pipfromslitherine
- Site Admin

- Posts: 9929
- Joined: Wed Mar 23, 2005 10:35 pm
Re: Direct enemy unit movement precisely
If a unit is moving, then the AI processing will be halted anyway, so nothing should override it.
Cheers
Pip
Cheers
Pip
follow me on Twitter here
Re: Direct enemy unit movement precisely
Hum, it appears SetRoute does the actual movement of the unit without taking into account if it has moves left. I was thinking on adding an attribute so that when I use this function I can know which units have moved during the turn. Or check the units APs before calling it. Any other ideas?
-
Amaris
- Captain - Heavy Cruiser

- Posts: 929
- Joined: Fri Jul 23, 2010 11:08 am
- Location: France
- Contact:
Re: Direct enemy unit movement precisely
Well try to check the moved attrib - you can see how deal with in the move.bsf file into \Battlefield Academy\Data\Battle\Scripts:
Code: Select all
ap = GetAttrib (me, "AP") ;
if ((GetDiffMode() == 2) && (GetUnitSide(me) == GetPlayerSide())) // FUN MODE
{
SetAttrib (me, "moved", 2) ;
}
else
{
// mark unit as moved
if (GetAttrib (me, "SneakMode") == 0 )
{
SetAttrib (me, "moved", 1) ;
// flag us to show we are not sneaking
SetUnitIconMask(me, 32) ;
}
else // no movement penalty
{
SetAttrib (me, "moved", 2) ;
}
}
// reduce AP
“Take care, my friend; watch your six, and do one more roll… just for me.”
