Heeeeeeeyyyy guys!!
Good news! I've solved the problem!!
In this picture, my seaweed has different models between in ocean and on land.
Here is a tutorial about how I made object switching its models by using S4S.
1. Adding ModelsTo make object switching model, we need to make two or more model suites by adding model and its model lod.
2. Add model instance in Object Definition and Cutout Info Table.In
Object Definition, click
Edit Items... of
Model, then add those model instance you just added to this object.
Also in
Cutout Info Table, click
Edit Items... of
Entries. Then add new entry, fill
ModelId with the same model instance as you did in Object Definition.
3. Model SuitesIf you can see the number marked on models, such as [1] and [2], it means you successful adding more model suites.
Now you have more model suites. Next step is editing Tuning to make them switching models between different locations.
4. Create ObjectStateValue-tuning for each model states.The tuning type is ObjectStateTuningResource, and codes is:
<?xml version="1.0" encoding="utf-8"?>
<I c="ObjectStateValue" i="object_state" m="objects.components.state" n="ModelState_Water" s="000001">
<U n="new_client_state">
<V n="model_suite_state_index" t="apply_new_value">
<T n="apply_new_value">0</T>
<!--The number is the model suite number, but first model suite number actually is 0.-->
</V>
</U>
</I>
The number of
apply_new_value is the model suite number, but first model suite number is 0, second number is 1, and so on.
And then list your custom ObjectStateValue in another custom ObjectState.
Thank pixaratv help me solved this problem.For example, I crated three objectStateValue and one ObjectState for my seaweed mod (tuningId just for example):
- ModelState_Water, tuningId: 000001
- ModelState_Land, tuningId: 000002
- ModelState_inPlanterBox, tuningId: 000003
- ModelState_ObjectState
My in-water model suite number literally is [1] but the actually number is 0, and the on-land model literally is [2] but the actually number is 1. And seaweed be planted in planter box is same as planted it on land so I used the same model suite number as on-land.
5. Setting Model State with a Test by Surface Type.Go to the GameObject-tuning of this object. We have to add
states to make this mod switching its model while location changed. I only excerpted the part codes of
states:
<I c="GameObject" i="object" m="objects.game_object" n="object_seaweed" s="tuningId">
<U n="_components">
<V n="state" t="enabled">
<U n="enabled">
<L n="states">
<U>
<L n="client_states">
<U>
<T n="key">000002<!--ModelState_Land--></T>
</U>
<U>
<T n="key">000001<!--ModelState_Water--></T>
</U>
<U>
<T n="key">000003<!--ModelState_inPlanterBox--></T>
</U>
</L>
<V n="default_value" t="reference">
<T n="reference">000002<!--ModelState_Land--></T>
</V>
<T n="reset_to_default">False</T>
<V n="tested_states_on_location_changed" t="enabled">
<U n="enabled">
<V n="fallback_state" t="enabled">
<T n="enabled">000002<!--ModelState_Land--></T>
</V>
<L n="tested_states">
<U>
<T n="state">000001<!--ModelState_Water--></T>
<L n="tests">
<L>
<V t="location">
<U n="location">
<U n="location_tests">
<V n="valid_surface_types" t="Test_Surface_Types">
<U n="Test_Surface_Types">
<V n="whitelist" t="specify">
<U n="specify">
<V n="threshold" t="all_must_match" />
<L n="whitelist">
<E>SURFACETYPE_POOL</E>
</L>
</U>
</V>
</U>
</V>
</U>
<E n="subject">Object</E>
</U>
</V>
</L>
</L>
</U>
<U>
<T n="state">000003<!--ModelState_inPlanterBox--></T>
<L n="tests">
<L>
<V t="location">
<U n="location">
<U n="location_tests">
<V n="is_in_slot" t="enabled">
<U n="enabled">
<V n="slot_test_type" t="specific_slot">
<U n="specific_slot">
<T n="require_slotted">True</T>
<T n="specific_slot_set">slotSet_GardenPlantPotLarge</T>
</U>
</V>
</U>
</V>
</U>
<E n="subject">Object</E>
</U>
</V>
</L>
</L>
</U>
</L>
</U>
</V>
</U>
</L>
</U>
</V>
</U>
</I>
In this codes, using
Test_Surface_Types to test which locations of this object be placed. So we white list
SURFACETYPE_POOL which means object placed on any water surface would switch its model to ModelState_Water, and placed in the planter box would switch its model to ModelState_Land. Otherwise the model of this object will stay in ModelState_Land.
Final Step. Edit Object CatalogDon't forget editing Object Catalog like I said in previous thread.
Edited
PlacementFlagHigh to 60 and
checked AllowedOnWaterSurface.
I omitted some details of adding models and editing tunings, feel free to ask any questions.
Fish Trap is a good example for this tutorial, and Counter is a example about multiple model suites.