Ren'Py Ren'Py doesn't display live 2D motions

PaPalon

Newbie
Game Developer
Mar 3, 2023
20
77
I want to use live 2D instead of putting video in the game. I followed the video below:



When I use Live2D samples in Ren'Py, everything works very well and there are no problems.
I made an animation myself and acted according to the video and the samples. When I define the character, it shows it, but when I add motion to it, it gives an error!
My codes:
Python:
image Silv = Live2D("Silv", default_fade=0.0, loop=True)

show Silv Scene1
1713633149806.png
1713633178110.png
And this the Error:

Code:
```
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 42, in script
    show Silv Scene1
Exception: When showing Silv, Scene1 is not a known attribute.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 42, in script
    show Silv Scene1
  File "D:\Works\patreon\renpy-8.0.3-sdk\renpy\ast.py", line 1113, in execute
    show_imspec(self.imspec, atl=getattr(self, "atl", None))
  File "D:\Works\patreon\renpy-8.0.3-sdk\renpy\ast.py", line 1076, in show_imspec
    renpy.config.show(name,
  File "D:\Works\patreon\renpy-8.0.3-sdk\renpy\exports.py", line 739, in show
    if not base.find_target() and renpy.config.missing_show:
  File "D:\Works\patreon\renpy-8.0.3-sdk\renpy\display\image.py", line 421, in find_target
    self.target = target._duplicate(a)
  File "D:\Works\patreon\renpy-8.0.3-sdk\renpy\gl2\live2d.py", line 648, in _duplicate
    raise Exception("When showing {}, {} is not a known attribute.".format(" ".join(args.name), i))
Exception: When showing Silv, Scene1 is not a known attribute.

Windows-10-10.0.19045 AMD64
Ren'Py 8.2.1.24030407
Dr.Murph 0.3.9
Sat Apr 20 19:42:52 2024
```
Does anyone have any solution?
 
Last edited:

Turning Tricks

Rendering Fantasies
Game Developer
Apr 9, 2022
812
1,809
I know shit-all about Live 2D, but I just skimmed that video to where the ren'py code is added to look-see.

First obvious question is ... do you have a Scene1 motion in that motions folder?

Second question... Does the case match in your name of Scene1? Because Ren'py is case sensistive, so if you called attribute Scene1 but your actual motion file name is scene1, than that might be the error.

Only other thing I can think of is that using the name Scene1 is conflicting with predefined attributes and functions in Ren'py because "scene" is a core Ren'py statement for displayables. That's just a guess though.

Finally, and this is just my anal-retentive self coming out, but I prefer to define images using the full path and not just the folder. So "images/Silv" instead of just "Silv". I just started doing that a long time ago because there was some situations where Ren'py got confused over my declarations.

EDIT:

Just realized that you can place those Live 2D files anywhere. I was thrown when I saw the guy in that video put his in the image folder. So change question one to are your paths laid out properly? The Ren'py docs example shows the files in their own directory. Are your live 2D files in the root directory (ie: Game directory)? Maybe that's the issue? You could try putting the files in their own folder, say under "images" and then change the image declaration to this...

image Silv = Live2D("images/Silv", default_fade=0.0, loop=True)

live2d_filename.JPG
 
Last edited:

Turning Tricks

Rendering Fantasies
Game Developer
Apr 9, 2022
812
1,809
Just reading the Ren'py docs further, try this...

show silv scene1

It appears that Ren'py forces the names to lowercase, so you need to use that in your show statement.



live2d_use.JPG
 

PaPalon

Newbie
Game Developer
Mar 3, 2023
20
77
Thank you so much, the problem is solved!
I made a mistake at the beginning, I've chosen SDK unity instead of SDK. I fixed it then again don't work
image.png
Finally, and this is just my anal-retentive self coming out, but I prefer to define images using the full path and not just the folder. So "images/Silv" instead of just "Silv". I just started doing that a long time ago because there was some situations where Ren'py got confused over my declarations.
At the first time changing to full path didn't help but after fixing the SDK,
Then this helped ☝

It appears that Ren'py forces the names to lowercase, so you need to use that in your show statement.
And this isn't True
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,125
3,426
It appears that Ren'py forces the names to lowercase, so you need to use that in your show statement.
And this isn't True
It certainly is possible for case to be a problem - for operating systems that handle true case sensitivity vs faking it with metadata. Windows and *nix/*BSD act differently here, and python has it's own rules about dealing with filesystem name case.
 
  • Like
Reactions: PaPalon

PaPalon

Newbie
Game Developer
Mar 3, 2023
20
77
Hi
I have another problem
Some motions don't work correctly
When I show the motion, it doesn't show some parts of the body (character) (in some it doesn't show the lips, in some it doesn't show the whole face, and in some, it doesn't show the hand)
But when I refresh the Renpy (by pressing Shift + R), everything is fixed in the current motion. I don't know where the problem is.
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,125
3,426
I still don't know anything specific about Live2D...

But what you are describing sounds like the sub-part images are not loaded.

You can hint to renpy what images it should load into the cache. So maybe you can do that for all the parts before you display the live2D?

.... oh, I just found that the function "cache_pin" was removed in Renpy7.

There's some explanation of Image prediction for Live2d here .

And you could use the live2d logging to see if you can identify the problem?

You could also try changing the configuration variable to maybe store more images?
 

PaPalon

Newbie
Game Developer
Mar 3, 2023
20
77
I found a way
I've created a key for all parts(folders in Live2D) at the begining, for all animations and the problem solved
I think, Renpy has problem with empty parameters or parts (I mean parameters and parts without any animation key)
Thank you
 
  • Like
Reactions: osanaiko