Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6972975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:02:49+00:00 2026-05-27T17:02:49+00:00

I’m making an RPG, and am trying to split things up into multiple files

  • 0

I’m making an RPG, and am trying to split things up into multiple files to organize things better. (I mean, character creation alone was over 2000 lines.) But this is something that I’ve never done, and I’m really not sure how to do it. So, if I could get some general advice on how to set things up efficiently, etc. I would really appreciate it. I really haven’t been able to find much on the subject, other than the page about modules on the python website, which I did read, but I’m still a little unclear about it. This is definitely the most confusing, least talked about, thing I’ve come across so far in programming… and I do hate asking vague questions like this, but I’m definitely not making any progress on my own, so I’m hoping one of you can put me on the right path.

I’ll also give one specific example.

I’m wanting to put all of the character’s stats and skills into one or two lists, so I can more easily use them with functions, and I have no clue how to use a list from another file as an argument for a function. This is what I’ve tried, and it seems like it should work. I’m importing this file into CharacterCreation, and then just using “StatCalculations.LevelUp(PLAYERSTATLIST)”, but it says “‘module’ object has no attribute ‘LevelUp'”.

What am I doing wrong?

from CharacterCreation import BaseHEALTH, BaseMANA, BaseSTAMINA, BaseCAPACITY, BaseDEFENSE, STRENGTH, ENDURANCE, AGILITY, INTELLIGENCE, PERSONALITY, BaseSTRENGTH, BaseENDURANCE, BaseAGILITY, BaseINTELLIGENCE, BasePERSONALITY, PLAYERLEVEL, PLAYERNAME

def LevelUp(*PLAYERSTATLIST):
    HEALTH = BaseHEALTH + ( ENDURANCE / 2 ) + ( STRENGTH / 5 )
    MANA = BaseMANA + INTELLIGENCE + ( ENDURANCE / 10 )
    STAMINA = BaseSTAMINA + ( STRENGTH / 5 ) + ( ENDURANCE / 5 )
    CAPACITY = BaseCAPACITY + ( STRENGTH / 5 ) + ( ENDURANCE / 10 )
    DEFENSE = BaseDEFENSE + ( ENDURANCE / 10 ) + ( AGILITY / 10 ) + ( STRENGTH / 10 )
    PLAYERSTATLIST = [HEALTH, MANA, STAMINA, CAPACITY, DEFENSE, BaseHEALTH, BaseMANA, BaseSTAMINA, BaseCAPACITY, BaseDEFENSE, STRENGTH, ENDURANCE, AGILITY, INTELLIGENCE, PERSONALITY, BaseSTRENGTH, BaseENDURANCE, BaseAGILITY, BaseINTELLIGENCE, BasePERSONALITY, PLAYERLEVEL, PLAYERNAME]
return PLAYERSTATLIST
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:02:50+00:00Added an answer on May 27, 2026 at 5:02 pm

    here is a mini example to get you going.. you can initialize base values with something like randrange and so on. each of these classes can be put into a file and imported as a module, whatever keeps you organized. good luck

    import random
    
    class PlayerAttributes(object):
    
        def __init__(self):
            self.health      = 0
            self.mana        = 0
            self.stamina     = 0
            self.capacity    = 0
            self.defense     = 0
            self.reset_attributes()
    
        def level_up(self):
            self.level_health()
            self.level_mana()
            #etc
    
        def reset_attributes(self):
            self.reset_health()
            self.reset_mana()
            self.reset_stamina()
            self.reset_capacity()
            self.reset_defense()
    
        def get_health(self):
            return self.health
    
        def reset_health(self):
            self.health = base_health
    
        def level_health(self):
            self.health += (self.endurance/2) + (self.strength/2)
    
    
    class Equipment(object):
    
        def __init__(self):
            self.equipment_dict     = {}
            self.currently_equipped = None
    
        def set_equipped_weapon(self,weapon_name)
            self.currently_equipped = weapon_name
    
        def add_item(self,item):
            self.equipment_dict[item.name] = item
    
    class Item(object):
    
        def __init__(self,name,hp,attack,defense,weight):
            pass #put stuff in here, etc
    
    
    class Player(object):
    
        def __init__(self):
            self.attributes = PlayerAttributes()
            self.backpack   = Equipment()
            self.backpack.add_item(Item("dagger",5,10,0,2))
    
        def level_up(self):
            self.attributes.level_up()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.