I encountered a few issues when I tried to implement the script, some of which I solved, others I am still trying to resolve.
My current issue is that after a battle, no matter what the outcome, the story continues - i.e. it is not resetting the game in the event of the character's death. There are no errors being raised. Furthermore, the "Gameover" text is not being rendered either. I want some game over text and then to return to the main menu.
I think that this is the relevant section of code. I have tried changing a few things, also tried adding some narration, but I guess it can't be added there. I also changed the code for hiding the say window as it wasn't working either and I have removed the escape outcome as I am doing something a little different with escape.
Does anyone any ideas or did you have similar issues?
Also, the battles are being called from the "script" file, not the dungeon file. I have not needed a dungeon yet, instead I have battles at key parts of the story.
Code: Select all
# Result
if _return is "lose":
#next line hidden as it didn't work
#narrator ("You died!")
#next line is not rendering but has been left in as it may have an important role in the function.
"Gameover"
$ renpy.full_restart()
return
elif _return is "win":
"You won"
elif _return is "escape":
#next line hidden as it didn't work.
#narrator ("You escaped!")
"You escaped"
hide screen battle_ui
window show
#next line hidden as it was not working. Replaced with the above line.
#show screen screens.say
$ _rollback=True
return
label _battle(player, enemy):
# A sub label used in the battle label.
while True:
$ player.skill = renpy.call_screen("command_screen")
$ enemy.skill = renpy.random.choice(enemy.skills)
#next line hidden as I am using escape differently but I may want to use it or alter it later.
#if player.skill.type=="escape":
#return "escape"
$ player.attack(player.skill, enemy)
if enemy.hp < 1:
return "win"
$ enemy.attack(enemy.skill, player)
if player.hp < 1:
return "lose"