AI (UnloadUnits) into Water
Posted: Sat Feb 05, 2011 5:18 am
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
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
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 ;
}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
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