My goal is to avoid confusing the player by displaying the event name and character, since I don't fix the character for each location in the event for the sake of the scenario.
Anyway, I tried to make just the rooftop event, but it doesn't work at all. I've tried referring to various sources, but since I'm a programming beginner, I'm stuck and in trouble.
I'd like to create a list, set event priorities, filter out those that aren't available, and sort the list in order of highest to lowest, but it doesn't work: ......It will say expected statement.
I'm sure this poor program alone is full of mistakes, but I haven't quite incorporated what I want to do yet.
Code: Select all
default roof_eventname = "[r_events.name]"
init 100:
new_roof_events = [e for e in roof_events if e.displays()]
new_roof_events.sort(key=lambda i : i.priority)
screen roof_event_button():
fixed:
imagebutton:
idle "roof_idle.png"
hover "roof_hover.png"
xpos 82
ypos 77
action [Play("sound", "audio/kati.mp3"),Jump("[r_events.labelname]")]
text roof_eventname xpos 82 ypos 120
$ r_events = [new_roof_events[0]]
init python:
import renpy.store as store
import renpy.exports as renpy
class Evnt_roof (store.object):
roof_events = [ ]
def __init__(self, name, labelname, available = False, completed = False, priority = 100):
self.name = name
self.labelname = labelname
self.available = available
self.completed = completed
self.priority = priority
self.roof_events.append(self)
def displays(self):
if self.available and not(self.completed):
return True
return False
default event_roof_1 = Evnt_roof("屋上イベントA", "roof_1", True, False, priority = 120)
default event_roof_2 = Evnt_roof("屋上イベントB", "roof_2", True, False, priority = 110)
default event_roof_3 = Evnt_roof("屋上イベントC", "roof_3", True, False, priority = 130)
default event_roof_4 = Evnt_roof("屋上イベントa", "roof_z_1", True, False)
label roof_1:
"テスト。"
"これは屋上一個目のイベントです。"
jump start
label roof_2:
"テスト。"
"これは屋上2個目のイベントです。"
jump start
label roof_3:
"テスト。"
"これは屋上3個目のイベントです。何度も表示されるはず。"
jump start
label roof_z_1:
"テスト"
"これは屋上イベント汎用。何度も表示されるはず。"
jump start
label start:
show screen roof_event_button
"lllllllllllllllllllllll"
return
Code: Select all
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/kyuzitu-event.rpy", line 5: expected statement.
new_roof_events = [e for e in roof_events if e.displays()]
^
File "game/kyuzitu-event.rpy", line 6: expected statement.
new_roof_events.sort(key=lambda i : i.priority)
^
Ren'Py Version: Ren'Py 7.4.5.1648
Wed Oct 13 21:53:34 2021
(1) Events will be triggered according to the likability and flag .
I think unlocking the events in order itself can be done by setting the initial available to false and changing it to true when the event is over,
but how do I set up things like character a needing 50 sensitivity or a special flag for event C in this way? To begin with, is the way this program is set up unsuitable for such a setup?
(2)Change the button display depending on the character appearing in the event.
I'm thinking of setting up a character for each event, and setting up an image for each with an if statement from the screen, but is that difficult?
I'm sure this program is full of mistakes, and I'm very sorry.
Code: Select all
def __init__(self, name, labelname, charactername,…):
self.name = name
self.labelname = labelname
self.charactername = charactername
…
Code: Select all
screen roof_event_button():
fixed:
if self.charactername == "a":
imagebutton:
auto "a_%s.png" action [Play("sound", "audio/kati.mp3"),Jump("[r_events.labelname]")]
elif self.charactername == "b" :
imagebutton:
auto "b_%s.png" action [Play("sound", "audio/kati.mp3"),Jump("[r_events.labelname]")]
……
text roof_eventname xpos 82 ypos 120 I would like to know if there is a better way to do this.
I am a beginner in programming and English is not my first language. I'm sorry.