AI (UnloadUnits) into Water

Tech support for Battle Academy

Moderators: Slitherine Core, BA Moderators

Post Reply
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

AI (UnloadUnits) into Water

Post by Merr »

Pip,

Found a little bug .... The AI transport will unload it's unit in a water tile.

I did some leg work on this .... it's in the AI.bsf ... FUNCTION UnloadUnits(me).
The only check it does is for other units occupying the tile, so I added a condition for water ... sample

Code: Select all

	if( (GetUnitOnTile(x+1, y) == -1 ) && (IsTileWater(x + 1, y) == 0) )
	{
		UnloadUnit(me, x+1, y) ;
		done = 1 ;
	}
Now ... This only occurs when it unloads due to threats.
For example, I took two trucks and placed them seperately and surrounded both trucks with water tiles. I blew up one truck, then ended my turn. The remaining truck unloaded the infantry into the water tile (first condition, x+1,y). After I added the water condition it behaved properly. I know you fixed this(I think :?: ) for when trucks explode, thus not unloading over hedges etc, but this example above is different.

Now ... This rarely happens if the truck is adjancent to 1 water tile, unless that tile is coincidently X+1, or X-1, or Y+1, or Y-1.

The file date for the AI.BSF is 10/20/2010 ... Looks like old code the way it's written ... I mean, normally you run a loop to check all 8 adjacent tiles, not just 4 tiles.
Hope that all makes sense.

Thanks!

Rob
pipfromslitherine
Site Admin
Site Admin
Posts: 9925
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

I'll take a look - there are much more thorough helper functions that it should be using anyway. Thanks for the catch! :)

Cheers

Pip
Post Reply

Return to “Battle Academy : Tech Support”