- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Problem with CreateInstanceFromParameter
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Problem with CreateInstanceFromParameter
Replies: 2 (Who?), Viewed: 417 times.
#1
21st Jun 2020 at 7:16 PM
Posts: 1,497
Thanks: 4279 in 41 Posts
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?)" |
Advertisement
#2
22nd Jun 2020 at 11:00 AM
Posts: 3,860
Thanks: 8537 in 67 Posts
Here you go:
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
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
#3
22nd Jun 2020 at 12:03 PM
Posts: 1,497
Thanks: 4279 in 41 Posts
Who Posted
|