Sims 4 Modding Wiki
Advertisement

Test Conditions, Test Sets (TDESC name: TunableTestSet) and Global Tests (TDESC name: TunableGlobalTestSet) are tuning resources that prohibit an action unless certain requirements are met. They can also be used for Autonomy Tests, which prohibit a Sim from doing an action autonomously if they meet certain conditions, though the player can still do them if they choose. At times, they can be small tuning fragments called snippets that can be referenced by tuning files. Often, they're simply coded into a tuning file directly.

Coding[]

There are significant differences between Test Sets and Global Tests. For example, a Global Test requires all tests listed inside to pass. These are commonly used to restrict interactions to specific ages. However, Test Sets can include different sets of tests than can be set as "AND" or "OR" operations depending on the tuning structure. Global Tests and Test Sets can be combined, however.

It is also possible to create custom test sets through a script, which enables the modder to define and use their own test syntax. This is expanded on in this Sims 4 Studio post by Frankk.

Section is incomplete and requires further expansion.

Examples[]

Example of a Global Test:[]

In this example, the Global Test denotes that the Actor—the Sim performing the action—must at least be an adult and the Actor and TargetSim—the Sim the action is being performed on—must have met before. If the game passes the test, then the action will be available. If it does not, it will not be available; the test will fail.

<L n="test_globals">
    <V t="sim_info">
      <U n="sim_info">
        <V n="ages" t="specified">
          <L n="specified">
            <E>YOUNGADULT</E>
            <E>ADULT</E>
            <E>ELDER</E>
          </L>
        </V>
        <E n="who">Actor</E>
      </U>
    </V>
    <V t="relationship">
      <U n="relationship">
        <U n="required_relationship_bits">
          <L n="match_all">
            <T>15803<!--RelationshipBit: has_met--></T>
          </L>
        </U>
        <L n="subject">
          <E>Actor</E>
        </L>
      </U>
    </V>
</L>

Examples of Test Sets:[]

This Test Set lists the same test as the example above, however, it is wrapped inside <L> tag. Everything inside an <L> tag is read by the game as an "AND" operation. That means both test needs to pass for the test to be successful.

<L n="tests">
    <L>
     <V t="sim_info">
       <U n="sim_info">
         <V n="ages" t="specified">
           <L n="specified">
             <E>YOUNGADULT</E>
             <E>ADULT</E>
             <E>ELDER</E>
           </L>
         </V>
         <E n="who">Actor</E>
       </U>
     </V>
     <V t="relationship">
       <U n="relationship">
         <U n="required_relationship_bits">
           <L n="match_all">
             <T>15803<!--RelationshipBit: has_met--></T>
           </L>
         </U>
         <L n="subject">
           <E>Actor</E>
         </L>
       </U>
     </V>
    <L n="test_globals">
    <V t="sim_info">
      <U n="sim_info">
        <V n="ages" t="specified">
          <L n="specified">
            <E>YOUNGADULT</E>
            <E>ADULT</E>
            <E>ELDER</E>
          </L>
        </V>
        <E n="who">Actor</E>
      </U>
    </V>
    <V t="relationship">
      <U n="relationship">
        <U n="required_relationship_bits">
          <L n="match_all">
            <T>15803<!--RelationshipBit: has_met--></T>
          </L>
        </U>
        <L n="subject">
          <E>Actor</E>
        </L>
      </U>
    </V>
 </L>
</L>

This Test Set has been written in a slightly different way. In this example, each Test is written inside its own <L> tag. It is read by the game as an "OR" operation. This means the Actor needs to be at least an adult or the Actor and TargetSim need to have met before.

<L n="tests">
    <L>
     <V t="sim_info">
       <U n="sim_info">
         <V n="ages" t="specified">
           <L n="specified">
             <E>YOUNGADULT</E>
             <E>ADULT</E>
             <E>ELDER</E>
           </L>
         </V>
         <E n="who">Actor</E>
       </U>
     </V>
    </L>
    <L>
     <V t="relationship">
       <U n="relationship">
         <U n="required_relationship_bits">
           <L n="match_all">
             <T>15803<!--RelationshipBit: has_met--></T>
           </L>
         </U>
         <L n="subject">
           <E>Actor</E>
         </L>
       </U>
     </V>
    <L n="test_globals">
    <V t="sim_info">
      <U n="sim_info">
        <V n="ages" t="specified">
          <L n="specified">
            <E>YOUNGADULT</E>
            <E>ADULT</E>
            <E>ELDER</E>
          </L>
        </V>
        <E n="who">Actor</E>
      </U>
    </V>
    <V t="relationship">
      <U n="relationship">
        <U n="required_relationship_bits">
          <L n="match_all">
            <T>15803<!--RelationshipBit: has_met--></T>
          </L>
        </U>
        <L n="subject">
          <E>Actor</E>
        </L>
      </U>
    </V>
 </L>
</L>
Advertisement