Open Martin97y opened 7 months ago
I haven't gotten to redoing the documentation yet
The best example I can give is probably my TurboMod: https://github.com/MarvinBeym/My-Summer-Car-Turbocharger/tree/feature/rework (feature/rework branch)
assetsBundle = Helper.LoadAssetBundle(this, "turbochargermod.unity3d");
PartBaseInfo
object (this is pretty much a container for all the stuff that every part would need.
partBaseInfo = new PartBaseInfo(this, assetsBundle, partsList);
DerivablePart
Example: https://github.com/MarvinBeym/My-Summer-Car-Turbocharger/blob/feature/rework/SatsumaTurboCharger/part/TurboSmallExhaustInletTube.cs
(The ExhaustHeader parent
parameter is the parent (where this part installs on, this can also be a GamePart
) which is a wrapper for parts added by the game (for example the cylinder head)
prefabName
as that is then automatically loaded using the partId.MscModApi.MscModApi.NewGameCleanUp(this);
. This will reset parts when you start a new gameThat's all you need for a part spawning & interactable
There are several more features of the api so let me know if you need further help
Thanks! And also the default spawn location is gonna be like normal position on load?
correct
And how to put specific parent? I want to install my model into the trunk on car body, can i specify position and rotation?
you will have to figure out a part you want it to attach, take
use Developer Toolset 2 to search for a part that would fit what you need.
For example the Dashboard would be dashboard = new GamePart("Database/DatabaseMechanics/Dashboard");
(You can use the example ´Database/DatabaseMechanics/Dashboard` to see how it would have to look. It needs a very specific setup of components (You can see that on the right side of the Developer Toolset 2 UI). It's always a part with uppercase first letter, !!! NEVER !!! with lowercase. (that path with Database/DatabaseMechanics is optional, but if there are multiple parts called "Dashboard" you might get the wrong one (which is random) and your mod will crash, so best to use the entire path to be sure).
Alternatively you can use SatsumaGamePart.GetInstance()
which acts as a fake GamePart object (because the car itself does not implement things an actual GamePart
of the game does (eg. you can't disassemble the Satsuma itself... because it is the starting point for everything else already, there is nothing the car itself is attached to...).
Usage of it should be avoided if possible as it's not the proper way to do it. There should be few instances where this is required and there is no proper way.
Position and Rotation get defined by
protected override Vector3 partInstallPosition => new Vector3(-0.0668f, 0.28826f, -0.08025f);
protected override Vector3 partInstallRotation => new Vector3(0, 0, 0);
inside the class you created
Now it shows this.
I don't see you passing a parent to the base(...) call.
i'd recommend enabling developer/debug mode for ModLoader to see where the error is actually occuring
Ok sending whole log
"Version 4.0.0" is definetly wrong, you have your Visual Studio project incorrectly configured somewhere.
Something from the dev mode is also missing. Are you executing the debug.bat file after moving your .dll file to the mods folder?
And is your Visual Studio set to build in "Debug" as well?
I tried building it on lower version but then i got error on NET 2.0, and Debug build is selected.
you will have to build it on Net 2.0
there is no way around it
So your api needs to be built on 2.0 too?
everything in this game has to be, regardless of what it is,
the game is using decades old Unity
you don't have to do anything with my MscModApi code, you just have to put the .dll file from the Releases tab into your games mod folder
Switched to 2.0 but now im missing these two references
you probably didn't follow the ModLoader instructions. You are likely missing this:
https://github.com/piotrulos/MSCModLoader/wiki/Install-Visual-Studio-for-MSCLoader
Mainly the .Net 3.5
I have everything enabled, trying to update studio now
Still with everything installed im missing these 2 references.
Try using 3.5 instead of 2.0 like Ms loader says
Now references are ok. But another problem
Config
Missing a reference to the MscLoader.dll I guess
Why have you opened the MscModAli in visual studio code.
As I said, you only put the dll file of my MscModApi inside your mods folder, then in your visual studio project, you add a reference to that dll
Did that, but i cant still build my mod on 3.5 or 2.0 only on 4.0 which gives me error in game
Isnt this the problem? Msc loader was built on 4.0
I just looked at how my project is setup. "Target Framework" has to be Unity 3.5 .net full Base Cass Libraries
Still throws error.
Can you post a screenshot of the line where this error occurs in your code? (File & Line columns in your current screenshot)
Hmm looks like there is no error...
Have you tried just building it? Sometimes visual studio sees errors that don't exist (anymore)
Alternatively you could try creating a completely new project and set it up correctly from the start
New project less errors.
MscModApi is imported
I can build on 4.0
Then I don't know without sitting in front of it.
Compiling with .net 4 is definitely wrong and may cause your mod to not work as intended.
That's all I can say about this
I will try again later, but thanks for all your help! :)
Hello i want to use your modApi for my mod, but i got some problems. The documentation is hard to understand, i dont know how to use it. Can you please send me a example of installable part with screws? Thanks!