Sims 3:HowIMadeAToiletClassWithTuning

From SimsWiki
Revision as of 04:38, 14 September 2009 by Inge Jones (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

How I made a toilet with its own class and its own tuning - by Inge Jones


I decided to use exactly the same graphics as for a normal expensive toilet, so in the package I only included the parts down to but not including the VPXY. If you want to give your object a new appearance too, you will need to keep the scenegraph chain down through the VPXY to the lowest level (the Cloner will get all those parts for you by default)

The new script resource, also to be imported to the package, had to have an IID that was the fnv64 of the dll name "ToiletInge.dll".

I had to edit the OBJK to point to a new scriptclass, which I had to write the definition of, using the toiletExpensive definition as a guide. This makes my new toiletInge one of "toilet" just like toiletExpensive is one of toilet.

Finally I also placed in my package a copy of the original toilet's tuning xml from gameplaydata, and gave it an IID that was fnv64 of the scriptclasskey in OBJK. This meant I could make my toilet break and get dirty on every use.

The source is below

using Sims3.Gameplay.ObjectComponents;
using Sims3.Gameplay.Abstracts;
using Sims3.Gameplay.Objects.Plumbing;
using Sims3.SimIFace;

[assembly: Tunable]

namespace Sims3.Gameplay.Objects.Plumbing.Mimics
{


    public class ToiletInge : Toilet
    {
        // Fields
        [Tunable]
        private static CleanableComponent.Tuning kCleanableTuning = new CleanableComponent.Tuning();
        [Tunable]
        private static GameObject.EnvironmentMotive kEnvironmentTuning = new GameObject.EnvironmentMotive();
        [Tunable]
        private static RepairableComponent.Tuning kRepairableTuning = new RepairableComponent.Tuning();
        [Tunable]
        private static Toilet.Tuning kToiletTuning = new Toilet.Tuning();

        // Properties
        public override CleanableComponent.Tuning CleanableTuning
        {
            get
            {
                return kCleanableTuning;
            }
        }

        public override GameObject.EnvironmentMotive EnvironmentTuning
        {
            get
            {
                return kEnvironmentTuning;
            }
        }

        protected override string OverflowFxName
        {
            get
            {
                return "s30_toiletExpensiveOverflow";
            }
        }

        public override RepairableComponent.Tuning RepairableTuning
        {
            get
            {
                return kRepairableTuning;
            }
        }

        public override Toilet.Tuning ToiletTuning
        {
            get
            {
                return kToiletTuning;
            }
        }
    }

}

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox