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!
Scholar
Original Poster
#1 Old 21st Jun 2020 at 7:16 PM
Default Problem with CreateInstanceFromParameter
So OccultGenie has an Interaction called Remove Sim. In the game this is called Banish Sim. So I am trying to recreate this interaction for Witches. I was having problems with the Terrain.TeleportMeHere entry = interaction.CreateInstanceFromParameters(ref parameters) as Terrain.TeleportMeHere; Where Create doesn't exist apparently.

I then copy pasted EA's interaction exactly with no changes and I still got a problem Terrain.TeleportMeHere entry = interaction.CreateInstanceFromParameters(ref parameters) as Terrain.TeleportMeHere; I don't know what's going on. How come the same code gets compiled by EA with no problem but I am getting error.

If anyone knows tell me.

This is the code
Code:
Terrain.TeleportMeHere.Definition interaction = new Terrain.TeleportMeHere.Definition(true, "_Genie");
                            
InteractionInstanceParameters parameters = new InteractionInstanceParameters(new InteractionObjectPair(interaction, Terrain.Singleton), base.Target, new InteractionPriority(InteractionPriorityLevel.RequiredNPCBehavior), false, false);
                            

Terrain.TeleportMeHere entry = interaction.CreateInstanceFromParameters(ref parameters) as Terrain.TeleportMeHere;


And this is the error message
Quote:
"Terrain.TeleportMeHere does not contain a definition for 'CreateInstanceFromParameters' and no extension method 'CreateInstanceFromParameters' accepting a first argument of type 'Terrain.TeleportMeHere.Definition' could be found (are you missing a using directive or an assembly preferece?)"

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Advertisement
Virtual gardener
staff: administrator
#2 Old 22nd Jun 2020 at 11:00 AM
Here you go:

Code:
Terrain.TeleportMeHere.Definition definition = new Terrain.TeleportMeHere.Definition(true, "_Genie");
InteractionObjectPair iop = new InteractionObjectPair(definition, Terrain.Singleton);
InteractionInstanceParameters interactionInstanceParameters = new InteractionInstanceParameters(iop, Actor, new InteractionPriority(InteractionPriorityLevel.RequiredNPCBehavior), false, false);
Terrain.TeleportMeHere teleportMeHere = ((InteractionDefinition)definition).CreateInstanceFromParameters(ref interactionInstanceParameters) as Terrain.TeleportMeHere;

The reason is because with the code you shared, in the last line, the code assumed that the 'CreateInstanceFromParameters' is in the Terrain.TeleportMeHere class. Whereas that method is actually in the InteractionDefinition class
Scholar
Original Poster
#3 Old 22nd Jun 2020 at 12:03 PM
Ok will try this out now.

If you like my mods. Consider supporting me on Patreon
Check out my website for updates on my mods and other work PuddingFace.wixsite.com
Check out my Youtube channel for tutorials(modding tutorials) and other content Youtube

Follow me on Twitter Instagram Pinterest Tumblr
Back to top