'problem doing a mapscreen system in renpy
I'm making a mapping system for a visual novel, at first it worked. But I decided to add a day and night system using variables and now it no longer recognizes the mapping system indicating that there is no IsActive attribute when I already defined this attribute, I'm very new to this and I don't have much knowledge (I'm self-taught) so I would really appreciate if you can help me.
The error message it sends me is the following:
While running game code:
File "game/script.rpy", line 62, in script call call Sumimor
File "game/script.rpy", line 90, in script call call afternoon
File "game/Tarde.rpy", line 5, in script $LocationT = renpy.call_screen("MapScreenT", _layer="screens")
File "game/Tarde.rpy", line 5, in $LocationT = renpy.call_screen("MapScreenT", _layer="screens")
File "game/MapScreen.rpy", line 17, in execute screen MapScreenT():
File "game/MapScreen.rpy", line 17, in execute screen MapScreenT():
File "game/MapScreen.rpy", line 18, in execute frame:
File "game/MapScreen.rpy", line 24, in execute for q in PlacesT:
File "game/MapScreen.rpy", line 25, in execute if q.IsActive:
File "game/MapScreen.rpy", line 25, in if q.IsActive:
AttributeError: 'int' object has no attribute 'IsActive'
And this is the code that I used to create the map system, it has two parts. The first where I define all the elements of the code, such as the name of the place, its location on the map (in coordinates), etc. and the application of the code so that the player can move on the map (which is a static image)
init python:
import math
class Place(object):
"""docstring for """
def __init__(self, x, y, name, IsActive):
self.x = x
self.y = y
self.name = name
self.IsActive = IsActive
class PlaceT(object):
"""docstring for """
def __init__(self, x, y, name, IsActive):
self.x = x
self.y = y
self.name = name
self.IsActive = IsActive
class PlaceN(object):
"""docstring for """
def __init__(self, x, y, name, IsActive):
self.x = x
self.y = y
self.name = name
self.IsActive = IsActive
Places = [0,1,2,3]
PlacesT = [0,1,2,3]
PlacesN = [0,1,2,3]
t = 0
while t < 2:
Places.append(Place(0,0,"",False))
PlacesT.append(PlaceT(0,0,"",False))
PlacesN.append(PlaceN(0,0,"",False))
t += 1
Places[0] = Place(500,400,"Suministros", True)
Places[1] = Place(600,200,"Entrenar", True)
Places[2] = Place(900,420,"Planacion", True)
Places[3] = Place(1200,460,"home", True)
PlacesT[1] = PlaceT(500,400,"Suministro", True)
PlacesT[2] = PlaceT(600,200,"Entrenar2A", True)
PlacesT[3] = PlaceT(900,420,"Estrategias", True)
PlacesT[4] = PlaceT(1200,460,"Casa", True)
PlacesN[1] = PlaceN(500,400,"Almacen", True)
PlacesN[2] = PlaceN(600,200,"Correr", True)
PlacesN[3] = PlaceN(900,420,"Sestrategica", True)
PlacesN[4] = PlaceN(1200,460,"Descanso", True)
This is the code that is used so that the player can be located in a specific part of the map:
screen MapScreen():
frame:
xalign 0.0
yalign 0.0
xsize 1280
ysize 720
background "MapaPa"
for q in Places:
if q.IsActive:
button:
xpos q.x
ypos q.y
text q.name
action Return(q.name)
screen MapScreenT():
frame:
xalign 0.0
yalign 0.0
xsize 1280
ysize 720
background "MapaPaB"
for q in PlacesT:
if q.IsActive:
button:
xpos q.x
ypos q.y
text q.name
action Return(q.name)
screen MapScreenN():
frame:
xalign 0.0
yalign 0.0
xsize 1280
ysize 720
background "MapaPaC"
for q in PlacesN:
if q.IsActive:
button:
xpos q.x
ypos q.y
text q.name
action Return(q.name)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
