- Oct 8, 2021
- 115
- 260
OK, i have another question if I can manage it without pissing anyone off.
The event trigger seems to be working great but when I try to do an animation in my game_scenes script its displaying the menu from the script over the top of it, I've tried all kinds to get it to stop doing it. Like using "scene onlayer overlay", moving it to a separate screen file, which was even worse, asked ChapGPT etc
I suspect its the while loop for the menu "change location" "Open Map" in the script but as Im not overly familiar with Renpy compared to C# I dont know the best way to deal with it.
Thanks in advance an apologies for pissing people off with my inexperience earlier.
The event trigger seems to be working great but when I try to do an animation in my game_scenes script its displaying the menu from the script over the top of it, I've tried all kinds to get it to stop doing it. Like using "scene onlayer overlay", moving it to a separate screen file, which was even worse, asked ChapGPT etc
I suspect its the while loop for the menu "change location" "Open Map" in the script but as Im not overly familiar with Renpy compared to C# I dont know the best way to deal with it.
Python:
label start_game:
call variables
$ GameRunning = True
while GameRunning:
$ Location_img = Location.lower()
if renpy.has_image(Location.lower(), exact=True):
show expression Location_img
menu:
"I am at [Location]"
"change location":
$ Location = "bed"
"Open Map":
$ Location = renpy.call_screen("MapScreen", _layer="screens")
$ BlockToCall = ""
python:
for event in EVENTS:
if event.date_check(LocationID, calendar.Hours, calendar.Day):
BlockToCall = event.Block
if BlockToCall != "":
call expression BlockToCall
label variables:
$ calendar = Calendar(0, 0, 0, 0, ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],0)
$ EVENTS[0] = Event(2, 12, 0, "EvOne", True)
$ EVENTS[1] = Event(2, 12, 1, "EvTwo", True)
return
Python:
label EvTwo:
show soldier
soldier "blah"
$ EVENTS[1].SetInactive()
menu:
"1":
jump 1
"Don't":
"You spend a day in jail."
$ calendar.AddTime(24)
label 1:
show soldier
image animation_loop_sp:
"soldier4"
pause 0.2
"soldier5"
pause 0.2
repeat(5)
show animation_loop_sp
return
Python:
init python:
# Define the Calendar class
class Calendar(object):
def __init__(self, Hours, Hour, Days, Day, WeekDays, PlaceID): # Add PlaceID attribute
self.Hour = Hour
self.Hours = Hours
self.Days = Days
self.Day = Day
self.WeekDays = WeekDays
self.PlaceID = PlaceID # Assign PlaceID
@property
def Output(self):
return self.WeekDays[self.Day] + " " + str(self.Days+1) + " " + str(self.Hours).zfill(2) + ":" + "00"
def AddTime(self, hours):
self.Hours += hours
if self.Hours > 23:
self.Hours %= 24
self.Day += 1
self.Days += 1
if self.Day > 6:
self.Day = 0
# Create an instance of the Calendar class with a default PlaceID
class Event(object):
def __init__(self, LocationID, Hours, Day, Block, IsActive):
self.LocationID = LocationID
self.Hours = Hours
self.Day = Day
self.Block = Block
self.IsActive = IsActive
def date_check(self, current_location, current_hour, current_day):
print("Checking event:", self.Block)
print("Event hour:", self.Hours)
print("Event day:", self.Day)
print("Event location:", self.LocationID)
print("Current hour:", current_hour)
print("Current day:", current_day)
print("Current location:", current_location)# Check if the event is active, it's the specified hour, and the player is at the specified location
if self.IsActive and self.Hours == current_hour and self.LocationID == current_location and self.Day == current_day:
print("Event triggered!")
return True
else:
print("Event not triggered.")
return False
def SetInactive(self):
self.IsActive = False
# Define the Place class
class Place(object):
def __init__(self, ID, x, y, name, IsActive):
self.ID = ID
self.x = x
self.y = y
self.name = name
self.IsActive = IsActive
@property
def avatar(self):
icon = "icons/" + self.name.lower() + "_icon.png"
return(icon)
# Initialize lists for events, places, and sub-locations
EVENTS = []
Places = []
# Create placeholder instances for events, places, and sub-locations
t = 0
while t < 50:
EVENTS.append(Event(0, 0, 0, "", False))
Places.append(Place(0, 0, 0, "", False))
t += 1
# Define specific places and sub-locations
Places[0] = Place(0, 1000, 600, "Home", True)
Places[1] = Place(1, 200, 700, "Bedroom", True)
Places[2] = Place(2, 1200, 500, "Showers", True)
#Places[3] = Place(3, 500,200, "Terminal", True)
Last edited: