User:JT/Master "In" Pile

From SimsWiki
Jump to: navigation, search

Script modding errors and solutions

No suitable method to override when creating a new interaction

PROBLEM
'YourNamespace.YourInteractionName.Definition.Test(Sims3.Gameplay.Actors.Sim, Sims3.Gameplay.Actors.Sim, bool, ref Sims3.SimIFace.GreyedOutTooltipCallback)': no suitable method found to override
	public class InteractionInRabbithole : Interaction<Sim, RabbitHole>
	{
		[DoesntRequireTuning]
		private sealed class Definition : InteractionDefinition<Sim, RabbitHole, InteractionInRabbithole>
		{
			protected override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) {
				return false;
				}
		}
	}
Solution
Your object types in Test() don't agree with the parameters of the Interaction<> template. For instance, this Test() function will only work for an Interaction<Sim, Sim>, so it fails because it appears in an Interaction<Sim, RabbitHole>. The Test() function's second Sim parameter (target) should be changed to a RabbitHole object type. This trap is easy to fall into if you copy-and-paste working interactions and forget to update the object types of your parameters.
Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox