You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if related, but I noticed that there are some weird issues with sc2.bot_ai.find_placement(). I noticed this when trying to make a custom warp_in function, because I couldn't get it to warp in further out from the targetted pylon, regardless of what I changed max_distance to, I kept getting placement errors, even with random_alternative=True.
I solved this by just warping in at random positions, so I didn't have to use find_placement() or query_building_placement() at all, and I sent the action manually using self._client.actions() to surpress the error logging. As a side-note, I kind of wish you could disable error-logging with an extra argument to sc2.bot_ai.do() so I could use that directly instead.
Here's my custom warp-in solution:
async def warp_in(self, unit, location, warpgate):
if isinstance(location, sc2.unit.Unit):
location = location.position.to2
elif location is not None:
location = location.to2
x = random.randrange(-8,8)
y = random.randrange(-8,8)
placement = sc2.position.Point2((location.x+x,location.y+y))
action = warpgate.warp_in(unit, placement)
error = await self._client.actions(action, game_data=self._game_data)
if not error:
cost = self._game_data.calculate_ability_cost(action.ability)
self.minerals -= cost.minerals
self.vespene -= cost.vespene
return None
else:
return error
@Dentosal , I remember having this problem way back when I was still actively contributing. It's because the API can't register a currently warping in unit as an unavailable cell. The random alternative only works if the initial cell is unavailable.
No description provided.
The text was updated successfully, but these errors were encountered: