python-sc2 icon indicating copy to clipboard operation
python-sc2 copied to clipboard

STARPORTTECHLABRESEARCH abilities not working

Open baibinghere opened this issue 6 years ago • 3 comments

I'm trying to upgrade Banshee ability from Startport TechLab. I used below code:

if self.units(UnitTypeId.STARPORTTECHLAB).ready.exists:
    for spt in self.units(UnitTypeId.STARPORTTECHLAB).idle:
        #     self.combinedActions.append(spt(AbilityId.STARPORTTECHLABRESEARCH_RESEARCHMEDIVACENERGYUPGRADE))
        #     self.combinedActions.append(spt(AbilityId.STARPORTTECHLABRESEARCH_RESEARCHDURABLEMATERIALS))
        #     self.combinedActions.append(spt(AbilityId.STARPORTTECHLABRESEARCH_RESEARCHLIBERATORAGMODE))
        #     self.combinedActions.append(spt(AbilityId.STARPORTTECHLABRESEARCH_RAVENRESEARCHENHANCEDMUNITIONS))
        self.combinedActions.append(spt(AbilityId.STARPORTTECHLABRESEARCH_RESEARCHDURABLEMATERIALS))
await self.do_actions(self.combinedActions)

I tried each comment part, none of them work. Now I cannot upgrade any ability from starport techlab.

baibinghere avatar Jun 26 '19 06:06 baibinghere

Just found that at least for Banshee, I can use below Abilities: RESEARCH_BANSHEECLOAKINGFIELD RESEARCH_BANSHEEHYPERFLIGHTROTORS

I still don't understand why STARPORTTECHLABRESEARCH_RESEARCH*** doesn't work. It looks much more official.

baibinghere avatar Jun 26 '19 08:06 baibinghere

I think you are trying to research upgrades that were removed from the game but are still listed in the AbilityIds.

You can also use the .research function to let the function figure out the research ability from an UpgradeId:


idle_starport_techlabs = self.units.filter(lambda u: u.type_id == UnitTypeId.STARPORTTECHLAB and u.is_ready and u.is_idle)
for spt in idle_starport_techlabs:
    self.combinedActions.append(spt.research(UpgradeId.BANSHEECLOAK))
    self.combinedActions.append(spt.research(UpgradeId.BANSHEESPEED))
    self.combinedActions.append(spt.research(UpgradeId.MEDIVACINCREASESPEEDBOOST))
    self.combinedActions.append(spt.research(UpgradeId.RAVENCORVIDREACTOR))
    # The following requires that you have a fusion core
    self.combinedActions.append(spt.research(UpgradeId.LIBERATORMORPH))
await self.do_actions(self.combinedActions)

Here are a couple upgrades and their corresponding research abilities.


UnitTypeId.STARPORTTECHLAB: {
    UpgradeId.BANSHEECLOAK: {"ability": AbilityId.RESEARCH_BANSHEECLOAKINGFIELD},
    UpgradeId.BANSHEESPEED: {
        "ability": AbilityId.RESEARCH_BANSHEEHYPERFLIGHTROTORS
    },
    UpgradeId.LIBERATORMORPH: {
        "upgrade": UpgradeId.LIBERATORMORPH,
        "ability": AbilityId.STARPORTTECHLABRESEARCH_RESEARCHLIBERATORAGMODE,
        "requires_tech_building": UnitTypeId.FUSIONCORE,
    },
    UpgradeId.MEDIVACINCREASESPEEDBOOST: {
        "ability": AbilityId.RESEARCH_HIGHCAPACITYFUELTANKS
    },
    UpgradeId.RAVENCORVIDREACTOR: {
        "ability": AbilityId.RESEARCH_RAVENCORVIDREACTOR
    },

BurnySc2 avatar Jun 26 '19 14:06 BurnySc2

Thanks @BurnySc2 for pointing it out! This is great help of understanding how does the research upgrade works in python-sc2. I would suggest to remove the unused attributes.

baibinghere avatar Jun 27 '19 04:06 baibinghere