


Refined worker control, you should write your own distribution function.įor example long distance mining control and moving workers if a base was killed NOTE: This function is far from optimal, if you really want to have Ratio is bigger than resource_ratio, this function prefer filling gas_buildingsįirst, if it is lower, it will prefer sending workers to minerals first. chat_send ( "Hello, this is a message from my bot!" ) ParametersĬlient async distribute_workers ( resource_ratio = 2 ) ¶ĭistributes workers across all the bases taken. The required supply to build zerglings is 1 because they pop in pairs, so this function returns 1 because the larva morph command requires 1 free supply.Īwait self. The total supply of a ravager is 3, but a roach already uses up 2 supply, so the morph supply cost is 1. The total supply of a baneling is 0.5, but a zergling already uses up 0.5 supply, so the morph supply cost is 0. This function calculates the required supply to train or morph a unit. Item_id ( Union) – Return typeĬost calculate_supply_cost ( unit_type ) ¶ ORBITALCOMMAND ) = Cost ( 150, 0 ) self. Instead of:įrom sc2.game_data import Cost self. It is adviced to use the UnitTypeId instead of the AbilityId. The total cost to create a ravager is 100/100, but the actual morph cost from roach to ravager is only 25/75, so this function returns 25/75. It is recommended to use the UnitTypeId instead of the ability to create the unit. ParametersĬalculate the required build, train or morph cost of a unit. Then uses ‘self.do’ to give the worker the order to start the construction. Also if the given position is not placeable, this function tries to find a nearby position to place

Not recommended as this function checks many positions if it “can place” on them until it found a valid STIMPACK ) Parametersįloat async build ( building, near, max_distance = 20, build_worker = None, random_alternative = True, placement_step = 2 ) ¶
