CREATE YOUR AI CUM SLUT ON CANDY.AI TRY FOR FREE
x

Ren'Py [Solved]trying to make map by using SetVariable by using my class

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,131
3,195
trying to create a map how to make it action SetVariable(name, value) i have tried SetVariable("location", "Livingroom") it didn't


class.rpy
Python:
class places(object):
        def __init__(self,name,cost, UnLocked):
            self.name = name
            self.cost = cost
            self.UnLocked = UnLocked

    Rooms = []
  
    Rooms.append(places("livingroom", 0, True))#done
    Rooms.append(places("kitchen", 0, True))#done
    Rooms.append(places("bathroom", 0, True)) #done
    Rooms.append(places("motherBedroom", 0, True))#done
    Rooms.append(places("mybedroom", 0, True)) #done
    Rooms.append(places("twinbedroom", 0, True))#done

    location = Rooms[0].name
map screen
look at #
Python:
screen maps():
    add "images/town_map.png"

    imagebutton:
        ypos 340
        xpos 400
        idle "map_buttons/map_home.png"
        hover "map_buttons/map_home_h.png"
        action SetVariable("Location", "livingroom") #goes to the livingroom

    imagebutton:
        xpos 1100
        ypos 150
        idle "map_buttons/map_school.png"
        hover "map_buttons/map_school_h.png"
        action SetVariable("Location", "schooll_hallway")#goes to the livingroom instead of the school hallway
 
Last edited:

Abacus_Games

Newbie
Dec 11, 2022
21
26
Just my noob observation. It looks like you declare your location variable inside the class ??? (the tabbing makes it hard to be sure) - that makes it a field so you would need to use something like SetField(object, field, value) instead.

(If they are not in the class you probably want to default them to maintain save compatibility - but you're not showing that part if you have it).

Also, note that variables are case sensitive and you define location but use Location.
Also, you may have misspelled schooll_hallway.
 
Last edited:

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,131
3,195
Just my noob observation. It looks like you declare your location variable inside the class ??? (the tabbing makes it hard to be sure) - that makes it a field so you would need to use something like SetField(object, field, value) instead.

(If they are not in the class you probably want to default them to maintain save compatibility - but you're not showing that part if you have it).

Also, note that variables are case sensitive and you define location but use Location.
Also, you may have misspelled schooll_hallway.
thanks for the help but it didn't work
 

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,131
3,195
figure it out but just small problem

navigation doesn't show until I go to map then back home

screenshot0005.png screenshot0006.png