![]() ![]() protected override void Update() Unity Ke圜odes When you do this, your method will be chained. To call the original code you have to add a call to the base method. With this code you'll overwrite the whole method. NOTICE: In the current ModAPI version you can only override methods with a void or bool return! class TheForestAtmosphereExtended : TheForestAtmosphere This is possible with public and private methods. To add code into an existing method you just override the method. As an example we look at the "TheForestAtmosphere" class. ![]() To inject code into existing methods you have to extend from the class containing the method. This parses the value inside out textbox and sets the day. "Clock.Day" luckily is public static, so we can call it directly.Īdd Clock.Day = Int32.Parse(day) to our button. Select the "Assembly-CSharp.dll" in The Forest folder: ".\SteamApps\common\The Forest\TheForest_Data\Managed\" Now we need to find the function that actually changes the day. Open a singleplayer game and hit our hotkey. View the "Mods"-Tab in ModAPI and toggle your new mod. If you create the mod again in the future, increment the version or delete the mod in "/mods/TheForest/Day*.mod". It should say "Created mod successfully". Go to ModAPI and click "Create Mod" in the lower right of your project. The build should finish with "Build: 1 succeeded". Either click "Start" or "Build > Build Solution (CTRL + SHIFT + B)" We can build and run our project and see if it works. We still need to open the menu by using the key we assigned in ModAPI: private void Update() Now we create the GUI layout with an input box, where you enter the day you want and a button to set the day: private bool visible We do that by creating a new GameObject and appending our class: using System It should open and look something like this:įirst, we need to add our stuff to the game. Visual C# Items > Class > and name it something like "Day.cs". Navigate to "/projects/TheForest/Day/" in your ModAPI folder and open the "*.sln" with Visual Studio. If you need, add a hotkey in "Assignable keys": Give it a name and optionally a description: Open ModAPI, go to the development tab and click " Create new project": Continue at the Green Hell section for the tutorial and quirks. However, Green Hell uses its own / unity methods. ![]() In most games ModAPI specific methods, attributes, etc. There are some out there, but in this tutorial i will go with ILSpy: ILSpy You can even get Professional for free if you are a student. You can grab it for free here: Visual Studio Now we need Visual Studio (not Visual Studio Code!). If you haven't already, extract it somewhere. In this tutorial we want to change the ingame day by using the GUI. Basic C# knowledge would be an advantage. "welcome to the server, please no cheating or griefing" is a good way to greet new players, and sometimes might just work to prevent players from playing in a manner you don't wish them to play while in your server.Develop mods Generic Unity games + Basic ModAPI usage Getting started When playing publicly, I suggest saving frequently and asking new players not to cheat. So if you see someone building rock walls while holding a rock something is probably amiss. Inventory mod will sometimes cause players to pull sticks or rocks out and hold them as a weapon while spawning them. If you see players doing this it's because when they click an option on their cheat menus it registers in the game as the player performing a left or right click just like normal. There's a few ways to tell if someone is cheating, but one of the tell-tale signs of using Mod API with inventory mod or cheat menu (two of the most common mods) is players attacking and blocking randomly or repeatedly. Before you realise what happened you're walls will be finished and decorated with seagul, crocodile, and shark heads. I'll fill up your resource holders, rocks, sticks, logs, medicine, soda, snacks, bones, and arrows. I'll come into your base and set katanas, modern axes, and bombs all over your weapon racks.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |