Post by aneta1992 on Mar 29, 2024 12:58:22 GMT -5
Hi All,
Please could you help and advise why is the below not working?
I don't have much experience with modding, only starting to tinker about with python and tunning so please bear with me
I wanted to make changes to the Club Filters in Relationship Filter to be able select Sims that are not only married but also either engaged or dating.
Once I load the game and enter the club my sim is in and go to options there are 2 entries under Relationship category: Single with correct icon and empty one with invalid icon. If I click on either option I can see a red cross against all club members and all of them are single.
Any help will be appreciatted!
These are the following changes I've made in club_tunning
class MaritalStatus(enum.Int):
SPOKENFOR = 0
SINGLE = 1
CLUB_DISPLAY_INFO_MARITAL_STATUS = TunableMapping(description='\n Tunable Mapping from MaritalStatus enums to their associated display\n names and icons.\n ', key_type=TunableEnumEntry(description='\n A MaritalStatus enum entry.\n ', tunable_type=MaritalStatus, default=MaritalStatus.SPOKENFOR), value_type=TunableTuple(name=TunableLocalizedString(description='\n The name to associate with this enum entry.\n '), icon=TunableIcon(description='\n The icon to associate with this enum entry.\n ')))
class ClubRuleCriteriaRelationship(ClubRuleCriteriaBase):
CATEGORY = ClubCriteriaCategory.RELATIONSHIP
FACTORY_TUNABLES = {'marital_status': TunableEnumEntry(description='\n Marital status a Sim must have in order to pass this criteria.\n ', tunable_type=MaritalStatus, default=MaritalStatus.SPOKENFOR)}
def __init__(self, *args, marital_status=None, criteria_infos=None, **kwargs):
super().__init__(*args, marital_status=marital_status, **kwargs)
if criteria_infos is not None:
self.marital_status = criteria_infos[0].enum_value
@classmethod
def _populate_criteria_info(cls, criteria_info, marital_status):
possibility_space = ClubTunables.CLUB_DISPLAY_INFO_MARITAL_STATUS.get(marital_status)
if possibility_space is None:
return
criteria_info.name = possibility_space.name
criteria_info.icon = sims4.resources.get_protobuff_for_key(possibility_space.icon)
criteria_info.enum_value = marital_status
@classmethod
def populate_possibilities(cls, criteria_proto):
for marital_status in MaritalStatus:
with ProtocolBufferRollback(criteria_proto.criteria_infos) as criteria_info:
cls._populate_criteria_info(criteria_info, marital_status)
return super().populate_possibilities(criteria_proto)
def save(self, club_criteria):
with ProtocolBufferRollback(club_criteria.criteria_infos) as criteria_info:
self._populate_criteria_info(criteria_info, self.marital_status)
return super().save(club_criteria)
def test_sim_info(self, sim_info):
is_spokenfor = sim_info.signficant_other_id is not None
if self.marital_status == MaritalStatus.SPOKENFOR:
return is_spokenfor
elif self.marital_status == MaritalStatus.SINGLE:
return not is_spokenfor
and also in tunning file clubs.club_tunning
<L n="CLUB_DISPLAY_INFO_MARITAL_STATUS">
<U>
<E n="key">SPOKENFOR</E>
<U n="value">
<T n="icon" p="InGame\UI\Icons\SimSocialStatus\SimSocialStatus_Rel_Married.png">2f7d0004:00000000:2df34abdc4b8f36c</T>
<T n="name">0xC252E69D<!--String: "Spoken For"--></T>
</U>
</U>
<U>
<E n="key">SINGLE</E>
<U n="value">
<T n="icon" p="InGame\UI\Icons\SimSocialStatus\SimSocialStatus_Rel_UnMarried.png">2f7d0004:00000000:b2687c7c97eb6ec3</T>
<T n="name">0xEEE4EEA8<!--String: "Single"--></T>
</U>
</U>
</L>
<T n="MARRIAGE_REL_BIT">15825<!--RelationshipBit: romantic-Significant_Other--></T>
Please could you help and advise why is the below not working?
I don't have much experience with modding, only starting to tinker about with python and tunning so please bear with me
I wanted to make changes to the Club Filters in Relationship Filter to be able select Sims that are not only married but also either engaged or dating.
Once I load the game and enter the club my sim is in and go to options there are 2 entries under Relationship category: Single with correct icon and empty one with invalid icon. If I click on either option I can see a red cross against all club members and all of them are single.
Any help will be appreciatted!
These are the following changes I've made in club_tunning
class MaritalStatus(enum.Int):
SPOKENFOR = 0
SINGLE = 1
CLUB_DISPLAY_INFO_MARITAL_STATUS = TunableMapping(description='\n Tunable Mapping from MaritalStatus enums to their associated display\n names and icons.\n ', key_type=TunableEnumEntry(description='\n A MaritalStatus enum entry.\n ', tunable_type=MaritalStatus, default=MaritalStatus.SPOKENFOR), value_type=TunableTuple(name=TunableLocalizedString(description='\n The name to associate with this enum entry.\n '), icon=TunableIcon(description='\n The icon to associate with this enum entry.\n ')))
class ClubRuleCriteriaRelationship(ClubRuleCriteriaBase):
CATEGORY = ClubCriteriaCategory.RELATIONSHIP
FACTORY_TUNABLES = {'marital_status': TunableEnumEntry(description='\n Marital status a Sim must have in order to pass this criteria.\n ', tunable_type=MaritalStatus, default=MaritalStatus.SPOKENFOR)}
def __init__(self, *args, marital_status=None, criteria_infos=None, **kwargs):
super().__init__(*args, marital_status=marital_status, **kwargs)
if criteria_infos is not None:
self.marital_status = criteria_infos[0].enum_value
@classmethod
def _populate_criteria_info(cls, criteria_info, marital_status):
possibility_space = ClubTunables.CLUB_DISPLAY_INFO_MARITAL_STATUS.get(marital_status)
if possibility_space is None:
return
criteria_info.name = possibility_space.name
criteria_info.icon = sims4.resources.get_protobuff_for_key(possibility_space.icon)
criteria_info.enum_value = marital_status
@classmethod
def populate_possibilities(cls, criteria_proto):
for marital_status in MaritalStatus:
with ProtocolBufferRollback(criteria_proto.criteria_infos) as criteria_info:
cls._populate_criteria_info(criteria_info, marital_status)
return super().populate_possibilities(criteria_proto)
def save(self, club_criteria):
with ProtocolBufferRollback(club_criteria.criteria_infos) as criteria_info:
self._populate_criteria_info(criteria_info, self.marital_status)
return super().save(club_criteria)
def test_sim_info(self, sim_info):
is_spokenfor = sim_info.signficant_other_id is not None
if self.marital_status == MaritalStatus.SPOKENFOR:
return is_spokenfor
elif self.marital_status == MaritalStatus.SINGLE:
return not is_spokenfor
and also in tunning file clubs.club_tunning
<L n="CLUB_DISPLAY_INFO_MARITAL_STATUS">
<U>
<E n="key">SPOKENFOR</E>
<U n="value">
<T n="icon" p="InGame\UI\Icons\SimSocialStatus\SimSocialStatus_Rel_Married.png">2f7d0004:00000000:2df34abdc4b8f36c</T>
<T n="name">0xC252E69D<!--String: "Spoken For"--></T>
</U>
</U>
<U>
<E n="key">SINGLE</E>
<U n="value">
<T n="icon" p="InGame\UI\Icons\SimSocialStatus\SimSocialStatus_Rel_UnMarried.png">2f7d0004:00000000:b2687c7c97eb6ec3</T>
<T n="name">0xEEE4EEA8<!--String: "Single"--></T>
</U>
</U>
</L>
<T n="MARRIAGE_REL_BIT">15825<!--RelationshipBit: romantic-Significant_Other--></T>