Replies: 100 (Who?), Viewed: 129554 times.
Page 5 of 5
Test Subject
#101 Old 20th Sep 2019 at 9:34 AM
Trying to get herbalism added to cauldrons from Realm of Magic.

import services
import injector
import sims4.resources
from sims4.tuning.instance_manager import InstanceManager
from sims4.resources import Types

cauldron_herbalism_sa_instance_ids = 103876
cauldron_herbalism_object_ids = (
218784, 213440)

@injector.inject_to(InstanceManager, 'load_data_into_class_instances')
def add_superaffordances(original, self):

    if self.TYPE == Types.OBJECT:
        # First, get a tuple containing the tunings for all the super affordances...
        affordance_manager = services.affordance_manager()
        sa_list = []
        for sa_id in cauldron_herbalism_sa_instance_ids:
            key = sims4.resources.get_resource_key(sa_id, Types.INTERACTION)
            sa_tuning = affordance_manager.get(key)
            if not sa_tuning is None:
        sa_tuple = tuple(sa_list)

        # Now update the tunings for all the objects in our object list
        for obj_id in cauldron_herbalism_object_ids:
            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_tupl

Not even sure if this would correctly do it or not.
Test Subject
24th Jan 2020 at 10:45 AM Last edited by Erisa : 24th Jan 2020 at 10:50 AM. Reason: Editing code
Adding new interactions to objects and sims with python
This message has been deleted by Erisa. Reason: I figured out the correct code
Page 5 of 5
Back to top