Page 3 of 3

Re: Adding Stats to Characters ... easily

Posted: Sun Apr 12, 2020 12:50 pm
by badanni

Code: Select all

image side addison = "addison.png"
define a = Avatar("name", image="addison")
on screen

Code: Select all

viewport:
                    scrollbars "vertical"
                    mousewheel True
                    grid columns rows:
                        transpose True
                        style_group "dropdown_gm2"
                        xfill True
                        ysize 300
                        spacing -10
                        $ i=0
                        vbox:
                                null height 30
                                $ name =party_i.name
                                $ level = party_i.level
                                $ job = party_i.job
                                $ job_level = party_i.jobs[job]["level"]
                                $ HP = party_i.HP
                                $ maxHP = party_i.base_HP+party_i.add_HP
                                $ MP = party_i.MP
                                $ maxMP = party_i.base_MP+party_i.add_MP
                                $ maxAttack=party_i.base_attack+party_i.add_attack
                                $ maxDefense=party_i.base_defense+party_i.add_defense
                                $ totalExp=party_i.exp_accumulated
                                $ base_attack=party_i.base_attack
                                $ add_attack=party_i.add_attack
                                $ base_defense=party_i.base_defense
                                $ add_defense=party_i.add_defense
                                $ base_magic=party_i.base_magic
                                $ add_magic=party_i.add_magic
                                $ base_resist=party_i.base_resist
                                $ add_resist=party_i.add_resist
                                $ base_agility=party_i.base_agility
                                $ add_agility=party_i.add_agility
                                $ base_luck=party_i.base_luck
                                $ add_luck=party_i.add_luck
                                $ hit_rate=party_i.hit_rate
                                $ critical=party_i.critical
                                $ Phys_eva=party_i.Phys_eva
                                $ Magi_eva=party_i.Magi_eva
                                $ crit_eva=party_i.crit_eva
                                text "[name]"
                                vbox:
                                    hbox:
                                        align (.5, .5)
                                        frame:
                                            background Frame("menu_screen/classic/MC_bg.png", 10, 10)
                                            align (.5, .5)
                                            $ portrait = party_i.face_img
                                            if not renpy.loadable(portrait):
                                                $ portrait = Null(width=90, height=90)
                                            if portrait is not None:
                                                add pscale(portrait, 90, 90) align (.5, .5)
                                        frame:
                                            background None
                                            grid 3 2:
                                                align (0.0,0.5)
                                                text "Level: [level]"
                                                text "HP: [HP] / [maxHP]"
                                                text "MP: [MP] / [maxMP]"
                                            
                                                text " "
                                                text "Attack: [maxAttack]"
                                                text "Defense: [maxDefense]"
                                    null height 50
                                    vbox:
                                        xfill True
                                        grid 2 1:
                                            text "Job: [job]"
                                            text "Job Level: [job_level]"
                                        null height 50
                                        grid 1 12:
                                            text "Experience: [totalExp]"
                                            text "Attack: [base_attack]([add_attack])"
                                            text "Defense: [base_defense]([add_defense])"
                                            text "Magic: [base_magic]([add_magic])"
                                            text "Endurance: [base_resist]([add_resist])"
                                            text "Agility: [base_agility]([base_agility])"
                                            text "Luck: [base_luck]([add_luck])"
                                            text "Hit Rate: [hit_rate]"
                                            text "Critical: [critical]"
                                            text "Physical evasion: [Phys_eva]"
                                            text "Magic evasion: [Magi_eva]"
                                            text "Critical evasion: [crit_eva]"
                                        hbox:
                                            align (.5, .5)
                                            textbutton "BACK":
                                                action SetScreenVariable("menu_big", "status")
this code is from an project i am doing
screenshot0035.png
screenshot0036.png

Re: Adding Stats to Characters ... easily

Posted: Tue Aug 10, 2021 1:51 am
by JustaHelpfulLurker
EDIT: Nevermind.

Re: Adding Stats to Characters ... easily

Posted: Mon Dec 20, 2021 1:08 am
by JustaHelpfulLurker
So for the inventory system, how do I actually get the quantity of an item? I'd like to be able to use it in expressions, but something like char.item['amount'] doesn't work at all.

Re: Adding Stats to Characters ... easily

Posted: Sat Jun 25, 2022 11:52 am
by envixer
Not sure if you're still maintaining this, or if there's a better way in python 3, but the code seems to work in the 8.0 preview as long as you update the raise command's syntax.