Some Ren'Py questions

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
Vantri
Newbie
Posts: 2
Joined: Sat Jun 18, 2011 8:38 am
Contact:

Some Ren'Py questions

#1 Post by Vantri »

Hello everyone!

I'm new to Ren'Py but I'm having fun doing things in it already! :)

There are some things I want to do but don't really understand how to get to work or happen.
First, I've made a variable and defined it, but then I want to be able to have it shown in text. For example, I make a gift variable and can get different gifts, but then in the game someone asks what gift I bought I want it to be "I bought (gift) for...". Is it possible?

Second, I was thinking of making some simple dating sim like game with the limited knowledge of the Ren'Py and Python language I have. But then I hit a roadblock when I wanted to have a energy bar/meter in the game that changed as you did things. I can't even get an energy bar/meter into the game, how do you do that?

Third, related to making the sim game, I want to be able to move to different locations on a map, so you can click on different locations and move there like in traditional dating sim games. How is that done?

Hope someone can answer my questions :)

User avatar
Camille
Eileen-Class Veteran
Posts: 1227
Joined: Sat Apr 23, 2011 2:43 pm
Completed: Please see http://trash.moe
Projects: the head well lost
Organization: L3
Tumblr: narihira
Deviantart: crownwaltz
itch: lore
Contact:

Re: Some Ren'Py questions

#2 Post by Camille »

Welcome! :3

1. Yep, just have your text be like:

Code: Select all

"I bought %(gift)s for..."
The %(VARIABLE)s will output whatever you have VARIABLE set to, whether it's a number or a string.

2. Have you tried using/looking at the dating sim framework for Ren'Py? It includes all that sort of stuff. :3 But basically you'd have to define the bar somewhere and then show it on the game screen by using a screen or overlay. There's a Cookbook recipe that explains how to add an RPG frame with health bars and stuff, so maybe you can look at that and adapt it.

3. Generally you do that by making an image map. Just make it so whenever you click on a certain location, it jumps to a certain label in the script. More info on imagemaps here.

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Some Ren'Py questions

#3 Post by Aleema »

I wrote an FAQ entry just for you on showing variables in text.

Have you tried the DSE engine? It includes the stat bar thingies, free of charge. :P

Also, do you know about imagemaps? That would help you with your "click something and go somewhere" question. There's even an example in the Ren'Py tutorial included with every download.

edit: kill it, Camille! :D

User avatar
Camille
Eileen-Class Veteran
Posts: 1227
Joined: Sat Apr 23, 2011 2:43 pm
Completed: Please see http://trash.moe
Projects: the head well lost
Organization: L3
Tumblr: narihira
Deviantart: crownwaltz
itch: lore
Contact:

Re: Some Ren'Py questions

#4 Post by Camille »

Aleema wrote:I wrote an FAQ entry just for you on showing variables in text.

Have you tried the DSE engine? It includes the stat bar thingies, free of charge. :P

Also, do you know about imagemaps? That would help you with your "click something and go somewhere" question. There's even an example in the Ren'Py tutorial included with every download.

edit: kill it, Camille! :D
It's kind of crazy how similar our phrasing was for the second question/answer, haha. 0_o!

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Some Ren'Py questions

#5 Post by Aleema »

Get out of my braaaain.

Vantri
Newbie
Posts: 2
Joined: Sat Jun 18, 2011 8:38 am
Contact:

Re: Some Ren'Py questions

#6 Post by Vantri »

You guys/girls really managed to answer almost at the same time x'D

1. Thanks, that solved that question really neatly, does what I want it to do now :3

2. I've looked at it quickly, but thanks it will probably help me with what I need :)

3. Ohh, image map, I see. Thank you a lot!

Thanks a lot for the answers, it really helped a lot. Will study it a little and try to make it work on my game ;)

Mohawk
Newbie
Posts: 4
Joined: Wed Jan 28, 2015 5:29 am
Contact:

Re: Some Ren'Py questions

#7 Post by Mohawk »

There's a Cookbook recipe that explains how to add an RPG frame with health bars and stuff, so maybe you can look at that and adapt it.
I tried that one, but I haven't found how to add in-combat commands (things like "punching", "using magic", the usual stuff). Adding a menu doesn't work for some reason, which means no commands.
And I don't want to use the DSE because it adds stuff I don't really need and given my lame skills, I don't want to choke on it.

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Some Ren'Py questions

#8 Post by philat »

That's a very old tutorial. Try looking at some newer examples.

http://lemmasoft.renai.us/forums/viewto ... =8&t=23077

http://lemmasoft.renai.us/forums/viewto ... 51&t=30095

http://lemmasoft.renai.us/forums/viewto ... =8&t=29749

