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

Code:
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):
    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_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 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
DELETED POST
24th Jan 2020 at 9:45 AM Last edited by Erisa : 24th Jan 2020 at 9: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
Test Subject
#102 Old 28th Mar 2021 at 9:11 PM
Quote:
Originally Posted by scumbumbo
I've written a bit of a tutorial that demonstrates how to build all the XML, SimData and attach the super affordances to an object. It's actually kind of a useful mod, too, I think I'll keep it in my game!

Attached is a zip file containing a PDF tutorial and all the example files. The mod adds an Enable and Disable Testing Cheats pie menu to the lot mailboxes.

EDIT 07/05/2018 - Fogity's Modding Toolbox as used in the tutorial is no longer available, so I have written an updated version available here in the Modding Tools forum.

Updated 11/26/2017 for latest game patch:
  • Changed interactions to ImmediateSuperInteraction class.
  • Updated tutorial PDF for S4PE changes to STBL edit process.
  • Updated script to use the game's cheat service.


Following Scumbumbo's tutorial (may you rest in peace), I was able to get the mailbox testing cheats interaction to work in my game. I used the Sims 4 Studio to create the .package file and I used PyCharm to modify the .py files provided in the zipped folder for the tutorial. I'm new to modding with Python so I don't fully understand how to add an interaction to an active sim. I'm trying to test the testing cheats interaction on an active sim instead of the mailbox but the Testing Cheats interaction doesn't show up when I click on my active sim. I've shared my files in case it's helpful.

Thanks all for your help!
Screenshots
Download - please read all instructions before downloading any files!
File Type: zip SimTestingCheats.zip (5.8 KB, 6 downloads)
Description: zipped folder
Test Subject
#103 Old 30th May 2021 at 9:43 AM
Default How to inject a Social Mixer to Social Super Interaction?
Hey, I don't know if anyone can help me or if anyone is active here. But I actually have a very important question regarding injecting social mixers to social super affordances (not snippets, not Sims). I guess I am the first person to ever ask this question, because there are not many affordance links (not lists) inside the sim_Chat super affordance.

How can I inject a social mixer interaction like "(114473) SocialMixerInteraction: Socials_Doctor_Refer_Xray" into the "(13998)sim_Chat" social super interaction, since it is not tied to a snippet?
Page 5 of 5
Back to top