Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 29th Mar 2025 at 8:48 PM
Default Help with scripting: adding interaction from a fireplace to a custom stove to make a fire? ("light fire/put out fire")
Hi, some of you might have seen my thread about adding a decorative fire effect here: https://modthesims.info/showthread.php?t=688695

Currently I’m trying to work on the custom script, and thought it was better to make a dedicated thread on the subject.
I know nothing about scripting. It’s basically a copy-paste of the code of the fireplace.

I only want the interactions “light fire/put out fire”, and make it so that, like with a fireplace, the fire is lit/put out, that’s all.

I used these tutos to get started:
https://modthesims.info/wiki.php?ti..._Object_Modding
https://modthesims.info/showthread.php?t=632267

I used Ilspy too along with sharpdevelop.

Here’s the code so far, I plan to add it to the custom stove with the fxsmoke I made and talked about in the thread about adding a decorative fire effect.

Also, here’s an archive of my sharpdevelop folder project, with the custom stove, so that anyone can take a look at it.

https://www.mediafire.com/file/fcrd...t_test.rar/file

The code.

Code:
/*
 * Created by SharpDevelop.
 * User: ijera
 * Date: 15/03/2025
 * Time: 17:18
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using Sims3.Gameplay.Abstracts;
using Sims3.Gameplay.ActiveCareer.ActiveCareers;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.ActorSystems;
using Sims3.Gameplay.Autonomy;
using Sims3.Gameplay.Careers;
using Sims3.Gameplay.CAS;
using Sims3.Gameplay.Controllers;
using Sims3.Gameplay.Core;
using Sims3.Gameplay.EventSystem;
using Sims3.Gameplay.Interactions;
using Sims3.Gameplay.InteractionsShared;
using Sims3.Gameplay.Interfaces;
using Sims3.Gameplay.ObjectComponents;
using Sims3.Gameplay.Objects.Alchemy;
using Sims3.Gameplay.Objects.Appliances;
using Sims3.Gameplay.Objects.CookingObjects;
using Sims3.Gameplay.Objects.Counters;
using Sims3.Gameplay.Objects.Fireplaces;
using Sims3.Gameplay.Objects.FoodObjects;
using Sims3.Gameplay.Objects;
using Sims3.Gameplay.Situations;
using Sims3.Gameplay.Skills;
using Sims3.Gameplay.ThoughtBalloons;
using Sims3.Gameplay.TuningValues;
using Sims3.Gameplay.Utilities;
using Sims3.Gameplay;
using Sims3.SimIFace.CustomContent;
using Sims3.SimIFace.Enums;
using Sims3.SimIFace;
using Sims3.UI.Hud;
using Sims3.UI;
using System.Collections.Generic;

namespace Sims3.Gameplay.Objects.Appliances.Mimics.ijerafirestove
{
    /// <summary>
    /// Description of MyClass.
    /// </summary>
    public class firestove : StoveCountry
    {
        public class FireplaceInteraction : Interaction<Sim, firestove>    
    {
        public class LightFire : FireplaceInteraction
    {
        private sealed class Definition : InteractionDefinition<Sim, firestove, LightFire>
        {
            protected override string GetInteractionName(Sim a, firestove target, InteractionObjectPair interaction)
            {
                return ("LightFire");
            }

            protected override bool Test(Sim a, firestove target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                return !target.mLit;
            }
        }
    }
    }
    public class PutOutFireInteraction : FireplaceInteraction
    {
        private sealed class Definition : InteractionDefinition<Sim, firestove, PutOutFireInteraction>
        {
            protected override string GetInteractionName(Sim a, firestove target, InteractionObjectPair interaction)
            {
                return ("PutOutFire");
            }

            protected override bool Test(Sim a, firestove target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                return target.mLit;
            }
        }
    }
    }
}
Senior Moderator
staff: senior moderator
#2 Old 2nd Apr 2025 at 1:00 PM
You don't need have a Fireplace interaction class to derive the other ones from. I would just create the LightFire and PutOutFire interactions derived from Interaction<Sim, FireStove>, and use the EA fireplace interactions as a reference.

You'll need the Run() methods to actually have the sim do something.

E.g:
Code:
public class Firestove : StoveCountry //Firestove should be capitalised as it's a class
    {
        public class LightFire : Interaction<Sim, Firestove>
        {
            public static readonly InteractionDefinition Singleton = new Definition(); //need to add this to add the interaction to the object


            private sealed class Definition : InteractionDefinition<Sim, Firestove, LightFire>
            {
                protected override string GetInteractionName(Sim a, Firestove target, InteractionObjectPair interaction)
                {
                    return ("LightFire");
                }

                protected override bool Test(Sim a, Firestove target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
                {
                    return !target.mLit;
                }
            }


            public override bool Run()
            {
                //make sim light fire
            }
        }


        public override void OnStartup()
        {
            base.OnStartup();
            AddInteraction(LightFire.Singleton);
        }
        
    }


I suggest just going through the light fire code and apply each bit as needed to your code. But it's mainly a matter of
- route sim to stove
- animate sim
- turn on/off fire effect

For the animations, you could try using the fireplace state machine, as the original code does it. Or it might be possible to just play a solo animation to keep things simple
Back to top