Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Deceased
Original Poster
#76 Old 26th Nov 2017 at 11:13 AM
Quote: Originally posted by luvmebby
I keep getting errors when trying to add STBL 0x220557DA

Ok, the exception you are posting is a bug in s4pe itself - it seems to happen if you have non-numeric information in either the Group or Instance fields. I was able to get that error to throw by putting a space after the 0x00000000 in Group (entered "0x00000000 " instead of "0x00000000"), so be careful that the numbers are typed precisely as shown with no extra spaces or other letters. You should then be able to get past this without an error.

Of course, the tutorial still won't work - I haven't had a chance to update it yet.

ETA - Actually the exception I generated is slightly different but it is similar in concept - gotta make sure those numbers are correctly formatted until they fix that. I'm reporting it to s4pe team.
Advertisement
Ms. Byte (Deceased)
#77 Old 26th Nov 2017 at 2:10 PM
Quote: Originally posted by luvmebby
I keep getting errors when trying to add STBL 0x220557DA using scumbumbo mailbox tutorial as directed in the early steps. I tried reinstalling S4PE using the correct 7-zip method and still get the error. I want to move forward in the learning process but am stumped here as it closes the program when attempting. If you dont use the add function, what do you use instead?


That error suggests that you don't have a recognizable hex number in one or more of the TGI fields when trying to add the STBL. I tried the tutorial and didn't get an error. Could you please post a screenshot of the Resource Details popup along with the error so I can see exactly what you entered?

Please do not PM me with mod, tutorial, or general modding questions or problems; post them in the thread for the mod or tutorial or post them in the appropriate forum.

Visit my blogs for other Sims content:
Online Sims - general mods for Sims 3
Offline Sims - adult mods for Sims 3 and Sims 4
Deceased
Original Poster
#78 Old 26th Nov 2017 at 11:08 PM
The tutorial has been updated for the latest game and S4PE changes.
Test Subject
#79 Old 25th Jan 2018 at 7:32 PM
Hey guys,

Is some of you ever had lastexeption error log while adding superaffordance to objects?

The injector i use for the sim itself work really well but i having some issue to injecting interacton to computer
Code:
import services
import injector
import objects.game_object

wjpcomputer_sa_instance_ids = (13185967255977241388, 16238112778709694730, )
wjpcomputer_object_ids = (14845, 34680, 40340, 34682, 34684, 34679, 34678, 36369, 36370, 77507, )

@injector.inject_to(objects.game_object.GameObject, 'on_add')
def wjpcomputer_add_super_affordances(original, self):
    original(self)

    if not self.guid64 in wjpcomputer_object_ids:  //the line 12 who cause conflict
        return

    sa_list = []
    affordance_manager = services.affordance_manager()
    for sa_id in wjpcomputer_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)


In theory it's working i can see my interaction on the computer the interaction work well but i'm stuck with those errors pop up every 5-10 secs and slow down the game drastically .

File ".\CompSuperA.py", line 12, in wjpcomputer_add_super_affordances
AttributeError: 'Jig' object has no attribute 'guid64'

I'm kind a noob in python i'm better with the xml file any help would be very appreciated!! Thanks!
Deceased
Original Poster
#80 Old 26th Jan 2018 at 2:15 AM
Quote: Originally posted by xavierm
In theory it's working i can see my interaction on the computer the interaction work well but i'm stuck with those errors pop up every 5-10 secs and slow down the game drastically .

File ".\CompSuperA.py", line 12, in wjpcomputer_add_super_affordances
AttributeError: 'Jig' object has no attribute 'guid64'

What's happening is that a Jig object is being loaded onto the lot that doesn't have a guid64. I've seen this happen with objects or interactions that are created on the fly by the game, they don't have a guid64 (or in XML speak, an "instance ID"). Two ways you could fix that, either check to see the guid64 attribute exists using hasattr(self, 'guid64') before trying to test it, or redo the code to add the superaffordances to the actual object tuning at load instead of adding it to the objects as they are loaded onto the lot. The second method is vastly preferable as it will only run once as the game starts, something like this:
Code:
import services
from sims4.tuning.instance_manager import InstanceManager
from sims4.resources import Types
from injector import inject_to

