- Site Map >
- Modding and Creation >
- Sims 4 Creation >
- Modding Discussion >
- Trying to make the mailman deliver items ordered from a custom "order online" interaction
- Site Map >
- Modding and Creation >
- Sims 4 Creation >
- Modding Discussion >
- Trying to make the mailman deliver items ordered from a custom "order online" interaction
Replies: 2 (Who?), Viewed: 878 times.
#1
14th Nov 2019 at 7:13 AM
Posts: 29
Thanks: 549 in 17 Posts
Trying to make the mailman deliver items ordered from a custom "order online" interaction
I am trying to make a mod that adds a custom "order ambrosia" interaction to allow you to order ambrosia online from a computer - for a hefty price of course.Anyway, I'm having trouble getting it to actually get delivered.
In my attached file called "new computer xml.xml", on line 4 I have:
Code:
<V t="mailman_delivery" n="delivery_method" />
I do not get any errors from MCCC. If I order my item, it will take money from my household funds, correctly display the notification saying "it will be delivered" and then never gets delivered. I waited about 6 in game days but got nothing. I always order random stuff from other mods that add new ordering interactions and it works. I also tried waiting almost a week without ordering other stuff just to see and it still doesn't work.
If I change line 4 to:
Code:
<V t="purchase_to_inventory" n="delivery_method"> <U n="purchase_to_inventory"> <E n="participant_type">Actor</E> </U> </V>
then it puts the item in my inventory as soon as I do it without throwing any errors. This shows that everything else is working but I believe I'm lacking something somewhere.
My mod itself consists of a package file containing a single English localization STBL node, a single _XML node which is that PurchasePickerInteraction one that adds the interaction under the order menu as well as a simple ts4script that injects it into the affordance manager to allow the new order interaction to show up in the order menu.
So my question is: What else do I need in order to get the mailman delivery to actually work? Is there another xml node I should have somewhere? Is there something special I have to do with scripting? What do I have to do?
Are there any mods that do this that I can look at their contents and figure it out? I haven't been able to find any other mods that do this. The only two mods I know of that use this are WickedWhims and Basemental. WickedWhims is far too complicated to find where the custom computer order interaction script or xml nodes are but I did find the xml node for adding the custom purchasepickertinteraction in basemental. I have thoroughly studied the ts4script of basemental and spent hours browsing basemental's xml files but have not managed to find anything related to custom item delivery. It would be really nice if there was another mod that does this that I could look at.
I have attached the relevant files. If anyone has any advice, knows how to do this or even knows of some third mod that does this I could take apart to figure out how this works, I would be really grateful.
Edit: it turns out you can't just upload xml files so i'm just going to copy and paste my stuff here:
my xml file with the purchasePickerInteraction class
Code:
<?xml version="1.0" encoding="utf-8"?> <I c="PurchasePickerInteraction" i="interaction" m="interactions.base.picker_interaction" n="purchase_Ambrosia" s="105671"> <V t="disabled" n="_saveable" /> <!--<V t="mailman_delivery" n="delivery_method" />--> <V t="purchase_to_inventory" n="delivery_method"> <U n="purchase_to_inventory"> <E n="participant_type">Actor</E> </U> </V> <T n="category">98910<!--PieMenuCategory: computer_Order--></T> <T n="display_name">0x264FC3CC<!--String: "buy ambrosia"--></T> <U n="display_name_text_tokens"> <L n="tokens"> <V t="participant_type"> <U n="participant_type"> <V t="from_participant" n="objects"> <U n="from_participant"> <E n="participant">Actor</E> </U> </V> </U> </V> <V t="participant_type"> <U n="participant_type"> <V t="from_participant" n="objects"> <U n="from_participant"> <E n="participant">Object</E> </U> </V> </U> </V> </L> </U> <L n="interaction_category_tags"> <E>INVALID</E> </L> <V t="purchase_picker" n="picker_dialog"> <U n="purchase_picker"> <V n="text" t="enabled"> <V n="enabled" t="single"> <T n="single">0x264FC3CC<!--String: "buy ambrosia"--></T> </V> </V> </U> </V> <V t="enabled" n="pie_menu_icon"> <V n="enabled" t="resource_key"> <U n="resource_key"> <T n="key" p="InGame\UI\Icons\PieMenu\Interactions\icon_pieMenu_immediateInteraction.png">2f7d0004:00000000:25eea5cdba6a6fd6</T> </U> </V> </V> <U n="progress_bar_enabled"> <T n="bar_enabled">False</T> </U> <L n="purchase_list_option"> <V t="specific_items"> <U n="specific_items"> <L n="item_list"> <T>65225</T><!--ambrosia--> </L> </U> </V> </L> <V n="purchase_notification" t="enabled"> <V n="enabled" t="literal"> <U n="literal"> <V t="enabled" n="icon"> <V t="participant" n="enabled"> <U n="participant"> <L n="participant_type"> <E>Object</E> </L> </U> </V> </V> <V t="disabled" n="secondary_icon" /> <V n="text" t="single"> <T n="single">0x7C92ECF9<!--String: "Thanks for ordering! The ambrosia {0.SimFirstName} purchased will be deliveryed in a few days"--></T> </V> <E n="visual_type">SPEECH</E> </U> </V> </V> <T n="show_descriptions">False</T> <E n="target_type">OBJECT</E> <L n="test_globals"> <V t="buff"> <U n="buff"> <L n="blacklist"> <T>26171<!--buff_Sim_IsDying--></T> </L> </U> </V> <V t="sim_info"> <U n="sim_info"> <V t="specified" n="ages"> <L n="specified"> <E>CHILD</E> <E>TEEN</E> <E>YOUNGADULT</E> <E>ADULT</E> <E>ELDER</E> </L> </V> <V t="specified" n="species"> <U n="specified"> <L n="species"> <E /> </L> </U> </V> <E n="who">Actor</E> </U> </V> <V t="state"> <U n="state"> <V t="always_pass" n="fallback_behavior" /> <T n="value">110121<!--frontDesk_Slotted_0_No--></T> </U> </V> <V t="state"> <U n="state"> <V t="always_pass" n="fallback_behavior" /> <E n="operator">NOTEQUAL</E> <T n="value">15080<!--BrokenState_Broken--></T> </U> </V> </L> <V t="enabled" n="utility_info"> <L n="enabled"> <E>POWER</E> </L> </V> </I>
injector.py (part of my ts4script file)
Code:
from functools import wraps import inspect # method calling injection def inject(target_function, new_function): @wraps(target_function) def _inject(*args, **kwargs): return new_function(target_function, *args, **kwargs) return _inject # decarator injection. 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 def is_injectable(target_function, new_function): target_argspec = inspect.getargspec(target_function) new_argspec = inspect.getargspec(new_function) return len(target_argspec.args) == len(new_argspec.args) - 1
obj_interaction_injector.py (also part of my ts4script file)
Code:
import services import injector import objects import types gc_purchase_ingred_sa_instance_ids = (105671) gc_purchase_ingred_object_ids = (69420,34683,34682,34678,34679,34680,34684,36369,36370,40340,77507,112485,14845,202931,202932,211714) def attachinteraction(sa_list, affordance_manager, sa_id): tuning_class = affordance_manager.get(sa_id) if not tuning_class is None: sa_list.append(tuning_class) @injector.inject_to(objects.game_object.GameObject, 'on_add') def gc_purchase_ingred_add_super_affordances(original, self): original(self) if not self.guid64 in gc_purchase_ingred_object_ids: return sa_list = [] affordance_manager = services.affordance_manager() if(isinstance(gc_purchase_ingred_sa_instance_ids, int)): attachinteraction(sa_list, affordance_manager, gc_purchase_ingred_sa_instance_ids) else: for sa_id in gc_purchase_ingred_sa_instance_ids: attachinteraction(sa_list, affordance_manager, sa_id) self._super_affordances = self._super_affordances + tuple(sa_list)
and then I put all this stuff in an attached zip file in case anyone finds it easier to download it.
Attached files:
the stuff.zip (4.5 KB, 4 downloads) - View custom content | ||||||||||
3875 2019-11-14 00:50 new computer xml.xml 1058 2019-11-13 03:13 obj_interaction_injector.py 826 2014-09-10 01:55 injector.py 2283 2019-11-14 00:32 darknet_ambrosia.package --------- ------- 8042 4 files |
Advertisement
#2
14th Nov 2019 at 7:46 AM
Posts: 29
Thanks: 549 in 17 Posts
ok update I think I know what the problem could be. I took one of the mods that demonstrate this working correctly and then pasted the ambrosia id into the store list. It showed up, I ordered it and some other stuff but only the other stuff showed up.
After some additional digging, I discovered for that the items that get delivered in other mods that do this, all of the items have this key in their object definition:
I doubt that ambrosia has is "allowed" to be stored in a mailbox. Unfortunately, since ambrosia is a base game item, you can't just simply edit the object definition at location to have the <E>MAILBOX</E> part in it because it's formatted in an entirely different way.
I am going to attempt changing the U# booleans and maybe one of them will be a mailbox allowed flag. If not, I will then compare the ambrosia object definition to that of another base game definition that has mailbox permissions and hope there is something in there I can paste into the ambrosia one.
After some additional digging, I discovered for that the items that get delivered in other mods that do this, all of the items have this key in their object definition:
Code:
<V n="inventory_item" t="enabled"> <U n="enabled"> <T n="inventory_only">False</T> <T n="can_place_in_world">False</T> <T n="skip_carry_pose">True</T> <T n="remove_from_npc_inventory">False</T> <L n="valid_inventory_types"> <E>SIM</E> <E>MAILBOX</E> <E>STORAGE_CHEST</E> </L> </U> </V>
I doubt that ambrosia has is "allowed" to be stored in a mailbox. Unfortunately, since ambrosia is a base game item, you can't just simply edit the object definition at location to have the <E>MAILBOX</E> part in it because it's formatted in an entirely different way.
I am going to attempt changing the U# booleans and maybe one of them will be a mailbox allowed flag. If not, I will then compare the ambrosia object definition to that of another base game definition that has mailbox permissions and hope there is something in there I can paste into the ambrosia one.
#3
14th Nov 2019 at 8:54 AM
Posts: 29
Thanks: 549 in 17 Posts
I'd hate to be that guy that accidentally solves his own problem like right after posting but I, uh, seem to have figured it out.
Everything I had in the first place WAS correct. The problem turned out that the base game ambrosia isn't "allowed" to be placed in a mailbox which is why when I was ordering it, it wasn't being delivered.
While you can't edit base game object tuning definitions the same way you can with modded ones, there is an excellent tool called Sims 4 Tuning Tool that can convert base game definitions to functional xmls that can be used to override base game definitions. I used that to generate an ambrosia xml and I was then able to load it into my package to override the base ambrosia stuff.
It worked after that. I plan to upload this on the workshop after I do some more small things to it.
Everything I had in the first place WAS correct. The problem turned out that the base game ambrosia isn't "allowed" to be placed in a mailbox which is why when I was ordering it, it wasn't being delivered.
While you can't edit base game object tuning definitions the same way you can with modded ones, there is an excellent tool called Sims 4 Tuning Tool that can convert base game definitions to functional xmls that can be used to override base game definitions. I used that to generate an ambrosia xml and I was then able to load it into my package to override the base ambrosia stuff.
It worked after that. I plan to upload this on the workshop after I do some more small things to it.
Who Posted
|