Open BurnySc2 opened 6 years ago
I just did some other excessive testing with other ability enums and I actually found a working one!
ability = self._game_data.units[CREEPTUMORQUEEN.value].creation_ability
ability = self._game_data.units[CREEPTUMOR.value].creation_ability
ability = self._game_data.units[CREEPTUMORBURROWED.value].creation_ability
ability = self._game_data.abilities[BUILD_CREEPTUMOR_QUEEN.value]
ability = self._game_data.abilities[BUILD_CREEPTUMOR_TUMOR.value]
ability = self._game_data.abilities[BUILD_CREEPTUMOR.value]
All of the above don't work but what does work is
ability = self._game_data.abilities[ZERGBUILD_CREEPTUMOR.value]
Now valid placements can be checked by
# positions = list of various Point2 or Point3 objects
# check if any of the positions are valid
validPlacements = await self._client.query_building_placement(ability, positions)
# filter valid results
validPlacements = [p for index, p in enumerate(positions) if validPlacements[index] == ActionResult.Success]
# now "validPlacements" will contain a list of points where it is possible to place creep tumors
# of course creep tumors have a limited range to place creep tumors but queens can move anywhere
if validPlacements and self.units(QUEEN).idle.exists:
queen = self.units(QUEEN).idle.random
for location in validPlacements:
err = await self.do(queen(BUILD_CREEPTUMOR_QUEEN, location))
# or the tumor alternative:
# err = await self.do(tumor(BUILD_CREEPTUMOR_TUMOR, location))
if not err:
break
Now it works on ramps and in other (usually unbuildable) places.
This must at least be documented better. Looking to add an example for this soon.
I've been trying to make my bot spread creep across the map, however I've run into an issue with the
function. It only returns None, and never a location. Creep tumors are the only 1x1 size buildings, the next bigger sized unit (that requires creep also) is the spine / spore crawler with 2x2. So far I've been using
instead, but that does not work well for ramps, edges or maps with (walkable) water (map example: Odyssey has lots of water), where normal buildings cannot be placed but creep tumors can.
Another issue is trying to access the
self._client.query_building_placemen() function from the client.py file. The issue might be related as all the results report.
This function is very useful when trying to check many locations in one
await
sweep.