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!
Lab Assistant
Original Poster
#1 Old 9th Dec 2021 at 12:09 PM
Default Plantsim Mod - Create plant out of thin air
Hello!
I am currently making a mod where if you're playing as a plantsim, you can click on the ground and create a "build-mode-plant".
Here are the code lines for the object creation:

Code:
LotLocation invalid = LotLocation.Invalid;

GameObject gameObject = GlobalFunctions.CreateObject("PlantLavender,EP1,Sims3.Gameplay.Core.Null", Destination, invalid.mLevel, Vector3.UnitZ) as GameObject;

World.GetLotLocation(Destination, ref invalid);


However, I am having some troubles. The interaction appears in game, but when using the interaction, a white box is created at the location, saying "Missing object resource instance PlantLavender,EP1,Sims3.Gameplay.Core.Null"
Image



However...
I have Nraas DebugEnabler installed and when I click on the ground and choose Nraas > Debug, and select "Create Object" and use the same line as in my code (PlantLavender,EP1,Sims3.Gameplay.Core.Null), the plant is created without any issues.

Does anyone have any idea why the plant won't be created with my mod when it can be created with DebugEnabler?
Screenshots
Advertisement
Space Pony
#2 Old 9th Dec 2021 at 2:03 PM
The format of the CreateObject method is a bit different from the "Create Object" debug interaction. What you're looking for is an object from EP1 with an instance name of "PlantLavender", but instead you're telling the game to create an object from the base game with an instance name of "PlantLavender,EP1,Sims3.Gameplay.Core.Null."

Try using the following overload of the CreateObject method instead:

Code:
GameObject gameObject = GlobalFunctions.CreateObject("PlantLavender", ProductVersion.EP1, Destination, invalid.mLevel, Vector3.UnitZ, null, null) as GameObject;

"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt

If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
Lab Assistant
Original Poster
#3 Old 9th Dec 2021 at 2:16 PM
Quote: Originally posted by gamefreak130
The format of the CreateObject method is a bit different from the "Create Object" debug interaction. What you're looking for is an object from EP1 with an instance name of "PlantLavender", but instead you're telling the game to create an object from the base game with an instance name of "PlantLavender,EP1,Sims3.Gameplay.Core.Null."

Try using the following overload of the CreateObject method instead:

Code:
GameObject gameObject = GlobalFunctions.CreateObject("PlantLavender", ProductVersion.EP1, Destination, invalid.mLevel, Vector3.UnitZ, null, null) as GameObject;


It worked!
Thank you so much gamefreak, I really appreciate it!
Back to top