Ren'Py battle system confused (SOLVED)

DanStory

Newbie
Sep 30, 2021
50
66
label start
Code:
init:
    $ import random

default mc_strength = 4
default dad_strength = 3

label start:

label fight_dad:
    $ mc_max_hp = 10
    $ mc_hp = mc_max_hp
    $ mc_att = mc_strength

    $ enemy_max_hp = 10
    $ enemy_hp = enemy_max_hp
    $ dad_att = dad_strength

    show screen hp_mc_vs_dad

    while mc_hp > 0 and enemy_hp > 0:
        #call dice_roll
        call position_dad
screen and label fight
Code:
screen hp_mc_vs_dad:

    vbox:
        #spacing 1
        xalign 0.1
        yalign 0.0
        xmaximum 600
        text "MC" #[male_character], this is for MC
        bar value mc_hp range mc_max_hp style "hp_mc"
    vbox:
        #spacing 1
        xalign 0.9
        yalign 0.0
        xmaximum 600
        text "Skeleton"# this is for enemy
        bar value enemy_hp range enemy_max_hp style "hp_enemy"

label position_dad:
    $ renpy.block_rollback()
    $ fight1 = renpy.random.choice(['og', 'of', 'ob'])
    if fight1 == 'og':
        show fight_tutorial 1
        menu:
            "punch":
                if mc_att >= dad_att:
                    $ mc_att = mc_strength
                    $ enemy_hp -= mc_att
                    "not bad [mc_att]"

                elif mc_att <= dad_att:
                    $ dad_att = dad_strength
                    $ mc_hp -= dad_att
                    "stupid [dad_att] damage"

            "kick":
                if mc_att >= dad_att:
                    $ mc_att = mc_strength
                    $ enemy_hp -= mc_att
                    "stupid fuck [dad_att] damage"

                elif mc_att <= dad_att:
                    $ dad_att = dad_strength
                    $ mc_hp -= dad_att
                    " fuck [dad_att] damage"

    elif fight1 == 'of':
        "try"

    elif fight1 == 'ob':
        "example"

    if enemy_hp <= 0:
        #call camera_knight_win
        "You win the combat encounter!"
        jump start
return
so, when i choose for "kick" , the damage income always 3 but if i choose "punch" the damage income always 4
my question here how can kick damage just 3 even strength mc default is 4

thanks for your help
or maybe someone can make it simple i'll be grateful

and i want to add block and counter att but i dont really know how to do that
maybe just simple att like this is enough
 
Last edited:

Catapo

Member
Jun 14, 2018
257
463
Others can probably take the time to figure out what you are trying to do and help you improve.

But to fix your problem my best guess is because when you choose kick you are actually writing dad_att in both situations unlike punch where you are correctly displaying mc_att
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,978
16,233
Others can probably take the time to figure out what you are trying to do and help you improve.

But to fix your problem my best guess is because when you choose kick you are actually writing dad_att in both situations unlike punch where you are correctly displaying mc_att
I'm "others", and I didn't found a better explanation that this.
 
  • Haha
Reactions: osanaiko

DanStory

Newbie
Sep 30, 2021
50
66
Others can probably take the time to figure out what you are trying to do and help you improve.

But to fix your problem my best guess is because when you choose kick you are actually writing dad_att in both situations unlike punch where you are correctly displaying mc_att
Thanks guys, I guess I was pushing myself too hard and couldn't see what was going on.
thanks for ur help..