def add_super_affordances_to_objects(self):
    wjpcomputer_sa_instance_ids = (13185967255977241388, 16238112778709694730)
    wjpcomputer_object_ids = (14845, 34680, 40340, 34682, 34684, 34679, 34678, 36369, 36370, 77507)
    affordance_manager = services.affordance_manager()
    
    # Get a list of all the superaffordance tuning instances first
    sa_list = []
    for sa_id in wjpcomputer_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)

    # Add the tuple of superaffordance tunings to each of the objects
    for obj_id in wjpcomputer_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_tuple

# After class instance data is loaded at startup, call our function
#   to add all the required superafordances to the objects
@inject_to(InstanceManager, 'load_data_into_class_instances')
def load_data_into_class_instances(original, self):
    original(self)
    if self.TYPE == Types.OBJECT:
        add_super_affordances_to_objects(self)
Test Subject
#81 Old 29th Jan 2018 at 3:32 AM
Thanks a lot! I would like to use your technique to inject affordances to a sim. is it possible? I tryed many options but still unsuccessful at this time. I think i'm close but something is missing:
Code:
import services
from sims.sim import Sim
from sims4.resources import Types
from injector import inject_to

def add_super_affordances_to_objects(self):
    wjpsims_sa_instance_ids = (15457246327094184977, 17709353295582841546, 10704380331120406141, 15421753369241220122, 14011747039628836317, 13528898888471733218, 15116289188983357572, 18154468906577769099, 10841939712105188712, 14555147986889676928, 10598527989307607484, 17613162279974342394)
    affordance_manager = services.affordance_manager()
    
    # Get a list of all the superaffordance tuning instances first
    sa_list = []
    for sa_id in wjpsims_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)
    self._super_affordances = self._super_affordances + tuple(sa_list)

# After class instance data is loaded at startup, call our function
#   to add all the required superafordances to the objects
@inject_to(Sim, 'load_data_into_class_instances')
def load_data_into_class_instances(original, self):
    original(self)
    add_super_affordances_to_objects(self)
Deceased
Original Poster
#82 Old 29th Jan 2018 at 8:50 AM
Quote: Originally posted by xavierm
I would like to use your technique to inject affordances to a sim. is it possible? I tryed many options but still unsuccessful at this time.

Adding to the super affordances for a Sim object is exactly the same process. In your code you are trying to inject_to the load_data_into_class_instances() method of the Sim class, but that class doesn't have that method. The load_data_into_class_instances() method is part of the InstanceManager.

Instead, keep the load_data_into_class_instances() injection the same as before, but in add_super_affordances_to_objects() you should change the wjpcomputer_object_ids to point to the instance IDs for the object_sim tuning (14965) instead of the list of computer objects. Since it's not a list of objects we can remove the for loop for the object ids and just get the object_sim.

So, using the SA values from your code, the new code might look something like:
Code:
import services
from sims4.tuning.instance_manager import InstanceManager
from sims4.resources import Types
from injector import inject_to

def add_super_affordances_to_objects(self):
    wjpsims_sa_instance_ids = (15457246327094184977, 17709353295582841546, 10704380331120406141, 15421753369241220122, 14011747039628836317, 13528898888471733218, 15116289188983357572, 18154468906577769099, 10841939712105188712, 14555147986889676928, 10598527989307607484, 17613162279974342394)
    wjpsims_object_sim_id = 14965
    affordance_manager = services.affordance_manager()

    # Get a list of all the superaffordance tuning instances first
    sa_list = []
    for sa_id in wjpsims_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)

    # Add the tuple of superaffordance tunings to the object_sim tuning
    key = sims4.resources.get_resource_key(wjpsims_object_sim_id, Types.OBJECT)
    object_sim = self._tuned_classes.get(key)
    object_sim._super_affordances += sa_tuple

# After class instance data is loaded at startup, call our function
#   to add all the required superafordances to the objects
@inject_to(InstanceManager, 'load_data_into_class_instances')
def load_data_into_class_instances(original, self):
    original(self)
    if self.TYPE == Types.OBJECT:
        add_super_affordances_to_objects(self)
Test Subject
#83 Old 29th Jan 2018 at 3:36 PM Last edited by xavierm : 29th Jan 2018 at 5:54 PM.
Quote: Originally posted by scumbumbo
Adding to the super affordances for a Sim object is exactly the same process. In your code you are trying to inject_to the load_data_into_class_instances() method of the Sim class, but that class doesn't have that method. The load_data_into_class_instances() method is part of the InstanceManager.

