If you know you need to create each character with unique values, you'd be better off adding those as parameters to your constructor:
Code: Select all
init -1:
python:
class NPC(object):
def __init__(self, name, alive=True, hasMet=False, relationship=1, isFollowing=False):
self.name = name
self.alive = alive
self.hasMet = hasMet
self.relationship = relationship
self.isFollowing = isFollowing
Basically you give each parameter a default value - so if you create an object without those parameters, they get the default values; if you pass in parameters, what you pass in will be used instead.
So you can create your Mary like this:
Code: Select all
# alive and isFollowing are same as the default parameter values, so we don't pass them in
default Mary = MPC("Mary", hasMet=False, relationship=8)
Also, don't use define and default on object attributes - it's a bit pointless and Renpy sometimes throws a fit (I haven't tested it extensively). Also, your define Mary.name statement would probably crash Renpy at launch - because it'd get executed before your default Mary = NPC() statement. Plus, even though you may think "Mary's name is never going to change", you're actually asking Renpy to save the Mary object, so Mary.name would still be saved as part of the Mary object regardless.
Hope this helps and makes sense!