Need help on a time based quest.

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
twistkill
Newbie
Posts: 14
Joined: Sat Feb 24, 2018 4:02 am
Contact:

Need help on a time based quest.

#1 Post by twistkill »

I realize this could be very simple for the gurus here, but any help will be much appreciated.

Scenario - John is taking a shower in the morning and he needs Yoko to get the towel from the bedroom asap. A map of the house opens up. Say there are 5 locations- Bedroom, Kitchen, Garage, Living room, Bathroom.

If Yoko goes to bedroom, clicks on the towels and comes back to bathroom, the quest is passed (label towel_quest_done). But if she clicks on another room, say- living room and watches TV, time will advance from morning to afternoon and the quest will fail (label towel_quest_failed).

I do realize I can create variables for quest_started, towel_found, towel_delivered, etc. But what I really want to know is how to make Ren'Py remember that the quest was initiated at day_time = "morning" and if the player does not deliver the towel in the same time period, it will fail. If it was initiated at evening, it will fail if the time advances to night.

Code: Select all


label towel_quest:
	john "Hey, can you get me a towel from the bedroom?"
	yoko "Sure!"
	jump house_map

label bedroom_towel:
	yoko "Alright, I am here. Now, where is that towel?"
	jump bedroom_layout #if she clicks on the right imagebutton, it will jump to label towel_found

label towel_found:
	yoko "Aah! There it is..."
	jump house_map
	
label towel_quest_done:
	yoko "There you go!"
	john "Thank you!"
	
label towel_quest_failed:
	yoko "Aargh! I got distracted...I am so sorry!"
	john "You know what, I just used your towel."
	yoko "Eeeeww, noooooooo!"
	

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Need help on a time based quest.

#2 Post by trooper6 »

There are lots and lots of different ways to do this.

But since you want information (time started & time finished) associated with a thing (quest)...and you seem to plan on having more than one quest...I'd just create a class for the quest with a time_initiated variable and a time_completed variable. There would also be some sort of advancing time system I'd make where the player would have to press a button to "go somewhere" "do something" etc...and after every 2-5 clicks (or whatever) it advances the day_time.

But really, this is one of those things that I can't write for you, because I don't know what your entire vision is. Think of how you want the entire game to work and then start thinking about objects and functions.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

twistkill
Newbie
Posts: 14
Joined: Sat Feb 24, 2018 4:02 am
Contact:

Re: Need help on a time based quest.

#3 Post by twistkill »

Sadly, OOP is the bane of my life. I could scrape the code off some tutorial, but I was trying to do this myself by using simple (maybe tedious) code.
But your reply gave me an idea-

Code: Select all

$ time_started = "none"

label towel_quest:
	john "Hey, can you get me a towel from the bedroom?"
	yoko "Sure!"
	$ time_started = day_time
	jump house_map

label bedroom_towel:
	yoko "Alright, I am here. Now, where is that towel?"
	jump bedroom_layout #if she clicks on the right imagebutton, it will jump to label towel_found

label towel_found:
	yoko "Aah! There it is..."
	jump house_map
	
label towel_quest_done:
	if time_started == day_time:
		yoko "There you go!"
		john "Thank you!"
	else:
		yoko "Aargh! I got distracted...I am so sorry!"
		john "You know what, I just used your towel."
		yoko "Eeeeww, noooooooo!"
	

Post Reply

Who is online

Users browsing this forum: Google [Bot]