AttributeError: 'bool' object has no attribute 'hp'

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.
Post Reply
Message
Author
CMiz9023
Newbie
Posts: 7
Joined: Wed Mar 28, 2018 1:03 am
Contact:

AttributeError: 'bool' object has no attribute 'hp'

#1 Post by CMiz9023 »

Hello, I've got a question. I'm utilizing a combat system, but it keeps giving me this error code. What's going on?


Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 871, in script
    while valenzia.hp > 0 and pc.hp > 0:
  File "game/script.rpy", line 871, in <module>
    while valenzia.hp > 0 and pc.hp > 0:
AttributeError: 'bool' object has no attribute 'hp'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 871, in script
    while valenzia.hp > 0 and pc.hp > 0:
  File "C:\Users\Chrisu\Desktop\renpy-7.1.3-sdk\renpy\ast.py", line 1705, in execute
    if renpy.python.py_eval(self.condition):
  File "C:\Users\Chrisu\Desktop\renpy-7.1.3-sdk\renpy\python.py", line 1944, in py_eval
    return py_eval_bytecode(code, globals, locals)
  File "C:\Users\Chrisu\Desktop\renpy-7.1.3-sdk\renpy\python.py", line 1937, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/script.rpy", line 871, in <module>
    while valenzia.hp > 0 and pc.hp > 0:
AttributeError: 'bool' object has no attribute 'hp'

Windows-8-6.2.9200
Ren'Py 7.1.3.1092
Oracle 1.0
Mon Apr 01 14:46:42 2019

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: AttributeError: 'bool' object has no attribute 'hp'

#2 Post by trooper6 »

It looks like you have somehow defined valenzia and pc as True/False (in other words a boolean). It is really hard to say without seeing your code.
But. Do you uses pc or valenzia more than once to define more than one thing? And is one of those things a True/False?
valenzia and pc seems to be instances of a class. Where and how do you define that class? Where and how do you instantiate the valenzia and pc?
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?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Alex