Instead, keep the load_data_into_class_instances() injection the same as before, but in add_super_affordances_to_objects() you should change the wjpcomputer_object_ids to point to the instance IDs for the object_sim tuning (14965) instead of the list of computer objects. Since it's not a list of objects we can remove the for loop for the object ids and just get the object_sim.

So, using the SA values from your code, the new code might look something like:
Code:
import services
from sims4.tuning.instance_manager import InstanceManager
from sims4.resources import Types
from injector import inject_to

def add_super_affordances_to_objects(self):
    wjpsims_sa_instance_ids = (15457246327094184977, 17709353295582841546, 10704380331120406141, 15421753369241220122, 14011747039628836317, 13528898888471733218, 15116289188983357572, 18154468906577769099, 10841939712105188712, 14555147986889676928, 10598527989307607484, 17613162279974342394)
    wjpsims_object_sim_id = 14965
    affordance_manager = services.affordance_manager()

    # Get a list of all the superaffordance tuning instances first
    sa_list = []
    for sa_id in wjpsims_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)

    # Add the tuple of superaffordance tunings to the object_sim tuning
    key = sims4.resources.get_resource_key(wjpsims_object_sim_id, Types.OBJECT)
    object_sim = self._tuned_classes.get(key)
    object_sim._super_affordances += sa_tuple

# After class instance data is loaded at startup, call our function
#   to add all the required superafordances to the objects
@inject_to(InstanceManager, 'load_data_into_class_instances')
def load_data_into_class_instances(original, self):
    original(self)
    if self.TYPE == Types.OBJECT:
        add_super_affordances_to_objects(self)


(EDIT)

Thanks again! Here the code who worked for me;

Code:
import services
from sims4.tuning.instance_manager import InstanceManager
import sims4.resources
from sims4.resources import Types
from injector import inject_to

def add_super_affordances_to_objects(self):
    wjpsims_sa_instance_ids = (10598527989307607484, 17613162279974342394)
    wjpsims_object_sim_id = 14965
    affordance_manager = services.affordance_manager()

    # Get a list of all the superaffordance tuning instances first
    sa_list = []
    for sa_id in wjpsims_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)

    # Add the tuple of superaffordance tunings to the object_sim tuning
    key = sims4.resources.get_resource_key(wjpsims_object_sim_id, Types.OBJECT)
    object_sim = self._tuned_classes.get(key)
    object_sim._super_affordances += sa_tuple

# After class instance data is loaded at startup, call our function
#   to add all the required superafordances to the objects
@inject_to(InstanceManager, 'load_data_into_class_instances')
def load_data_into_class_instances(original, self):
    original(self)
    if self.TYPE == Types.OBJECT:
        add_super_affordances_to_objects(self)


i only add the import sims4.resources to make the code working.
Test Subject
#84 Old 4th Feb 2018 at 7:28 PM
May I ask a super basic question here (super noob)? Is YOURMODNAME some random thing I just put into python script, or is it something that should be defined in xml file? I know my interaction tuning (new super affordance) works, because I've added it to an object's clone, but I wanted to add it to all objects, hence me being here. I used Aren's template for my script, but the option doesn't show in game, so I was wondering where I messed up.
Deceased
Original Poster
#85 Old 5th Feb 2018 at 3:16 AM
Quote: Originally posted by insiderw
May I ask a super basic question here (super noob)? Is YOURMODNAME some random thing I just put into python script, or is it something that should be defined in xml file?

Just some random thing, like a comment. Totally not needed, each script runs in a separate namespace so if two script mods share the same variable name there shouldn't be a conflict.
Test Subject
#86 Old 5th Feb 2018 at 7:16 AM
Quote: Originally posted by scumbumbo
Just some random thing, like a comment. Totally not needed, each script runs in a separate namespace so if two script mods share the same variable name there shouldn't be a conflict.


