|
Post by mimi88jp on May 16, 2020 17:44:13 GMT -5
Hi Guys so Im trying to build a mod, but I need help with Python code so it doesn't cause mod conflicts.
I'm making a mod, where your famous sims can get news articles and blog posts that are written about them, and popup like a notification every time there around paparazzi. Depending on the Famous sims behaviour. But I don't know python.
Basically all I'm trying to do is append
<V t="loot">
<U n="loot">
<L n="loot_list">
<T>11050454963365563178<!--CNU:LOOT_Buff_Trait_Mycustom--></T> </L>
</U>
</V>
Under the basic_extras of the interaction tuning of "mixer_social_Fight_targeted_mean_Paparazzi" .
I've done it by editing the xml to test, and it works, but I don't want to rewrite the xml incase of mod conflicts.
Does anyone have experience with this?
|
|
|
Post by MizoreYukii on May 16, 2020 21:33:43 GMT -5
Hey there! I was going to respond on MTS but got busy and didn't get a chance to. I'll post here instead.
I did this recently for my own mod, but instead of adding a loot list or injecting into the loot list, you instead inject into one of the available loots itself. When I last asked around and researched nobody seemed to know how to do a loot list addition, someone mentioned it was difficult to pinpoint and that's why XML injector doesn't have it, and I haven't seen a mod do it for reference. So next best option is to just inject into a related loot.
For my script, I took apart a script from Mod Constructor as it was the only one I've seen do this, and then changed it to my own loots. Note that the script below contains it's own injection, and you can either separate them or keep them together.
from functools import wraps import services import sims4.resources from sims4.tuning.instance_manager import InstanceManager from sims4.resources import Types
def inject(target_function, new_function): @wraps(target_function) def _inject(*args, **kwargs): return new_function(target_function, *args, **kwargs) return _inject
def inject_to(target_object, target_function_name): def _inject_to(new_function): target_function = getattr(target_object, target_function_name) setattr(target_object, target_function_name, inject(target_function, new_function)) return new_function return _inject_to
@inject_to(InstanceManager, 'load_data_into_class_instances') def MizoreYukii_BloodyVampireBitesAndWounds_AddLoot(original, self): original(self) if self.TYPE == Types.ACTION: MizoreYukii_BloodyVampireBitesAndWounds_AddLootInjector(self, 11265282415106880567, 156798)
def MizoreYukii_BloodyVampireBitesAndWounds_AddLootInjector(self, to_merge_key, value): action_manager = services.get_instance_manager(sims4.resources.Types.ACTION) merge_to = self._tuned_classes.get(sims4.resources.get_resource_key(value, Types.ACTION)) if merge_to is None: return to_merge = action_manager.get(sims4.resources.get_resource_key(to_merge_key, Types.ACTION)) if not to_merge is None: merge_to.loot_actions = merge_to.loot_actions + to_merge.loot_actions
Wherever it says something like "MizoreYukii_BloodyVampireBitesAndWounds" just change it to your creator name and the mod name, leave the rest to avoid confusion.
For "MizoreYukii_BloodyVampireBitesAndWounds_AddLootInjector(self, 11265282415106880567, 156798)" leave "self" alone and change the long first number to your tuning ID, and the last number is EA's tuning ID of the loot you are injecting to. So it looks like "CreatorName_ModName_AddLootInjector(self, MyTuningID, EATuningID)". If you need to add more than one loot, just hit enter and go to the next line, then do the same thing. Also, you should use XML File Finder to double check the loot you are injecting into and make sure it isn't being referenced by other files. If it is, add a participant test and either test for your interaction or test against the unwanted interactions.
|
|
|
Post by mimi88jp on May 18, 2020 8:55:28 GMT -5
MizoreYukii OMG THANK YOU SO MUCH FOR POINTING ME IN THE RIGHT DIRECTION.
Been at this for over a day, had to download the MOD Constructor and export my own append to loot script, you one above wasn't working for some reason, even when I followed the instructions you gave.
But yea I had to get creative, I'm still trying to figure this, I really hope someone finds a way to inject in specific places, it would bring so much to making your own mods.
|
|
|
Post by MizoreYukii on May 18, 2020 17:04:29 GMT -5
Glad you solved it! I think I might have copied and pasted it wrong, I'll have to take a look. You replaced every spot where it mentioned my name and mod?
|
|
|
Post by mimi88jp on May 18, 2020 17:16:52 GMT -5
I did, but I have it working now, :-) Not sure what it was. By the way, would you know how to make custom text strings?
Like for example to when I make a notification that says "{0.SimName} went to the park" it says "MySims ActorsName went to the park". But I also want to make custom ones like
{0.World} would print the world my sim(actor) is currently in. {0.Fame} would print their level of fame like "Rising Star" or "B-lister"etc etc....
|
|
|
Post by MizoreYukii on May 22, 2020 8:12:47 GMT -5
I did, but I have it working now, :-) Not sure what it was. By the way, would you know how to make custom text strings? Like for example to when I make a notification that says "{0.SimName} went to the park" it says "MySims ActorsName went to the park". But I also want to make custom ones like {0.World} would print the world my sim(actor) is currently in. {0.Fame} would print their level of fame like "Rising Star" or "B-lister"etc etc.... I don't think it's possible to set custom ones. I haven't heard of such a thing and I'm not even sure where to look if someone did succeed. The only place you might find such a thing is by taking apart giant custom mods like WW in the off chance that they did succeed at such a thing, or seeing if EA ever made a weird notification that was never repeated and is unknown because of it. Sorry!
|
|
|
Post by sigma1202 on May 22, 2020 15:49:41 GMT -5
There is this thread on the sims forum, it doesn't seem to be possible but TURBODRIVER mentions a few workarounds that might work, you'll have to experiment a little
|
|
|
Post by mimi88jp on Jun 4, 2020 23:46:01 GMT -5
OMG guys thank you soo much...
Yea I think its not possible, Im gonna have to find a workaround and do something else. My next problem is adding other sims with certain relationship_bits into the notifications.
I copied code from the "Discuss Feud" Interaction and added to my action loot so that the notification can name the feud_Target for example. But its not working ...
Do you have any advice?
I made a notification, and I want {2.SimName} to be the name of my sims Feud Target. My notification looks like this
<V t="notification_and_dialog">
<U n="notification_and_dialog">
<V n="dialog" t="notification">
<U n="notification">
<V n="audio_sting" t="enabled">
<U n="enabled">
<T n="audio" p="InEP03\Audio\stings\sting_gnomes_lot_trait.propx">39b2aa4a:00000000:e531045a6fe2288d</T>
</U>
</V>
<V n="icon" t="enabled">
<V n="enabled" t="resource_key">
<U n="resource_key">
<T n="key" p="InGame\UI\Icons\Headlines\Final\headline_dramafaces.png">2f7d0004:00000000:203BD78CEB013992</T>
</U>
</V>
</V>
<V n="text" t="variation">
<U n="variation">
<L n="variations">
<T>0xD8F8044E<!-- {0.SimFirstName} and {2.SimFirstName} FIGHT!!!! --></T>
<T>0xD8F80449<!-- {2.SimFirstName} to {0.SimFirstName}: YOUR A firetruck****G LOSER!!! YOU BETTER WATCH YOURSELF {F0.B**TCH}{M0.ASS***E}!!!! --></T>
<T>0xDC6EC6FA<!-- {2.SimFirstName} slams {0.SimFirstName} after alleged brawl: "@{1.SimFirstName} {0.SimFirstName} {F0.cant keep her hands to herself. You cant bring her rachet ass like her nowhere.. #Trash}{M0.is a Moron and needs to be kicked in the BALLSACK.......HARD!! #Loser}. --></T>
</L>
</U>
</V>
<V n="text_tokens" t="enabled">
<U n="enabled">
<L n="tokens">
<V t="participant_type">
<U n="participant_type">
<V n="objects" t="from_participant">
<U n="from_participant">
<E n="participant">Actor</E>
</U>
</V>
</U>
</V>
<V t="participant_type">
<U n="participant_type">
<V n="objects" t="from_participant">
<U n="from_participant">
<E n="participant">TargetSim</E>
</U>
</V>
</U>
</V>
<V t="participant_type">
<U n="participant_type">
<V n="objects" t="from_participant">
<U n="from_participant">
<E n="participant">ActorFeudTarget</E>
</U>
</V>
</U>
</V>
</L>
</U>
</V>
</U>
<E n="visual_type">SPECIAL</E>
</V>
<L n="tests">
</L>
</U>
</V>
The problem is, the notifications don't work when I add, like the notification just doesn't span at all.
<V t="participant_type">
<U n="participant_type">
<V n="objects" t="from_participant">
<U n="from_participant">
<E n="participant">ActorFeudTarget</E>
</U>
</V>
</U>
</V>
I don't know what I'm doing wrong. It works with just the TargetSim and Actor, listed as participants, but not when I add the ActorFeudTarget.. Do you have any advice??
|
|
|
Post by MizoreYukii on Jul 5, 2020 14:02:43 GMT -5
|
|