[Solved] Creating/Showing a permenant image? Storing an image in a variable?

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
User avatar
auger
Newbie
Posts: 9
Joined: Tue Oct 16, 2018 2:48 am
Projects: Unnamed CYA Project
Contact:

[Solved] Creating/Showing a permenant image? Storing an image in a variable?

#1 Post by auger »

Hello, all. I've lurked for years, and I hate wasting peoples time on something I'm just too stupid to figure out, but so it goes.

I'd like to create a permanent image that shows when conditions are met; ideally it'd be as simple as "is variable x true" but, I'm open to more complicated solutions if that's all there is. To be super clear:

- I'm not looking to create a side image.
- I'd rather not have it depend on someone talking.
- The image should be present even during transitions, and should not be removed by the scene command.
- The image in question is a background, and stored as such.
- There's only the one image, and it represents battle/environment damage.

My goal is to basically have the image display if any one event that calls it occurs, with no option to remove it during a playthrough. Ideally it will persist throughout saves/reloads. It's my way of showing the player that they're in trouble, and one more bad decision, and..?! :shock: Well, nothing much'll actually happen, since they'll likely reload a save, but hopefully that gives you both the short shrift and the fluff of what I'm trying to do.

Thanks so much for your time.
Sorry again I have to bother you with something so stupid, I'm sure if I'd just kept diving posts I would've found it...

EDIT:

Figured it out myself; recording info here to help those searching for a similar topic but not sure where to look. Here's how I did it:

In options.rpy, add a new layer. Mine was 'battledamage.' The code will look like so. I might also separate 'environmentaldamage' into it's own thing, but...

# Segment defining layers here; you can add one if you don't have it

Code: Select all

config.layers = [ 'master', 'transient', 'battledamage', 'screens', 'overlay' ]
Then define your image as normal. Mine is:

Code: Select all

image damage1 = "effects/damage1.bmp"
Where effects is a subfolder, and damage1 is my art!

Finally, to show/remove battledamage is as simple as...

Code: Select all

show damage1 onlayer battledamage
hide damage1 onlayer battledamage with fade
:mrgreen: Neat. Hope that helps others out there...
Life is short; be kind.

Post Reply

Who is online

Users browsing this forum: No registered users