ANRAR4 / AutoBTD6

The scripts contained in this repository allow you to automatically play any gamemode on any map in Bloons TD6
31 stars 4 forks source link

Own replay error #3

Closed LukysGaming closed 1 year ago

LukysGaming commented 1 year ago

Hi, I tried to record the gameplay using the provided tool, but when i try to run it i get this error, any idea what i did wrong?

Traceback (most recent call last): File "D:\branch\AutoBTD6\replay.py", line 1218, in <module> main() File "D:\branch\AutoBTD6\replay.py", line 194, in main allAvailablePlaythroughs = getAllAvailablePlaythroughs(['own_playthroughs'], considerUserConfig=True) File "D:\branch\AutoBTD6\helper.py", line 538, in getAllAvailablePlaythroughs if considerUserConfig and not canUserUsePlaythrough({'filename': filename, 'fileConfig': fileConfig}): File "D:\branch\AutoBTD6\helper.py", line 478, in canUserUsePlaythrough mapConfig = parseBTD6InstructionsFile(playthrough['filename']) File "D:\branch\AutoBTD6\helper.py", line 224, in parseBTD6InstructionsFile newStep = {'action': 'upgrade', 'name': matches.group('name'), 'key': keybinds['path'][str(matches.group('path'))], 'pos': monkeys[matches.group('name')]['pos'], 'path': int(matches.group('path')), 'cost': adjustPrice(towers['monkeys'][monkeys[matches.group('name')]['type']]['upgrades'][int(matches.group('path'))][monkeyUpgrades[int(matches.group('path'))] - 1], newMapConfig['difficulty'], gamemode, {'action': 'upgrade', 'path': int(matches.group('path'))}, monkeys[matches.group('name')], matches.group('discount'))} KeyError: 'hero'

LukysGaming commented 1 year ago

+I have to remove every file in the \own_playthroughs or none of the replays will start and i will get the same error

ANRAR4 commented 1 year ago

I guess you tried to upgrade a hero, which isn't supported (as calculating the cost would be rather complex). The script was missing a type check for this case. Should be fixed with the latest commit (4db987c0aa38f018a5a2a02905fcb6b8525864fd)

LukysGaming commented 1 year ago

Yup thanks for quick fix, and i have one question, how am i supposed to make a replay on sanctuary? the thing keeps moving and the start move (to left or right) seems random

ANRAR4 commented 1 year ago

As mentioned in the README

Maps with changing monkey positions are currently not recordable/replayable in any mode other than deflation which affects Geared, Sanctuary and Covered Garden.

The platform positions are tied to the round you're on, so theoretically you could know where to click, but i haven't implemented that yet.

LukysGaming commented 1 year ago

Oh alr, last question, is there any special keybind to send lets say boomerang monkey's ability? or can i just click "1"? image

ANRAR4 commented 1 year ago

abilities can't be used as they require timing

Due to the fact that the replay of a playthrough works by determining if you have enough money available to perform the next action the script doesn't have any sense of timing (which may also vary depending on you pcs performance and RNG). So abilities can't be used. Furthermore their order (sorted by when they were made available) may differ after an update.

The best solution i could see would be something like activate ability turbocharge 10s after round 40 starts with images of each ability as resources. This would need to be specified after recording the playthrough. But I haven't implemented this yet either.

LukysGaming commented 1 year ago

If you could implement something like that in later updates it would be awesome, thanks for amazingly fast help (again). Thats everything i wanted to ask.