Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
I'm having a little trouble getting started on a battle framework. I have this bit of code but when I run it, it responds with "Marl is not defined." I've tried putting the definition statement in a one-line python statement, in the python block, in the label. I tried to mess around with initiation times but I can't get Marl to be defined. What am I missing here?
python:
from random import randint
class Unit(object):
def __init__(self,name,hp,attack,defense):
self.name = name
self.hp = hp
self.attack = attack
self.defense = defense
def damage(self, enemy):
damage = randint(1,self.attack) - enemy.defense
Marl = Unit("Marl",100,3,1) ## This is what defines it, right?
screen dudes():
text "[Marl.hp]"
# The game starts here.
label start:
# Show a background. This uses a placeholder by default, but you can
# add a file (named either "bg room.png" or "bg room.jpg") to the
# images directory to show it.
scene bg room
# This shows a character sprite. A placeholder is used, but you can
# replace it by adding a file named "eileen happy.png" to the images
# directory.
show eileen happy
# These display lines of dialogue.
"Hello, world."
show screen dudes
Last edited by TellerFarsight on Thu Aug 24, 2017 10:24 pm, edited 1 time in total.
You should define all your variables using default outside of any block
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)