Questions RE: Several Functions for a Game
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.
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.
-
- Regular
- Posts: 68
- Joined: Thu Jun 19, 2008 1:27 am
- Completed: Watashi wa Onigiri, A Day Off, T.M.O.G.E
- Projects: None.
- Contact:
Questions RE: Several Functions for a Game
Okay, I am new to Ren'Py (and programming in general), and I had some questions regarding functions I wanted to add to my game.
First off, how would I make a mini-game that required the player to match a set of keys or symbols, perhaps even musical notes, that rewarded the player with something, like bonus points for a certain girl, or an item?
Second, how would I make a shop system that coincided with an inventory system and a gift giving system?
And third, how would I make a special power system, like spells or such, along with stats to go with them? My thought was to make a few spells that the player would know from the start, and would learn through various parts of the game, to do things like predict what the favorable response would be for a question, or to impress the characters that the player is trying to win over.
Please respond.
First off, how would I make a mini-game that required the player to match a set of keys or symbols, perhaps even musical notes, that rewarded the player with something, like bonus points for a certain girl, or an item?
Second, how would I make a shop system that coincided with an inventory system and a gift giving system?
And third, how would I make a special power system, like spells or such, along with stats to go with them? My thought was to make a few spells that the player would know from the start, and would learn through various parts of the game, to do things like predict what the favorable response would be for a question, or to impress the characters that the player is trying to win over.
Please respond.
-
- Regular
- Posts: 63
- Joined: Wed Aug 01, 2007 11:11 pm
- Contact:
Re: Questions RE: Several Functions for a Game
I'm reminded of the old Lone Wolf gamebooks: "If you wish to debate the obnoxious guard, turn to page 87. If you wish to walk away and find another way in, turn to page 26. If you have the Kai Discipline of Psi-Surge and wish to explode this mother#%^&er's brain, turn to page 233."deinarious wrote: And third, how would I make a special power system, like spells or such, along with stats to go with them? My thought was to make a few spells that the player would know from the start, and would learn through various parts of the game, to do things like predict what the favorable response would be for a question, or to impress the characters that the player is trying to win over.
Admittedly a rather liberal paraphrase, but you get the idea. I'm sure something similar can be done with Ren'Py. Figure out how to make a menu option that doesn't show up- or, alternately, shows up but is inert- unless the player has whatever skill would be useful.
If you can't do that, the low-rent method is to make said option "always on" and then return an "I don't have that skill." message if the player clicks on it. After which you either re-display the menu and and let him try again or, if you're feeling cruel, say "...so instead I <whatever>".
----
"Yes, ninety percent would never get finished, and ninety percent of the rest would suck. That's the way it always works. That's how you get stuff that kicks ass." -Andrew Plotkin
"Yes, ninety percent would never get finished, and ninety percent of the rest would suck. That's the way it always works. That's how you get stuff that kicks ass." -Andrew Plotkin
-
- Regular
- Posts: 68
- Joined: Thu Jun 19, 2008 1:27 am
- Completed: Watashi wa Onigiri, A Day Off, T.M.O.G.E
- Projects: None.
- Contact:
Re: Questions RE: Several Functions for a Game
could I see an example of that please?
-
- Regular
- Posts: 27
- Joined: Sun Jun 08, 2008 6:01 pm
- Contact:
Re: Questions RE: Several Functions for a Game
Well, for the low-rent version:
I'm pretty sure the higher-level stuff is doable, but I'm a bit new to this myself. ^_^;;;;;; Anyone else have an idea?
Code: Select all
menu:
"Punch him in the face":
"I punch him in the face."
jump punch
"Kick him in the shins":
"I kick him in the shins."
jump kick
"KAMEHAMEHA!":
if Kamehameha == "known":
"I blast him into orbit."
jump kame
else:
"I don't know how to do that, so I kick him in the shins instead."
jump kick
-
- Regular
- Posts: 63
- Joined: Wed Aug 01, 2007 11:11 pm
- Contact:
Re: Questions RE: Several Functions for a Game
Yeah, that's prety much it. For the "repeat the choice again" method, it's a little trickier, but basically you put a label right before the menu and then jump back:ParsonSyunOwen wrote:Well, for the low-rent version:
I'm pretty sure the higher-level stuff is doable, but I'm a bit new to this myself. ^_^;;;;;; Anyone else have an idea?Code: Select all
menu: "Punch him in the face": "I punch him in the face." jump punch "Kick him in the shins": "I kick him in the shins." jump kick "KAMEHAMEHA!": if Kamehameha == "known": "I blast him into orbit." jump kame else: "I don't know how to do that, so I kick him in the shins instead." jump kick
Code: Select all
label fight_guy:
menu:
"Punch him in the face":
"I punch him in the face."
jump punch
"Kick him in the shins":
"I kick him in the shins."
jump kick
"KAMEHAMEHA!":
if Kamehameha == "known":
"I blast him into orbit."
jump kame
else:
"I don't know how to do that."
jump fight_guy
Code: Select all
menu:
"Punch him in the face":
"I punch him in the face."
jump punch
"Kick him in the shins":
"I kick him in the shins."
jump kick
"KAMEHAMEHA!" if Kamehameha == "known":
"I blast him into orbit."
jump kame
----
"Yes, ninety percent would never get finished, and ninety percent of the rest would suck. That's the way it always works. That's how you get stuff that kicks ass." -Andrew Plotkin
"Yes, ninety percent would never get finished, and ninety percent of the rest would suck. That's the way it always works. That's how you get stuff that kicks ass." -Andrew Plotkin
-
- Regular
- Posts: 68
- Joined: Thu Jun 19, 2008 1:27 am
- Completed: Watashi wa Onigiri, A Day Off, T.M.O.G.E
- Projects: None.
- Contact:
Re: Questions RE: Several Functions for a Game
How would I make it so that the spells are learnable, from things like say, meditation, library research, or using a certain item?
Also, still looking for how to do the mini game and shop/inventory/gift system. Last one preferably with currency.
I appreciate the help. I only started learning Ren'Py successfully yesterday. I tried it once or twice about three or four years ago, and failed miserably because I couldn't understand it, along with being impatient.
The patience was fixed with meditation and alternative religion, and the understanding it is now possible because of the wiki dedicated to Ren'Py, but that's not important.
Also, still looking for how to do the mini game and shop/inventory/gift system. Last one preferably with currency.
I appreciate the help. I only started learning Ren'Py successfully yesterday. I tried it once or twice about three or four years ago, and failed miserably because I couldn't understand it, along with being impatient.
The patience was fixed with meditation and alternative religion, and the understanding it is now possible because of the wiki dedicated to Ren'Py, but that's not important.
-
- Regular
- Posts: 63
- Joined: Wed Aug 01, 2007 11:11 pm
- Contact:
Re: Questions RE: Several Functions for a Game
Uhhh... the player does the thing, and you set the variable. Very basic.deinarious wrote:How would I make it so that the spells are learnable, from things like say, meditation, library research, or using a certain item?
----
"Yes, ninety percent would never get finished, and ninety percent of the rest would suck. That's the way it always works. That's how you get stuff that kicks ass." -Andrew Plotkin
"Yes, ninety percent would never get finished, and ninety percent of the rest would suck. That's the way it always works. That's how you get stuff that kicks ass." -Andrew Plotkin
-
- Regular
- Posts: 68
- Joined: Thu Jun 19, 2008 1:27 am
- Completed: Watashi wa Onigiri, A Day Off, T.M.O.G.E
- Projects: None.
- Contact:
Re: Questions RE: Several Functions for a Game
*facepalms* right! I forgot that!
-edit- quick question : how do I make a variable properly? just want to make sure I have the right idea.
-edit- quick question : how do I make a variable properly? just want to make sure I have the right idea.
-
- Eileen-Class Veteran
- Posts: 1265
- Joined: Fri Aug 31, 2007 7:02 am
- Projects: 0 completed game. Still haven't made any meaningfully completed games...
- Contact:
Re: Questions RE: Several Functions for a Game
I don't really know what is proper but this would work for the kamehameha case:deinarious wrote:how do I make a variable properly?
Code: Select all
$ Kamehameha='known'
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.
-
- Regular
- Posts: 68
- Joined: Thu Jun 19, 2008 1:27 am
- Completed: Watashi wa Onigiri, A Day Off, T.M.O.G.E
- Projects: None.
- Contact:
Re: Questions RE: Several Functions for a Game
yeah, that must be what was wrong with my variables.
Re: Questions RE: Several Functions for a Game
About the only thing to watch for with variables is that if you want them to work for rollback and saving they should be in the start: (or any subsequent) label and not in the init: label.deinarious wrote:*facepalms* right! I forgot that!
-edit- quick question : how do I make a variable properly? just want to make sure I have the right idea.
Code: Select all
start:
$ my_first_variable = 'something-or-other' # words or text
$ my_second_variable = 10 # a number
Last edited by Gau_Veldt on Fri Jun 20, 2008 6:32 am, edited 2 times in total.
Re: Questions RE: Several Functions for a Game
He means:
(I presume the extra ']' was a markup-code accident)
Also note that if you're dealing with numbers you don't need the single-quotes:
- if you use the single quotes it means you're dealing with text. If you're usisg numbers, then don't use the single quotes and you can do stuff like:
Code: Select all
$ my_variable = 'some_value'
Also note that if you're dealing with numbers you don't need the single-quotes:
Code: Select all
$ my_numeric_variable = 10
Code: Select all
$ a = 10
$ b = 5 + a
if (b > 10):
e "Hey look, a number above ten!"
Server error: user 'Jake' not found
Re: Questions RE: Several Functions for a Game
Any particular minigames would involve dabbling with Displayables and PyGame (look in the cookbook for examples). You might look at the Pong example in the demo as a starting point. Generally speaking minigames will be harder to do than the overall game's script.deinarious wrote:Okay, I am new to Ren'Py (and programming in general), and I had some questions regarding functions I wanted to add to my game.
First off, how would I make a mini-game that required the player to match a set of keys or symbols, perhaps even musical notes, that rewarded the player with something, like bonus points for a certain girl, or an item?
Second, how would I make a shop system that coincided with an inventory system and a gift giving system?
And third, how would I make a special power system, like spells or such, along with stats to go with them? My thought was to make a few spells that the player would know from the start, and would learn through various parts of the game, to do things like predict what the favorable response would be for a question, or to impress the characters that the player is trying to win over.
Please respond.
Details of any particular minigame you want to do would involve coming up with a formulation of what happens in any minigame you want to make (example for the demo might go something like: ball bounces on top and bottom of screen and paddles. player has left side. computer has right. each player and moves their paddle. player gets a point when other player's paddle misses the ball. first player to 10 wins.)
Giving rewards is just a case of testing (with if) against the outcome of the minigame then adding any reward (by setting variables to represent reward items) if the outcome of the game is appropriate to any rewards.
For a shop system you'll want to look a bit into the Python under the Ren'Py hood. Most undoubtedly the list and dictionary types since they help greatly with this kind of task.
A very simplistic item system would use a list whose elements are the "names" of the items. You can then use the find() method to see if a player has a certain item.
Code: Select all
$ inventory=[
'apple',
'peach'
]
Code: Select all
if inventory.find('apple'):
e "Oh, an apple! May I have it?"
else:
e "My, isn't the weather nice today?"
Re: Questions RE: Several Functions for a Game
I made the example in a way that documented itself. A number doesn't really do that. And yeah markup glitch. 'tis been edited out.Jake wrote:He means:(I presume the extra ']' was a markup-code accident)Code: Select all
$ my_variable = 'some_value'
Also note that if you're dealing with numbers you don't need the single-quotes:
- if you use the single quotes it means you're dealing with text. If you're usisg numbers, then don't use the single quotes and you can do stuff like:Code: Select all
$ my_numeric_variable = 10
Code: Select all
$ a = 10 $ b = 5 + a if (b > 10): e "Hey look, a number above ten!"
Re: Questions RE: Several Functions for a Game
Hey, hey, I'm not criticising you. Just noting that a lot of the time people will want to store numbers, and if they believe that they have to put single quotes around all their values then they're going to get confused when they try and do calculations with them.Gau_Veldt wrote: I made the example in a way that documented itself. A number doesn't really do that.
Server error: user 'Jake' not found
Who is online
Users browsing this forum: Ahrefs [Bot], Andredron