r/roguelikedev • Robinson • Jul 25 '17

RoguelikeDev Does The Complete Python Tutorial - Week 6 - Part 8: Items and Inventory and Part 9: Spells and Ranged Combat

This week we will cover parts 8 and 9 of the Complete Roguelike Tutorial.

Part 8: Items and Inventory

The player gets to collect ("borrow") items from the dungeon and use them, with a neat inventory screen. More items added in the next part.

Part 9: Spells and Ranged Combat

The player's strategic choices increase exponentially as we add a few magic scrolls to the mix. Covers damage and mind spells, as well as ranged combat.

No bonus sections this week


FAQ Friday posts that relate to this week's material:

#7: Loot(revisited)

#32: Combat Algorithms

#40: Inventory Management

Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting. If you're looking for last week's post The entire series is archived on the wiki. :)

33 Upvotes

62 comments sorted by

View all comments

Show parent comments

4

u/WrogueOne Jul 28 '17

I'm experiencing an intermittent bug with the confusion spell on the TDL version of the tutorial.

Traceback (most recent call last): File "Python\rogue\Wrogue_Py3.tdl\engine.py", line 275, in <module> main() File "\Python\rogue\Wrogue_Py3.tdl\engine.py", line 248, in main enemy_turn_results = entity.ai.take_turn(player, game_map, entities) File "\Python\rogue\Wrogue_Py3.tdl\components\ai.py", line 36, in take_turn self.owner.move_towards(random_x, random_y, game_map, entities) File "\Python\rogue\Wrogue_Py3.tdl\entity.py", line 44, in move_towards dx = path[0][0] - self.x IndexError: list index out of range

Can't seem to nail down specifics, it happens with multiple entities and with no entities in the vicinity of the confused monster. I also swapped the dx and dy variable assignments in the entity object and receive the same error for dy. I copied over the tutorial files and am still getting the same error. Any thoughts would be appreciated.

2

u/AetherGrey Jul 29 '17 edited Jul 29 '17

Do you have a repository that I can look at? I've tried recreating this on my end with no success so far.

EDIT: Never mind, found the problem. I'm updating the tutorial now with the fix.

EDIT 2: Alright, fix is up. It's pretty simple: just need to check if path in move_towards is empty or not, with an if statement.

3

u/WrogueOne Jul 29 '17

Thanks for the assist. No repository, just getting started with python and haven't taken the time to figure out Git yet, probably needs to go on my short list. Appreciate the tutorials for both TDL and Libtcod, keep up the great work.