9 years ago
Issue with old saves and mods that involve interactions or edited needs?
My knowledge of the python scripts for this game is really limited and I've got no idea where this issue might be coming from, so I figured I'd ask some of you who I know are more familiar with python (or just know the game in general... SimGuruModSquad :P) and see if you have any thoughts on it, or if you're into technical things, you might find it an interesting problem.
@Neia
@TURBODRIVER
@SimGuruModSquad
The long and short of it is, with the new patch, old saves that had Sorcerers in them from my mod are getting a lastexception error like this:
The most important part seems to be the:
At first, I thought it was an issue with the scripts themselves. They use an injector to add new interactions and code like this:
Never had issues with it prior to the patch, but I thought maybe it was something related to it. Weird thing is, if I make a NEW save (post-patch) and make my sim into a Sorcerer, per the mod's parameters, that save doesn't seem to have any issues. I can save it and load it as if this issue never existed. It only seems to be pre-patch saves that are affected.
For now, I came up with a workaround, which is essentially to remove the mod and then save a copy of the now Sorcerer-free save, so that it can be loaded cleanly with the Sorcerer mod installed, without losing what else it has and then Sorcerer stuff can be re-added in that same save.
But I don't know if that's a workaround that will last and if for no other reason than the sheer knowing of it, I want to understand why something like this happened.
I mean, the old saves load fine if the mod is not installed, new saves load fine with it installed. So it seems like it's gotta be something in the save information itself that conflicts with a way in which the game was changed. But why would my mod specifically have some kind of information saved that conflicts? Information that only causes a problem when the mod is installed and only on saves prior to the patch?
I just spent hours trying to narrow down where the load issue is, so my brain is a bit fried. Could be I'm overthinking this. Doesn't make a lot of sense atm though.
@Neia
@TURBODRIVER
@SimGuruModSquad
The long and short of it is, with the new patch, old saves that had Sorcerers in them from my mod are getting a lastexception error like this:
2 84459c6f8b8b092559273885 desync ea.maxis.sims4_64.15.pc 2017-05-25 16:14:06 Local.Unknown.Unknown.1.30.103.1010-1.300.000.96.Release state.py:1661 84459c6f8b8b092559273885 Exception while creating sims, sim_id=493994472144306196; failed (AttributeError: 'NoneType' object has no attribute 'use_stat_value_on_initialization') Traceback (most recent call last): File "T:\InGame\Gameplay\Scripts\Server\areaserver.py", line 111, in wrapped File "T:\InGame\Gameplay\Scripts\Server\areaserver.py", line 107, in finally_wrap File "T:\InGame\Gameplay\Scripts\Core\sims4\utils.py", line 173, in wrapper File "T:\InGame\Gameplay\Scripts\Core\sims4\utils.py", line 191, in wrapper File "T:\InGame\Gameplay\Scripts\Server\areaserver.py", line 356, in c_api_client_connect File "T:\InGame\Gameplay\Scripts\Server\zone.py", line 483, in do_zone_spin_up File "T:\InGame\Gameplay\Scripts\Server\zone_spin_up_service.py", line 1138, in update File "T:\InGame\Gameplay\Scripts\Server\zone_spin_up_service.py", line 537, in on_enter File "T:\InGame\Gameplay\Scripts\Server\sims\sim_spawner_service.py", line 584, in batch_spawn_during_zone_spin_up File "T:\InGame\Gameplay\Scripts\Server\sims\sim_spawner_service.py", line 755, in _spawn_next_sim File "T:\InGame\Gameplay\Scripts\Server\sims\sim_spawner_service.py", line 787, in _spawn_requested_sim File "T:\InGame\Gameplay\Scripts\Server\sims\sim_spawner.py", line 313, in spawn_sim File "T:\InGame\Gameplay\Scripts\Server\sims\sim_info.py", line 1668, in create_sim_instance File "T:\InGame\Gameplay\Scripts\Server\objects\system.py", line 178, in create_object File "T:\InGame\Gameplay\Scripts\Server\objects\object_manager.py", line 494, in add File "T:\InGame\Gameplay\Scripts\Server\indexed_manager.py", line 152, in add File "T:\InGame\Gameplay\Scripts\Server\indexed_manager.py", line 268, in call_pre_add File "T:\InGame\Gameplay\Scripts\Server\sims\sim.py", line 2262, in pre_add File "T:\InGame\Gameplay\Scripts\Server\objects\components\__init__.py", line 92, in wrapped_method File "T:\InGame\Gameplay\Scripts\Server\objects\components\state.py", line 1661, in pre_add AttributeError: 'NoneType' object has no attribute 'use_stat_value_on_initialization'
The most important part seems to be the:
"T:\InGame\Gameplay\Scripts\Server\objects\components\state.py", line 1661, in pre_add AttributeError: 'NoneType' object has no attribute 'use_stat_value_on_initialization'
At first, I thought it was an issue with the scripts themselves. They use an injector to add new interactions and code like this:
import services
import Triplis_SorcererTrait_Injector
import sims.sim
import sims4.resources
from sims4.tuning.instance_manager import InstanceManager
from sims4.resources import Types
import objects.game_object
#SuperAffordances to Objects code structure originally by TheFoodGroup of MTS
#Adapted/used for objects and for Mixers to Snippets by Triplis
Triplis_SorcererTrait_Interactions_sa_to_objects =
Triplis_SorcererTrait_Interactions_mixer_to_snippets =
Triplis_SorcererTrait_Interactions_sa_instance_ids = (15637114959971654166, 17956754764064186480, 18223974517353246826, 10257892382521782328, 13207307475727282152, 15775708450489890343, 10548302199666969406, 11787609329977441829, 17565522103389469685, 13534504451029703004, 15262449686936737821, 18218869284778878145, 13231897427706895428, 17860231607360189656, 16639758558078259438, 11094863792259477513, 13250546842406808257, 12025535218494338879, 15727144965150744557, 12638526487282842888, 15198688674050695837, 12395990693228806593, 13239673440695320889, 13660689571040598607, 10279806041534929123, 14333155500551188841, 11200444586579120597, 10458676601500530505, 10228118086517851733, 13703229026582681329, 14949459108761024598, 17385586641172972108, 16585455976159330857, 16746233815942520933, 15702232757022073517, 13425038154883720197, 17537670152126568118, 16840735687703362752, 13144850200480067617, 18003109359191902093, 17403496901651142481, 13684313206131528096, 10271962828287349957, 15168663946995751965)
@Triplis_SorcererTrait_Injector.inject_to(InstanceManager, 'load_data_into_class_instances')
def Triplis_Sorcerer_add_super_affordances_to_objects(original, self):
original(self)
if self.TYPE == Types.OBJECT:
# For each set of interaction ids and object ids...
for obj_tun_hash in Triplis_SorcererTrait_Interactions_sa_to_objects:
# First, get a tuple containing the tunings for all the super affordances...
affordance_manager = services.affordance_manager()
sa_list = []
for sa_id in obj_tun_hash:
key = sims4.resources.get_resource_key(sa_id, Types.INTERACTION)
sa_tuning = affordance_manager.get(key)
if not sa_tuning is None:
sa_list.append(sa_tuning)
sa_tuple = tuple(sa_list)
# Now update the tunings for all the objects in our object list
for obj_id in obj_tun_hash:
key = sims4.resources.get_resource_key(obj_id, Types.OBJECT)
obj_tuning = self._tuned_classes.get(key)
if not obj_tuning is None:
obj_tuning._super_affordances = obj_tuning._super_affordances + sa_tuple
@Triplis_SorcererTrait_Injector.inject_to(InstanceManager, 'load_data_into_class_instances')
def Triplis_Sorcerer_add_mixers_to_snippets(original, self):
original(self)
if self.TYPE == Types.SNIPPET:
# For each set of interaction ids and object ids...
for snippet_tun_hash in Triplis_SorcererTrait_Interactions_mixer_to_snippets:
# First, get a tuple containing the tunings for all the social mixers...
affordance_manager = services.affordance_manager()
mixer_list = []
for mixer_id in snippet_tun_hash:
key = sims4.resources.get_resource_key(mixer_id, Types.INTERACTION)
mixer_tuning = affordance_manager.get(key)
if not mixer_tuning is None:
mixer_list.append(mixer_tuning)
mixer_tuple = tuple(mixer_list)
# Now update the tunings for all the snippets in our snippet list
for snippet_id in snippet_tun_hash:
key = sims4.resources.get_resource_key(snippet_id, Types.SNIPPET)
snippet_tuning = self._tuned_classes.get(key)
if not snippet_tuning is None:
snippet_tuning.value = snippet_tuning.value + mixer_tuple
@Triplis_SorcererTrait_Injector.inject_to(sims.sim.Sim, 'on_add')
def Triplis_SorcerTrait_Interactions_add_super_affordances(original, self):
original(self)
sa_list = []
affordance_manager = services.affordance_manager()
for sa_id in Triplis_SorcererTrait_Interactions_sa_instance_ids:
tuning_class = affordance_manager.get(sa_id)
if not tuning_class is None:
sa_list.append(tuning_class)
self._super_affordances = self._super_affordances + tuple(sa_list)
Never had issues with it prior to the patch, but I thought maybe it was something related to it. Weird thing is, if I make a NEW save (post-patch) and make my sim into a Sorcerer, per the mod's parameters, that save doesn't seem to have any issues. I can save it and load it as if this issue never existed. It only seems to be pre-patch saves that are affected.
For now, I came up with a workaround, which is essentially to remove the mod and then save a copy of the now Sorcerer-free save, so that it can be loaded cleanly with the Sorcerer mod installed, without losing what else it has and then Sorcerer stuff can be re-added in that same save.
But I don't know if that's a workaround that will last and if for no other reason than the sheer knowing of it, I want to understand why something like this happened.
I mean, the old saves load fine if the mod is not installed, new saves load fine with it installed. So it seems like it's gotta be something in the save information itself that conflicts with a way in which the game was changed. But why would my mod specifically have some kind of information saved that conflicts? Information that only causes a problem when the mod is installed and only on saves prior to the patch?
I just spent hours trying to narrow down where the load issue is, so my brain is a bit fried. Could be I'm overthinking this. Doesn't make a lot of sense atm though.