Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while using self.time = (self.state.game_loop/22.4) / 60 #302

Open
tm012 opened this issue Aug 5, 2019 · 2 comments
Open

Error while using self.time = (self.state.game_loop/22.4) / 60 #302

tm012 opened this issue Aug 5, 2019 · 2 comments

Comments

@tm012
Copy link

tm012 commented Aug 5, 2019

My code is
async def on_step(self, iteration):
self.time = (self.state.game_loop/22.4) / 60
.......................... ............................
While running this line (self.time = (self.state.game_loop/22.4) / 60)
It's giving error on the line,

await ai.on_step(iteration)
Inside
Python36\lib\site-packages\sc2\main.py", line 135, in _play_game_ai

Logs:
Traceback (most recent call last):
File "C:\Users\tause\AppData\Local\Programs\Python\Python36\lib\site-packages\sc2\main.py", line 135, in _play_game_ai
await ai.on_step(iteration)
File "S:\Starcraft 2 API\Python Files\pythonStarcraftPart13.py", line 44, in on_step
self.time = (self.state.game_loop/22.4) / 60
AttributeError: can't set attribute
ERROR:sc2.main:resigning due to previous error
--- on_end called ---
Result.Defeat False

@mogue
Copy link

mogue commented Aug 12, 2019

self.time returns the game time in seconds, why would you want to set it?

if you want minutes you can do self.timeMinutes = self.time / 60. or use the code you suggested above and rename the variable.

@zarater
Copy link

zarater commented Aug 29, 2019

I have same issue as above @mogue.
can you clarify a bit on what you mean

if you want minutes you can do self.timeMinutes = self.time / 60. or use the code you suggested above and rename the variable.

self.time = (self.state.game_loop/22.4) self.timeMinutes = self.time/60 print('Time:',self.time)

this is what i have inserted. code uses
if len(self.units(TYPE.OBSERVER)) < math.floor(self.time/3): at some point in the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants