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!
Test Subject
Original Poster
#1 Old 23rd Jul 2014 at 6:23 AM
Default First Mod: Insect Spawner
Hey, everyone!

I'm zefelici and even though I have frequented ModTheSims for as long as I can remember, this is my first time ever in its forums and, more importantly, the first time ever that I'm Modding an object.
I have tunned XML files for a while, but, recently, I decided to try and mod objects, since I was in need of a Insect Spawner for my game.

Well, done with a little "briefing", let's get to the part that matters:
As I don't have a lot of experience in C# programming (or in any programming languages, actually), I used a couple tutorials to guide me, but used mainly what EA had already done.
I also did a little digging in Treeag's Treasure Box (since I wanted something similar to their mod). I actually managed to Build the Solution and create the package. So I went testing.
There was no blue screen or crashing or anything when I placed or tried to use the object, so that's a star
But, and here is why I wanted to ask you guys for help , the interactions which the Spawner was supposed to have don't show up When I hover over it, it also displays only the nameplace of the file.

Code:
namespace Sims3.Gameplay.Objects.Miscellaneous.ZefeliciMod.InsectSpawner
{
    public class InsectSpawner : TreasureChestFrance
    {
        private sealed class Open : ImmediateInteraction<Sim, InsectSpawner>
        {
            // Fields
            public static readonly InteractionDefinition Singleton = new Definition();

            // Methods
            protected override bool Run()
            {
                HudModel.OpenObjectInventoryForOwner(base.Target);
                return true;
            }

            // Nested Types
            private sealed class Definition : ImmediateInteractionDefinition<Sim, InsectSpawner, InsectSpawner.Open>
            {
                // Methods
                protected override string GetInteractionName(Sim a, InsectSpawner target, InteractionObjectPair interaction)
                {
                    return Localization.LocalizeString("Gameplay/Objects/Toys/ToyBox/Open:Open", new object[0]);
                }

                protected override bool Test(Sim actor, InsectSpawner target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
                {
                    return true;
                }
            }
        }
         private sealed class InsectSpawn : ImmediateInteraction<Sim, InsectSpawner>
                {
                    // Nested Types
                    [DoesntRequireTuning]
                    private sealed class Definition : ActorlessInteractionDefinition<Sim, InsectSpawner, InsectSpawner.InsectSpawn>
                    {
                        // Fields
                        public InsectType mType;

                        // Methods
                        public Definition()
                        {
                        }

                        public Definition(InsectType type)
                        {
                            this.mType = type;
                        }

                        protected override void AddInteractions(InteractionObjectPair iop, Sim actor, InsectSpawner target, List<InteractionObjectPair> results)
        {
            foreach (InsectType type in InsectData.sData.Keys)
            {
                results.Add(new InteractionObjectPair(new InsectSpawner.InsectSpawn.Definition(type),target));
            }
        }

                        protected override string GetInteractionName(Sim a, InsectSpawner target, InteractionObjectPair interaction)
                        {
                            InsectData data = InsectData.sData[this.mType];
                            return Localization.LocalizeString(data.Name, new object[0]);
                        }

                        public override string[] GetPath(bool isFemale)
                        {
                            string str;
                            InsectData data = InsectData.sData[this.mType];
                            if (data is ButterflyData)
                            {
                                str = "Butterfly...";
                            }
                            else if (data is BeetleData)
                            {
                                str = "Beetle...";
                            }
                            else if (data is GlowBugData)
                            {
                                str = "Glow Bug...";
                            }
                            else if (data is NaniteData)
                            {
                                str = "Nanite...";
                            }
                            else
                            {
                                str = "Other...";
                            }
                            return new string[] { Terrain.kCreateName, "Insect...", str };
                        }

                        protected override bool Test(Sim a, InsectSpawner target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
                        {
                            return true;
                        }

                    }


                }
            }

        }


This is the code I got. I don't even know if it is the best or the ideal code for this kind of mod, but, since, at first, it is solely for personal use, I don't really mind.

Could any one, please, help me?

Thank you,
zefelici
Advertisement
Test Subject
Original Poster
#2 Old 24th Jul 2014 at 4:22 PM
Well, I gave up, I'm too of a noob in programming to create such mod...
BUT! Good news! I found that Nraas' Debug Enabler has an Insect Spawner, so I'm done with this project for now
I'm just surprised I didn't find it before
Back to top