Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

Theme Catchup2018 - posted on 1st May 2018 at 1:50 PM
Replies: 85 (Who?), Viewed: 71519 times.
Page 4 of 4
Theorist
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.
Ms. Byte
staff: moderator
#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 3 content:
Online Sims - general Sims 3 mods
Offline Sims - adult Sims 3 mods
Theorist
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!
Theorist
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)
Theorist
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.
Theorist
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.
Page 4 of 4
Back to top