xela wrote:
Add this to your init python and run the error again.
You have something in your code that cannot be pickled (no clue as to why it was working before now). Maybe a lambda or a nested function.
That didn't fix the issue, but it has helped me narrow down the problem! Thanks.
A while ago a user on here gave me coding advice to create a parallax effect in the game so that the scene background would move along with any mouse movement from the player. For some reason that code seems to be causing the issue, as I can finally avoid save-crashing when I remove it. Now the question is to figure out why it's causing the save crash, and how to fix whatever's causing the conflict.
Here's the code in question, if you (or anyone else, for that matter) has any ideas.
Code: Select all
init 800 python:
class MouseParallax(renpy.Displayable):
def __init__(self,layer_info):
super(renpy.Displayable,self).__init__()
self.xoffset,self.yoffset=0.0,0.0
self.sort_layer=sorted(layer_info,reverse=True)
cflayer=[]
masteryet=False
for m,n in self.sort_layer:
if(not masteryet)and(m<0):
cflayer.append("master")
masteryet=True
cflayer.append(n)
if not masteryet:
cflayer.append("master")
cflayer.extend(["transient","screens","overlay"])
config.layers=cflayer
config.overlay_functions.append(self.overlay)
return
def render(self,width,height,st,at):
return renpy.Render(width,height)
def parallax(self,m):
def trans(d,st,at):
d.xoffset,d.yoffset=(int)(m*self.xoffset),(int)(m*self.yoffset)
return 0
return Transform(function=trans)
def overlay(self):
ui.add(self)
for m,n in self.sort_layer:
renpy.layer_at_list([self.parallax(m)],n)
return
def event(self,ev,x,y,st):
import pygame
if ev.type==pygame.MOUSEMOTION:
self.xoffset,self.yoffset=((float)(x)/(config.screen_width))-0.5,((float)(y)/(config.screen_height))+0.0
return
MouseParallax([(400,"farback"),(200,"back"),(100,"front"),(-400,"inyourface")])