Thank you so much for clarification! Basically I wanted to add a SimRay interaction to objects, sort of like DeathRay mod added one for sims. Unfortunately I still failed to make the script work (using both original code and code from post #82), but I have no experience with proper coding other than some xml tweaking, so I guess I'm back to overriding object tunings.
Lab Assistant
#87 Old 5th Jul 2018 at 9:40 AM
You should rewrite this tutorial using sims 4 studios since everything we need to make it are in one program, cause following the tutorial has me all over the place and we can extract tuning directly in s4s!
One horse disagreer of the Apocalypse
#88 Old 5th Jul 2018 at 12:34 PM
Careful with the "should"s...

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Deceased
Original Poster
#89 Old 5th Jul 2018 at 7:07 PM Last edited by scumbumbo : 5th Jul 2018 at 7:24 PM.
I've been made aware that the Modding Toolbox by @Fogity is no longer available on Dropbox and I can't find the PM I was sure he'd sent me that I could make it available to folks if he was no longer around. I'm in the process of writing an updated version, might take a couple of hours to get it all nice and neat, but will make it (w/ source code) available here on MTS.
Deceased
Original Poster
#90 Old 6th Jul 2018 at 12:06 AM
I've created a new version of Fogity's Modding Toolbox and added it to the Modding Tools forum section here.
Test Subject
#91 Old 26th Oct 2018 at 5:59 PM
Does this thread cover only SA injection or it could be used to inject anything ?

For instance if I modify an object _part_data, could it be done easily or we need to develop a brand new script each time we need to inject a different tag ?

Considering how easy it is to modify an XML comparing to develop a script to inject stuff, would it be a good idea to develop some kind of XML merger tool which merges the EA original XML file with any custom modification before running the game ?

There used to be a Mod Organizer for Skyrim which did kind of that thing.
It's a user interface listing all mods you had installed, and telling you which modify the same entries, which are compatible, which are not and will override themselves and so on.
It was great because your mods were never installed. They were stored in a specific folder waiting for the game to start.
Upon start, Mod Organizer created a virtual mod environment, taking all vanilla files and applying the mods in the order you told him to.
Doing so you ensure both compatibility with vanilla files update and mods which change the same file (except if they change the same part of a single file of course).

Illustration of Mod Organizer for those interested :



Well maybe all of this is totally irrelevant, sorry if it's the case
Deceased
Original Poster
#92 Old 4th Nov 2018 at 7:01 AM
Quote: Originally posted by RedFaction
Does this thread cover only SA injection or it could be used to inject anything ?

Sorry for the late reply on this, I'd been planning to attend to your question for a few days now. Many things can be changed in the XML as the game loads using these injections. The technique can be basically as simple as that used for the super affordances or it can be quite a bit more complex. It just depends on the data being altered and how that data is stored.

I've never looked into modifying an object tuning's _part_data info, but it should be completely doable. The main approach is to use the Python inspect package on the relevant data in the game to see what is there, then inspecting further until you find exactly what you want to change. Then finally you can create a script that injects into the load_data_into_class_instances method to make those changes at game load.

I have an example of an investigative process to determine how to inject some data (adding an affordance filter) in the thread for The Inspector.

D3OI is also a very useful tool that I've written for the game which allows you to shift-click (if you have enable debug cheats mod installed) an object in the game and retrieve some basic information about it, or dump more complete info into a file. It's a nice quickie tool to have in the arsenal, but The Inspector above is much more powerful.

Quote:
Considering how easy it is to modify an XML comparing to develop a script to inject stuff, would it be a good idea to develop some kind of XML merger tool which merges the EA original XML file with any custom modification before running the game ?

I'd given some thought to that previously, as I'm sure others have, and there are some inherent problems with trying to merge XML in that manner. It's certainly "theoretically" doable, but creating something that can intelligently choose when to merge, when to add data, or when and how to throw out conflicting data is quite a task. I for one would not have any interest in trying to support such a program and the continual problems that would arise for the players attempting to use a merger without full knowledge of what they are doing. Within hours you would be guaranteed to be getting requests to help them combine mod "X" and "Y" which, when they attempt to merge them, causes all of their pets to have monkey heads where their tails should be.
Test Subject
#93 Old 4th Nov 2018 at 11:31 PM
Quote: Originally posted by scumbumbo
creating something that can intelligently choose when to merge, when to add data, or when and how to throw out conflicting data is quite a task.

I was thinking of giving instructions to that program :

Instead of modifying directly the XML, you create an instructions XML in which you put modifications instructions (such as add, del, or mod), followed by a destination tag and a value.
Next, instead of running the game through its executable, you run it through the tool which behaves like a mod organizer :
1. It takes EA original XMLs
2. It gathers all modifications XML (created by modders)
3. It follows their instructions to add/del/mod the EA original XML content
4. It notifies the user if two or several files are modifying the same values
5. It creates the virtual merged mods folder (which is our EA mods folder)
6. It runs the game
Quote: Originally posted by scumbumbo
I for one would not have any interest in trying to support such a program and the continual problems that would arise for the players attempting to use a merger without full knowledge of what they are doing

Mods are not really merged.
Instead of putting them in the EA mods folder, you put them in the tools mods folder.
Then, the tool creates the EA mods folder with the merged files, but the original unmerged mods are still stored separately in the tool mods folder.
If you add or remove mods, or if you change the mods order through the tool interface, then it updates the EA mods folder accordingly.
Quote: Originally posted by scumbumbo
Within hours you would be guaranteed to be getting requests to help them combine mod "X" and "Y" which, when they attempt to merge them, causes all of their pets to have monkey heads where their tails should be.

From my point of you the virtual merge doesn't bring more issues that there is now.

Let's say you want to play with 2 incompatible mods which both modifies the same XML entry :
1. If the mods are XML mods : the last mod will overwrite the first one with no warning
2. If the mods are using a script to inject XML : again the last one will overwrite the first one with no warning
3. If we have a XML merger : the last will still overwrite the first, but the tool will be able to notify it

And the other way around is also true : if two mods modify the same ressource, but are compatibles thanks to a script (because they don't modify the same XML entries), then there is no reason it won't work using a merger, because XML instructions will point to different destinations.

The difference is that, still from my modest point of view , it looks way easier to create an instructions XML than a dedicated python script.

Anyway this is how we dealt with this problem in Skyrim
Maybe it's a bit difficult to figure the thing out if you hadn't the chance to play this wonderful game ^^
Test Subject
#94 Old 9th Feb 2019 at 8:37 PM
Hi There

I'm new at modding and was wondering if anyone can help, the socialmixerInteractions code doesn't seem to work for me... so I'm thinking I'm missing something? I updated the Mixer_ID




I tested it by added it manually to the xmls 24511 and 163706 and it works. Should the below code reference 163706 somewhere as well?



Thanks for any help!!

Quote: Originally posted by scumbumbo
So it seems SocialMixerInteractions aren't added to the sim's super affordance list, but rather to a similar list stored in a snippet tuning. To handle this, I used the same function that Deaderpool injected into an earlier example to alter tunings as they are loaded at the game startup. This seems to work well. The instance IDs are for some research I did for sachamagne. Altering this code to work with multiple instance IDs in a loop is an exercise left up to the reader, which should be a walk in the park for you if you've followed this thread this far.

So, the code:
Code:
import injector
import sims4.resources
from sims4.tuning.instance_manager import InstanceManager
from sims4.resources import Types
import services

SNIPPET_ID = 24511
MIXER_ID = 13984173314801262715

@injector.inject_to(InstanceManager, 'load_data_into_class_instances')
def add_mixer_to_snippet(original, self):
    # Let the original function finish up its work
    original(self)

    # This function gets called once for each tuning type, so by only running this if we're specifically
    # working on the snippets, we can just get that snippet directly using the key rather than looping
    # through all the instances to and checking the guids.  The same tactic works for getting the tuning
    # straight for the mixer interaction directly from the affordance manager.

    if self.TYPE == Types.SNIPPET:
        # Get the snippet tuning
        key = sims4.resources.get_resource_key(SNIPPET_ID, Types.SNIPPET)
        snippet_tuning = self._tuned_classes.get(key)
        # Check that we found it....
        # If we were running in a loop, we'd probably want to skip to the next iteration
        # rather than just returning if the snippet id is invalid.
        if snippet_tuning is None:
            return
        # Get the mixer from the affordance manager
        affordance_manager = services.affordance_manager()
        key = sims4.resources.get_resource_key(MIXER_ID, Types.INTERACTION)
        mixer_tuning = affordance_manager.get(key)
        if mixer_tuning is None:
            return
        # Add the mixer tuning to the snippet's value (a tuple)
        snippet_tuning.value = snippet_tuning.value + (mixer_tuning, )
Deceased
Original Poster
#95 Old 10th Feb 2019 at 1:55 AM
Quote: Originally posted by oxoJessi
I tested it by added it manually to the xmls 24511 and 163706 and it works. Should the below code reference 163706 somewhere as well?

Yes, as written it will only add to the social_Mixers_Mean_NonTouching (24511) and not the social_Mixers_Mean_NonTouching_ForReference (163706). The easiest way would be to add your mixer to both in a loop as below.

Actually the easiest way now would be to use the XML Injector if you don't mind having a required mod for yours to work. You would then be able to distribute your mod with no script, all the scripting would be handled by the XML Injector. http://modthesims.info/d/622928/xml...-version-1.html

But it can also be done in your own script, something like this:
Code:
import injector
import sims4.resources
from sims4.tuning.instance_manager import InstanceManager
from sims4.resources import Types
import services

SNIPPET_IDS = (24511, 163706)
MIXER_ID = 13984173314801262715

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

    if self.TYPE == Types.SNIPPET:
        # Just get the mixer tuning once, outside the loop
        affordance_manager = services.affordance_manager()
        key = sims4.resources.get_resource_key(MIXER_ID, Types.INTERACTION)
        mixer_tuning = affordance_manager.get(key)
        if mixer_tuning is None:
            return
        # Loop through all the snippets in the SNIPPET_IDS and add the mixer
        for snippet_id in SNIPPET_IDS:
            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_tuning, )
Test Subject
#96 Old 10th Mar 2019 at 9:54 AM
I wanted to ask your tutorial is still valid?
I did the Tutorial - Mailbox Testing Cheats all well done but it does not show up in the game when using mailbox even I used it from your folder and it does not work. or is there any other way I do not know about? thanks for any answer
Deceased
Original Poster
#97 Old 10th Mar 2019 at 7:52 PM
Quote: Originally posted by Sadfly
I wanted to ask your tutorial is still valid?
I did the Tutorial - Mailbox Testing Cheats all well done but it does not show up in the game when using mailbox even I used it from your folder and it does not work. or is there any other way I do not know about? thanks for any answer

Not sure precisely what would be wrong with it, but there's a good chance it's only still "mostly valid". There's been quite a number of tuning changes since I last updated that, as well as some new techniques to make things a bit smoother in the scripting. I'll try and get around to checking and updating it sometime.
Test Subject
#98 Old 25th Mar 2019 at 7:08 PM Last edited by HeroicJay : 25th Mar 2019 at 7:42 PM.
I tried writing an interaction that was an edit of the "AskToBeBestFriends" interaction. I tried injecting it with code provided in this topic, and ultimately, I found that I could no longer interact with other Sims at all. There was an exception log that complained that my new interaction didn't have an "object_reservation_tests" property. Thing is, the actual AskToBeBestFriends interaction doesn't seem to have it either (some interactions do, but not that). In fact, I even tried injecting THAT interaction directly (even though Sims already have it), instead of my modified version, and got exactly the same result: can't interact with Sims, exception log with the same error.

I couldn't fool it by putting in an empty object_reservation_tests property. Is there something I overlooked?

I tried using the XML injector, but no good. I don't see anything relevant in the exception log (though it seemed to find a conflict between XML Injector and another mod), and I can at least click on Sims now, but my custom interaction still doesn't appear.

EDIT: Ah, I got it to work with the XML Injector. It looks like I was treating it like the wrong sort of interaction. Don't know if that's relevant to it failing with the Python script injection, but whatever, it works now.
Deceased
Original Poster
#99 Old 25th Mar 2019 at 9:13 PM
Quote: Originally posted by HeroicJay
Ah, I got it to work with the XML Injector. It looks like I was treating it like the wrong sort of interaction. Don't know if that's relevant to it failing with the Python script injection, but whatever, it works now.

That was likely the issue, glad you got that working.

Your example demonstrates one very useful side-effect of using XML Injector that I hadn't really considered before -- when using script injection into load_data_into_class_instances, any uncaught exception can cause a lot of the other game's XML resources to not be properly initialized and the result is failures like you experienced where interactions are just completely missing. Since the XML Injector processes each snippet individually, outside of the main XML loader, and performs it's own error trapping it isn't as likely to cause those sort of issues.

We're (Triplis, the author of the Become a Sorcerer mod and myself) adding additional features to the XML Injector so that it will be useful for things other than just adding to super affordance lists. Version 2 is almost ready for release, I'm writing the documentation for it now.
Test Subject
#100 Old 5th Apr 2019 at 6:33 AM
This is an awesome tutorial. Thank you for sharing!

Smallest thing, the pdf suggests other threads, the words are highlighted but there's no link attached.
Page 4 of 5
Back to top