Hi, I have started using renpy pretty recently. And i am working on a VN. It has an explorable map, and an inventory, and 2 characters for now.
I have a class DIALOGUE(self, location, participant, chain, sequence, lbl, InitText)
Dialogue = []
a class CHAIN(self, participant, evnt, sequence, IsActive):
Chain = []
When you click on a character's icon, you trigger a certain chain label, showing all the dialogues in it's order of sequence. which is fine. But i want the chain to be triggered when you enter a location on the map for the first time, instead of being triggered by a click on a specific character.
In case it helps:
Game loop:
My main UI():
My Top Bar:
my map screen():
The map Navigation:
The functions:
And the classes i think are most important for the question:
As I said i am pretty new, but i can say that the game works up to now. Even if i don't know if my code is the most adecuate. I would appretiate any kind of tips you think could help me.
Thanks
I have a class DIALOGUE(self, location, participant, chain, sequence, lbl, InitText)
Dialogue = []
a class CHAIN(self, participant, evnt, sequence, IsActive):
Chain = []
When you click on a character's icon, you trigger a certain chain label, showing all the dialogues in it's order of sequence. which is fine. But i want the chain to be triggered when you enter a location on the map for the first time, instead of being triggered by a click on a specific character.
In case it helps:
Game loop:
Code:
label start:
$ y = renpy.input("what's your name?")
$ Playing = True
while Playing:
window hide
$ clickType = ""
$ UIreturn = renpy.call_screen("mainUI")
if clickType == "mapOpen":
call MapNav
if clickType == "subLocSelect":
call SubLocNav
if clickType == "CharacterClick":
$ CharacterClick(location)
if ChoiceList <> []:
$ LabelToCall = renpy.display_menu(ChoiceList, interact=True, screen="choice")
call expression LabelToCall
if clickType == "Clicky":
call expression UIreturn
if clickType == "invOpen":
pass
return
Code:
screen mainUI():
use BGIMAGE
use topBar
use clickies
use Character_Screen
use SubLocHud
Code:
screen topBar():
imagebutton:
xpos 0
ypos 15
focus_mask True
hover "/ui/map/map_icon_hover.png"
idle "/ui/map/map_icon.png"
action SetVariable("clickType", "mapOpen"), Return(None)
my map screen():
Code:
screen townmap():
add "/ui/map/mapbg.png"
imagebutton:
xpos 0
ypos 0
focus_mask True
hover "/ui/map/map_icon_hover.png"
idle "/ui/map/map_icon.png"
action SetVariable("clickType", "mapCancel"), Return(None)
for q in Scenes:
$ TempName = "images/ui/map/map_" + q.name + "_icon.png"
$ TempName1 = "images/ui/map/map_" + q.name + "_icon_hover.png"
imagebutton:
idle TempName
hover TempName1
focus_mask True
action SetVariable("clickType", "mapSelect"), SetVariable("locationID", q.ID), Return(q.name)
Code:
label MapNav:
$ UIreturn = renpy.call_screen("townmap")
if clickType == "mapCancel":
return
if clickType == "mapSelect":
$ location = UIreturn
return
label SubLocNav:
if clickType == "mapCancel":
return
if clickType == "subLocSelect":
$ location = UIreturn
hide SubLocHub()
return
Code:
init python:
def BGDeclare():
global location
global BGimage
BGimage = location.lower()
BGimage = BGimage.replace(" ", "")
Bgimage = BGimage + ".jpg"
def CharacterClick(loc):
global Dialogue
global Chain
global UIreturn
global ChoiceList
ChoiceList = []
for q in Dialogue:
if q.participant == UIreturn:
if q.location == loc or q.location == "":
ch = q.chain
sq = q.sequence
if sq == Chain[ch].sequence:
ChoiceList.append((q.InitText, q.lbl))
Code:
class DIALOGUE(object):
def __init__(self, location, participant, chain, sequence, lbl, InitText):
self.location = location
self.participant = participant
self.chain = chain
self.sequence = sequence
self.lbl = lbl
self.InitText = InitText
@property
def check(self):
global location
if self.participant == "":
if self.location == location or self.location == "":
if self.sequence == Chain[self.chain].sequence or self.chain == -1:
return True
return False
Dialogue = []
Dialogue.append(DIALOGUE("apothecary", "Tammara", 0, 0, "chain_0_0", ""))
Dialogue.append(DIALOGUE("in_apothecary", "Tammara", 0, 1, "chain_0_1", "HI!"))
class CHAIN(object):
def __init__(self, participant, evnt, sequence, IsActive):
self.participant = participant
self.evnt = evnt
self.sequence = sequence
self.IsActive = IsActive
def next(self):
self.sequence += 1
Chain = []
Chain.append(CHAIN("Tammara",0, 0, True))
As I said i am pretty new, but i can say that the game works up to now. Even if i don't know if my code is the most adecuate. I would appretiate any kind of tips you think could help me.
Thanks