Simple minigames (Screen Language only).

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
User avatar
Alex
Lemma-Class Veteran
Posts: 2496
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Simple minigames (Screen Language only).

#91 Post by Alex » Sun May 24, 2020 4:58 pm

ForeverAScone wrote:
Sun May 24, 2020 12:42 pm
... I meant that each move can be used only a couple times per battle, like what you were saying "using a supermove only 3 times per battle". I was planning on using it with the one on one battle.

Code: Select all

    while (wolf_hp > 0) and (red_hood_hp > 0):
        
        menu:
            "Atack!":
                $ wolf_hp -= 2
                r "K-y-aaa!!!11 (damage dealt - 2hp)"
                
            "Eat cookie (got [cookies_left] cookies left)" if cookies_left > 0:
                $ red_hood_hp = min(red_hood_hp+5, red_hood_max_hp)
                $ cookies_left -= 1
                r "Mmm, tasty... (restore 5hp)"
Well, in this part player can eat some cookie if (s)he has at least one left. You can add similar variables to store the amount of supermoves and add those supermoves as choices in menu.
Try

Code: Select all

label battle_game_1:
    #### Some variables that describes the game state.
    $ fist_of_fire_left = 3
    $ acid_rain_left = 2
    # rest of code unchanged

Code: Select all

    while (wolf_hp > 0) and (red_hood_hp > 0):
        
        menu:
            "Atack!":
                $ wolf_hp -= 2
                r "K-y-aaa!!!11 (damage dealt - 2hp)"

            "Let's make some hot wolves :green: ([fist_of_fire_left] left)" if fist_of_fire_left > 0:
                $ fist_of_fire_left -= 1
                $ wolf_hp -= 6
                r "GrrGrrr!!!11 (damage dealt - 6hp)"

            "It's an acid rain, hallelujah ([acid_rain_left] left)" if acid_rain_left > 0:
                $ acid_rain_left -= 1
                $ wolf_hp -= 5
                "~some magical passes and muffled mumble~ (damage dealt - 5hp)"
                
            "Eat cookie (got [cookies_left] cookies left)" if cookies_left > 0:
                $ red_hood_hp = min(red_hood_hp+5, red_hood_max_hp)
                $ cookies_left -= 1
                r "Mmm, tasty... (restore 5hp)"
edit: oops, forgot to reduce amount of supermoves...
Last edited by Alex on Mon May 25, 2020 5:26 pm, edited 1 time in total.

User avatar
ForeverAScone
Newbie
Posts: 18
Joined: Sat May 23, 2020 8:08 pm
Projects: Working title to do with string theory. Got any got string puns/phrases? Please do tell me, lol.
Location: Under your bed
Contact:

Re: Simple minigames (Screen Language only).

#92 Post by ForeverAScone » Sun May 24, 2020 11:56 pm

Alex wrote:
Sun May 24, 2020 4:58 pm

Code: Select all

    while (wolf_hp > 0) and (red_hood_hp > 0):
        
        menu:
            "Atack!":
                $ wolf_hp -= 2
                r "K-y-aaa!!!11 (damage dealt - 2hp)"
                
            "Eat cookie (got [cookies_left] cookies left)" if cookies_left > 0:
                $ red_hood_hp = min(red_hood_hp+5, red_hood_max_hp)
                $ cookies_left -= 1
                r "Mmm, tasty... (restore 5hp)"
Well, in this part player can eat some cookie if (s)he has at least one left. You can add similar variables to store the amount of supermoves and add those supermoves as choices in menu.
Try

Code: Select all

label battle_game_1:
    #### Some variables that describes the game state.
    $ fist_of_fire_left = 3
    $ acid_rain_left = 2
    # rest of code unchanged

Code: Select all

    while (wolf_hp > 0) and (red_hood_hp > 0):
        
        menu:
            "Atack!":
                $ wolf_hp -= 2
                r "K-y-aaa!!!11 (damage dealt - 2hp)"

            "Let's make some hot wolves :green: ([fist_of_fire_left] left)" if fist_of_fire_left > 0:
                $ wolf_hp -= 6
                r "GrrGrrr!!!11 (damage dealt - 6hp)"

            "It's an acid rain, hallelujah ([acid_rain_left] left)" if acid_rain_left > 0:
                $ wolf_hp -= 5
                "~some magical passes and muffled mumble~ (damage dealt - 5hp)"
                
            "Eat cookie (got [cookies_left] cookies left)" if cookies_left > 0:
                $ red_hood_hp = min(red_hood_hp+5, red_hood_max_hp)
                $ cookies_left -= 1
                r "Mmm, tasty... (restore 5hp)"
Thanks so much for taking the time to help me out :D At first the count for the amount of moves left wasn't going down, but I was able to mess around with things and get it to work after a little while, and now it works great :) Thank you again, this has been a great help since I'm practically brand new to Ren'Py!
Your average noob here. Howdydoo

User avatar
ForeverAScone
Newbie
Posts: 18
Joined: Sat May 23, 2020 8:08 pm
Projects: Working title to do with string theory. Got any got string puns/phrases? Please do tell me, lol.
Location: Under your bed
Contact:

Re: Simple minigames (Screen Language only).

#93 Post by ForeverAScone » Fri Jul 10, 2020 1:40 pm

In the battle minigame (specifically the single battle though I bet it does the same thing in the group battle), I've noticed that when the enemy's health is at 0, it still gets one last turn to fight which often results in a double KO even though the enemy should not have been able to fight any more since it was at 0 HP. Is there a way to fix that? Thanks
Your average noob here. Howdydoo

User avatar
Alex
Lemma-Class Veteran
Posts: 2496
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Simple minigames (Screen Language only).

#94 Post by Alex » Fri Jul 10, 2020 3:47 pm

ForeverAScone wrote:
Fri Jul 10, 2020 1:40 pm
In the battle minigame (specifically the single battle though I bet it does the same thing in the group battle), I've noticed that when the enemy's health is at 0, it still gets one last turn to fight which often results in a double KO even though the enemy should not have been able to fight any more since it was at 0 HP. Is there a way to fix that? Thanks
Coup de grace, nah? :mrgreen:

Uh, well, let's add another check before wolfy's attack then

Code: Select all

    while (wolf_hp > 0) and (red_hood_hp > 0):
        
        menu:
            "Atack!":
                $ wolf_hp -= 2
                r "K-y-aaa!!!11 (damage dealt - 2hp)"
                
            "Eat cookie (got [cookies_left] cookies left)" if cookies_left > 0:
                $ red_hood_hp = min(red_hood_hp+5, red_hood_max_hp)
                $ cookies_left -= 1
                r "Mmm, tasty... (restore 5hp)"

        if wolf_hp > 0: # <--- check if wolf is still alive after all the girl has done...

            $ wolf_damage = renpy.random.randint(1, 6)
        
            $ red_hood_hp -= wolf_damage
        
            w "RrrrrRRrrrr! {i}*wolf bites you*{/i} (damage dealt - [wolf_damage]hp)"

The group battle shouldn't have this issue, 'cause it has checks for party/animies before each combatant's action.

User avatar
ForeverAScone
Newbie
Posts: 18
Joined: Sat May 23, 2020 8:08 pm
Projects: Working title to do with string theory. Got any got string puns/phrases? Please do tell me, lol.
Location: Under your bed
Contact:

Re: Simple minigames (Screen Language only).

#95 Post by ForeverAScone » Fri Jul 10, 2020 5:29 pm

Ah, thank you again, it works great now :D
Your average noob here. Howdydoo

Post Reply

Who is online

Users browsing this forum: No registered users