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!
Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 4th Jan 2017 at 5:02 AM
Default XML Coding - How to code an objective checking for object in inventory
Hi all,

I am working on a custom Aspiration for children related to Finding/Playing VoidCritters. I am currently stuck trying to code an objective: "Have a level 2 VoidCritter Card" and am hoping the MTS modder community can help me find a way to code this.

In more general terms, the objective involves the game checking that the Sim has a specific object in their inventory (a VoidCritter Card) and that this object has a specific Object State (Level 2).

There are a number of related XMLs: Object_Collection_Monster_Level (list of all level object states-134161) and related Object_Collection_Monsters_Level_2 (134131). There is also a related statistic: statistic_Object_Monsters_Level (134167).

For the card object itself, there is an Object XML for each of 4 VoidCritters in each of the 5 Elemental types: collectibles_Monsters_Air1 (then 2,3,4), and same thing with Water, Earth, Fire and Void. There is also a tag: Func_Collection_Monsters.

All of the "have object" coding I have browsed through do far in the XMLs involved a tag, so that's what I started with using "object criteria" code taken from similar files. The first issue with that is that the game looks for cards that have been collected (so for the whole household collection) and not cards that are actually in the Sim inventory. So in my test family of 4 children each with various Voidcritter cards, the objective completes even for the child who has no card in their inventory, or the child with a card of level 1.

So my first step I believe should be figuring how to code for the game to check if any of the collectibles_Monsters_Air1 (etc…) objects are in the sims inventory but I have no idea how to achieve that referring to object instance and not tags. I keep browsing through the xmls for an example but cannot find one.

If anybody has an idea of what type of specific coding would be required, that would be awesome. Thanks in advance!
Advertisement
Lab Assistant
#2 Old 10th Jan 2017 at 2:13 PM
Check out Simray interactions, they all have an inventory test
Back to top