#1
11th Nov 2020 at 10:00 AM
I need help with modding (noob)
This forum isn't very active but I'm throwing this out here for the chance that someone might help me.
I'm trying to make a mod to enable Debug_MakeSelectable. I know that Grim's Core mod makes this possible, but I mostly use the debug option just to make npcs selectable. And, I keep "breaking" my save when I accidentally click a debug option I really shouldn't click. This is the first time I've attempted modding but with my basic java knowledge, I'm following Deedawg's guide and looking at other mods for help/reference. My file has no issues according to visual studio but when I package it and put it in game, I don't see the interaction when I click on an npc.
Since I am targeting a specific interaction, I cannot look at Rick's debug enabler or Grim's core mod for help since both enable most if not all debug interactions in a general way. I looked at TZ's dynamic professions and that helped a little bit. But, once I get to:
Code:
protected override bool Run()
{
this.Target.SimDescription.IsNeverSelectable = !this.Target.SimDescription.IsNeverSelectable;
if (this.Target.SimDescription.IsNeverSelectable && PlumbBob.SelectedActor == this.Target)
PlumbBob.SelectNextSim();
return true;
}
I'm not sure what this means so I don't know what to do. My thought is that there should be an else if function there. But, I looked at the SimDescriptions and nothing really caught my attention except for public bool IsActiveSim and public bool IsSelectable. When I try to write a line with either of those, I get the error "CS0117: SimDescription does not contain a description for IsActiveSim" I've spent too many hours on this and I'm stumped.
Anyways, here's the code:
Code:
namespace ToggleNPC
{
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.Autonomy;
using Sims3.Gameplay.CAS;
using Sims3.Gameplay.Core;
using Sims3.Gameplay.Interactions;
public class ToggleNPC : ImmediateInteraction<Sim, Sim>
{
public static readonly InteractionDefinition Singleton;
public static void AddInteractions(Sim sim)
{
sim.AddInteraction(ToggleNPC.Singleton);
}
public static void RemoveInteractions(Sim sim)
{
sim.RemoveInteractionByType(typeof(ToggleNPC.Definition));
}
protected override bool Run()
{
this.Target.SimDescription.IsNeverSelectable = !this.Target.SimDescription.IsNeverSelectable;
if (this.Target.SimDescription.IsNeverSelectable && PlumbBob.SelectedActor == this.Target)
PlumbBob.SelectNextSim();
if
return true;
}
static ToggleNPC()
{
ToggleNPC.Singleton = (InteractionDefinition) new ToggleNPC.Definition();
}
[DoesntRequireTuning]
private sealed class Definition : ImmediateInteractionDefinition<Sim, Sim, ToggleNPC>
{
protected override string GetInteractionName(
Sim a,
Sim target,
InteractionObjectPair interaction)
{
return !target.SimDescription.IsNeverSelectable ? "Make me a NPC" : "Make me selectable.";
}
public override string[] GetPath()
{
return new string[1] { "Sim..." };
}
protected override bool Test(
Sim a,
Sim target,
bool isAutonomous,
ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return true;
}
}
}
}
I appreciate any help, guidance, insight, etc..