Dentosal / python-sc2

A StarCraft II bot api client library for Python 3
MIT License
585 stars 182 forks source link

ValueError: 3794 is not a valid AbilityId causing by "realtime=True/False" #300

Open ArthurFerier opened 4 years ago

ArthurFerier commented 4 years ago

Hello everyone,

My terminal raises an error when i try to launch a game with python-sc2. It says "ValueError: 3794 is not a valid AbilityId". I don't know what to do...

Here's my code (stolen from sentdex on youtube, i try to do the same as him for now):

import sc2 from sc2 import run_game, maps, Race, Difficulty from sc2.player import Bot, Computer

class SentdeBot(sc2.BotAI): async def on_step(self, iteration):

what to do every step

    await self.distribute_workers()  # in sc2/bot_ai.py

run_game(maps.get("AbyssalReefLE"), [ Bot(Race.Protoss, SentdeBot()), Computer(Race.Terran, Difficulty.Easy) ], realtime=True)

It raises the error at the last line of code ( realtime=True)

Here's also the entire error message :


Traceback (most recent call last): File "D:/Cloudstation/Machine_learning/ML_SC/test_game.py", line 27, in main() File "D:/Cloudstation/Machine_learning/ML_SC/test_game.py", line 24, in main ], realtime=True) File "D:\Cloudstation\Machine_learning\venv\lib\site-packages\sc2\main.py", line 306, in run_game _host_game(map_settings, players, **kwargs) File "C:\Users\Home\AppData\Local\Programs\Python\Python36\lib\asyncio\base_events.py", line 466, in run_until_complete return future.result() File "D:\Cloudstation\Machine_learning\venv\lib\site-packages\sc2\main.py", line 233, in _host_game result = await _play_game(players[0], client, realtime, portconfig, step_time_limit, game_time_limit, rgb_render_config) File "D:\Cloudstation\Machine_learning\venv\lib\site-packages\sc2\main.py", line 204, in _play_game result = await _play_game_ai(client, player_id, player.ai, realtime, step_time_limit, game_time_limit) File "D:\Cloudstation\Machine_learning\venv\lib\site-packages\sc2\main.py", line 91, in _play_game_ai game_data = await client.get_game_data() File "D:\Cloudstation\Machine_learning\venv\lib\site-packages\sc2\client.py", line 143, in get_game_data return GameData(result.data) File "D:\Cloudstation\Machine_learning\venv\lib\site-packages\sc2\game_data.py", line 29, in init self.abilities = {a.ability_id: AbilityData(self, a) for a in data.abilities if a.ability_id in ids} File "D:\Cloudstation\Machine_learning\venv\lib\site-packages\sc2\game_data.py", line 29, in self.abilities = {a.ability_id: AbilityData(self, a) for a in data.abilities if a.ability_id in ids} File "D:\Cloudstation\Machine_learning\venv\lib\site-packages\sc2\game_data.py", line 93, in init assert self.id != 0 File "D:\Cloudstation\Machine_learning\venv\lib\site-packages\sc2\game_data.py", line 101, in id return AbilityId(self._proto.remaps_to_ability_id) File "C:\Users\Home\AppData\Local\Programs\Python\Python36\lib\enum.py", line 291, in call return cls.new(cls, value) File "C:\Users\Home\AppData\Local\Programs\Python\Python36\lib\enum.py", line 533, in new return cls.missing(value) File "C:\Users\Home\AppData\Local\Programs\Python\Python36\lib\enum.py", line 546, in missing raise ValueError("%r is not a valid %s" % (value, cls.name)) ValueError: 3794 is not a valid AbilityId


I'm using pycharm with python 3.6 and the latest starcraft version at the moment (4.9.3)

If someone could help, it would by very appreciated !!!

ESBUINBOO commented 4 years ago

Same here, but you can fix it. https://github.com/Dentosal/python-sc2/issues/283#issuecomment-495995061

it worked for me, couple minutes ago.

ArthurFerier commented 4 years ago

I'll try it, thank you !