Would anyone know how to make this work with an im.matrix function? I know it's a deprecated function, but some of my sprites appear darker/less saturated on Renpy than they actually are, and this has currently been my fix for them until I can replace them.
Renpy Auto Highlight
A downloadable asset pack for Windows, macOS, and Linux
This project is made to demonstrate an effect I'm calling, Auto Highlight. Its primary purpose is to allow you to subtly change sprites based on who is speaking in the dialogue, drawing attention to the speaker's sprite. All handled automatically, saving you from having to write ATL on every line of the script. The default implementation of this I've provided makes use of a small zoom and darkening of the sprite. But can easily be expanded to make use of other ATL properties based on the desired effect.
The main file of interest is the 00auto-highlight.rpy. It provides several comments to explain how it works and what you'll need to do to get it running. Be sure to read the setup comments near the top to know what you have to do to implement it.
Originally this was a minor effect that I created for Where the Demons Lurk. But it ended up being useful for both Beyond the Harbor: r and Burrows. As a result, I began to consider that it might be useful for other projects as well. So, I decided to release it so everyone has access to it.
Default implementation makes use of the matrixcolor ATL property, which is only available on Renpy 7.4 and above. But can be modified to work with earlier versions if you desire.
The code for this project is provided under the MIT license.
Luke and Kota sprites used with permission from https://minoh.itch.io/minotaur-hotel-sfw I do not claim ownership of the sprites. The sprites belong to their respective owners.
Demo script written by members of FVN in a voice call: https://discord.gg/GFjSPkh - FVN is an 18+ discord server. Do not join if you are a minor.
Beyond the Harbor: r Example from: https://harmoyena.itch.io/beyond-the-harbor - BtH:r is an 18+ VN with strong themes that are inappropriate for children
Burrows Example is from: https://itch.io/search?q=Burrows - Burrows is an 18+ VN with strong themes that are inappropriate for children
Click download now to get access to the following files:
Log in with itch.io to leave a comment.
Can you not use matrixcolor to accomplish the same thing?
Any advice on how to make this work on custom player names? It works for all of my other characters, but because I let the player choose their own name, the sprite doesn't highlight when they speak. Any thoughts?
define mc = Character("[mc_name]", callback=name_callback, cb_name="mc_light") layeredimage mc: at sprite_highlight('mc_light') always: "mc_base" group expressions: pos(70,62) attribute neutral default: "mc_neutral" attribute happy: "mc_happy" attribute sad: "mc_sad" attribute angry: "mc_angry" attribute surprised: "mc_surprised"
if blush: "mc_blush" layeredimage mchbrunch: at sprite_highlight('mc_light') always: "mc_brunch" group expressions: attribute neutral default: pos(163,125) "mc_neutral" attribute happy: pos(163,125) "mc_happy" attribute sad: pos(163,128) "mc_sad" attribute angry: pos(163,125) "mc_angry" attribute surprised: pos(163,125) "mc_surprised" if blush2: pos(165,115) "mc_blush2"
I cannot, for the life of me, get this to work with layered images. It only seems to work for me if I set the function SpriteFocus('sprite_name') per sprite call/update. Here's an example of one of my images and the associated character. I have no idea why this isn't working properly. It does not highlight at all (unless I manually set the sprite focus per call, which is tedious). Thoughts?
define Richard = Character("[Richard_name]", color="#5c00ff", callback = name_callback, cb_name = "ric", image='richard')
layeredimage richard: at sprite_highlight('richard') attribute normal default: "Richard" attribute angry: "Richard ANGRY" attribute annoyed: "Richard ANNOYED" attribute blush: "Richard BLUSH" attribute blush2: "Richard BLUSH 2" attribute crying: "Richard CRYING" attribute crying2: "Richard CRYING 2" attribute surprised: "Richard SURPRISED" attribute worried: "Richard WORRIED"
Figured it out! Turns out my layered images were being overridden by how I was calling the sprite later on in the script, thus the callback wasn't actually executing.
How exactly did you fix the issue? I'm using layered images, too, but I'm not really sure what I'm doing wrong
Edit: Nevermind, it was working the whole time but the zoom was so low that I didn't notice the change
Highlight works fine in all places, but it doesn't work here. What could this be related to?
In what way does it not work?
The highlight on the character "Mark" does not work here, but in all other dialogues with him it works. I tried changing the names of the files, as they only have differences in names, but it didn't help.
Right now I was thinking that it doesn't work because of the previous replica of this character. In front of her I have a sprite in the middle with two characters pushing each other and Mark is talking at this time. After that, the sprite of the two characters is removed and Mark speaks again. It is at this moment that highlight does not work on the character Mark.
It is here that the backlight and its animation on the character Mark do not work:
Maybe it has something to do with the 'with' transitions?
I tried to remove the "with dissolve" transition, but the highlight animation still didn't work.
As far as I can see from the sprites, the Van character is still darkened. And the highlight animation most likely does not work just because of the previous replica of the Mark character, since I noticed that after changing sprites with pushing two characters a little further than this moment, when the Van character has a replica, the highlight stays on it for a few milliseconds and goes to the Mark character when he speaks. I think I should come up with some kind of "stub" or something like that. Well, or leave it as it is. The rest works, I don't want to break everything because of this.
In any case, thank you for your time to this problem and many thanks for this script. This is very useful for people without Python programming skills.
This is really cool. Would it be possible to use this effect along with dialogue bleeps (since both of those effects use the callback parameter)? If so, what would be the best way to combine them? Thanks!
Actually, I just have to call my bleeps function within name_callback. In hindsight, I should've pieced that together much faster...
The effect is pretty cool. Thank you so much for the resource!
Is there a way to highlight both characters during narration? I am loving this script as a newbie to Renpy, so thank you sm for publishing it.
You're a god for releasing all of these cool stuff, THANK YOU.
how do i set this up?
Simply put the 00auto-highlight.rpy file in the game folder in your project. Instructions on how to use it are provided within the file itself and an example of how to make use of it is provided in script.rpy.
This is so cool, thank you so much!
holy crap wow
Yes, that does work. Though it has some issues. One is that it eats up a lot of unneeded file space. With your method, every image essentially requires twice as much file space. It saves a lot of file space if you do the color manipulation in the engine for basically free. And if you want to change the look of it a little, it's a lot easier this way, since you don't have to re-export every image. Albeit, the color part of this does require using Renpy 7.4, which doesn't work on some older devices.
The other issue is that then in your script, you have to write out every 'show' and 'hide' statement manually to swap between the two. Which is a fair amount of work and means you have to be sure you do it for every time who's speaking changes in the dialogue. Which might be a lot.
With my method, and a bit of setup, it does both of these effects automatically without any additional work needed or taking up additional file space. While I commend your method and think it is clever and certainly good for its time. I think this is a nice alternative for people going forward, if they wish to do it as well.
Hi, if I want to change the contrast instead of saturation, which line I have to change? (I actually have a faint idea but rather not mess with the calculation)
I don't believe Renpy has a class that directly affects contrast. But the list of predefined matrixes can be found here. https://www.renpy.org/doc/html/matrixcolor.html#built-in-colormatrix-subclasses
As for actually modifying it, you'll be doing that near the bottom of the 00auto-hightlight.rpy. Specifically around lines 186-192. You'll also likely want to add a change amount a bit higher with all the rest of them around 123-125. If you have any other questions I can answer, feel free to ask!
Ah I see, I thought it would be possible seeing this https://www.renpy.org/doc/html/im.html#im.matrix.contrast
but I might playing with available predefined matrixes a bit more
Oh! It would seem there is a ContrastMatrix that isn't mentioned in the matrixcolor documentation. So yeah, using ContrastMatrix should work I believe. Here's the source code to prove it exists.