Not saying these will fit your purposes perfectly, but it's a place to start.

Mohawk
Newbie
Posts: 4
Joined: Wed Jan 28, 2015 5:29 am
Contact:

Re: Some Ren'Py questions

#9 Post by Mohawk »

philat wrote:That's a very old tutorial. Try looking at some newer examples.

http://lemmasoft.renai.us/forums/viewto ... =8&t=23077

http://lemmasoft.renai.us/forums/viewto ... 51&t=30095

http://lemmasoft.renai.us/forums/viewto ... =8&t=29749

Not saying these will fit your purposes perfectly, but it's a place to start.
I appreciate, but unfortunately these are a little too advanced, both for me and for the game.
Because I want the game to be focused on the story rather than being a RPG, I want the fights to be simple.

If I were to compare, I'd say that my ideal is a mix between the Metal Gear games (with a good ol' health bar because I like 'em), and a combat system like in the game NEOScavenger, where the fights are more like brawls, with the characters moving back and forth, trying to ram into each other, and tackling each other. The main idea being that each boss has something he's good at, and that if the player character can't talk the boss down, there's a fight.
I managed to make something without relying on customs scripts, but it was extremely linear, and, since health bars were loaded as characters sprites, it was also ugly as hell (and also I couldn't figure how to use persistent health bars, so each loop reset everyone's health). The script in this page makes good-looking UI that I really liked, but I haven't found how to add interactions, and I think it may be simpler to learn how to add these rather than trying another script that will add too much stuff. Sorry to be annoying, but I don't really need precision stats, dodge or different kind of damage.

And since I'm hilariously bad at this code python thing, I can't really figure out what I can use and what I shouldn't, so I can't really nitpick peculiar stuff from the RPG battle engine or Shirra's thingy.

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Some Ren'Py questions

#10 Post by philat »

Well, having actually run the code, the reason it's not letting you do anything is because it's set to simulate a battle right now. Also, I still think the old ui functions are way more complicated for beginners to understand than screen language is.

For instance, this screen does pretty much the same thing, in a much simpler and more readable format. (Well, minus the simulating a battle part.)

In short, I really recommend that you look at the basics of screen language (especially bars, I suppose http://lemmasoft.renai.us/forums/viewto ... 51&t=27332 ) and work from there. There are some good tutorials in the cookbook section.

Code: Select all

init python:
    player_name = "Player"
    char_level = 1
    char_HP = 100
    charmax_HP = 100
    enemy_name = "Tiger"
    enemy_level = 4
    enemy_HP = 100
    enemymax_HP = 100


screen battlestats():
    hbox:
        spacing 100
        frame:
            background "#222"
            has vbox

            hbox:
                text "[player_name] "
                text "Level [char_level]"
            bar value char_HP range charmax_HP xsize 250
        frame:
            background "#222"
            has vbox
            
            hbox:
                text "[enemy_name] "
                text "Level [enemy_level]"
            bar value enemy_HP range enemymax_HP xsize 250

label start:

    show screen battlestats

    menu battle_loop:
        "Attack":
            $ enemy_HP -= 1
            jump battle_loop
        "Run away":
            jump end

label end:
    "You ran away."
    return

Mohawk
Newbie
Posts: 4
Joined: Wed Jan 28, 2015 5:29 am
Contact:

Re: Some Ren'Py questions

#11 Post by Mohawk »

Yeah, it looks like I don't be able to avoid getting my hands dirty with code. Can't exactly say I'm looking forward to it, code is like Chinese to me.

Oh, and the code you pasted doesn't seem work :

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the errors listed below, and try again.

File "game/script.rpy", line 59: u'xsize' is not a keyword argument or valid child for the bar statement.
    bar value char_HP range charmax_HP xsize 250
                                                            ^

File "game/script.rpy", line 87: Line is indented, but the preceding say statement statement does not expect a block. Please check this line's indentation.
    show screen battlestats
    ^
Nonetheless, thanks for your time. I'll see what I can do with the tutorial, otherwise, I'll just do without. I don't want to give up because something doesn't work as intended.

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Some Ren'Py questions

#12 Post by philat »

Are you running an old version of renpy? The code runs on 6.18.

Mohawk
Newbie
Posts: 4
Joined: Wed Jan 28, 2015 5:29 am
Contact:

Re: Some Ren'Py questions

#13 Post by Mohawk »

philat wrote:Are you running an old version of renpy? The code runs on 6.18.
Good Lord, this is embarrassing. I should deactivate that account and make a new one.

Nonetheless, I am truly grateful for your help.

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Some Ren'Py questions

#14 Post by philat »

No problem, glad I could help. Good luck with the rest of your game.

Post Reply

Who is online

Users browsing this forum: No registered users