A little help with recipes and icons

Lara

Coal
Mod Dev
Messages
40
Likes
21
#1
It took me some time to figure out how recipes work, just want to share my annotations with you. :)

Edit: I added a more detailed tutorial for the icons, below in post #3.

C#:
[RequiresSkill(typeof(BasicCraftingSkill), 0)] //skill used, level required
    public class WaterWellBlockRecipe : Recipe //unique name of the recipe
    {
        public WaterWellBlockRecipe()
        {
            this.Products = new CraftingElement[]
            {
                new CraftingElement<WaterItem>(1), //what is crafted, ammount, can craft multible products at a time
            };
           
            this.Ingredients = new CraftingElement[] //can't be empty or zero, can use multible ingredients at a time
            {
                new CraftingElement<PlantFibersItem>(typeof(BasicCraftingEfficiencySkill), 0.1f, BasicCraftingEfficiencySkill.MultiplicativeStrategy),
            };
           
            this.CraftMinutes = CreateCraftTimeValue(typeof(WaterWellBlockRecipe), Item.Get<WaterItem>().UILink(), 0.1f, typeof(BasicCraftingSpeedSkill)); //from arrows recipe, 2 sec at max lvl
           
            this.Initialize("Water", typeof(WaterWellBlockRecipe)); //visible name at the crafting station
           
            CraftingComponent.AddRecipe(typeof(TraditionalWaterWellObject), this); //where is it crafted
        }
    }
If you don't know where to use this, check https://github.com/StrangeLoopGames/EcoModKit/wiki/Tutorial-Ceiling-Fan-Light
Tip: If you only want to create a new ingredient for cooking or crafting or a food item, you can skip the whole "Initial Object Setup" part and everything below "Sending Custom Interactions" from the above tutorial. You only need to create an icon in unity3d and a working .cs file. (proper .cs files even work without an icon/unity file, uses template icon then)

And don't reinvent the wheel for the icon (just because the tutorial tells you), there are so many nice free graphics out in the wild. (e.g. http://pngimg.com/ or http://game-icons.net/)
 
Last edited:

Gabeux

Coal
Mod Dev
Messages
23
Likes
17
#2
Hi Lara!
Could you post a screenshot of a unity3d file with an icon on it? Or maybe an example Unity Project?
I'm having a hard time getting info or making custom icons work (even for simple stuff like a new Skill Book).

Thanks for the tips and happy modding!
EDIT: Managed to find my way around it, but I wonder if it could help newbs like me! :D
 
Last edited:
OP
OP
Lara

Lara

Coal
Mod Dev
Messages
40
Likes
21
#3
I struggle more with the programming part, hope this helps, happy modding too. :)

1. create a new project in unity3d (I currently use 2017.4, current EcoModKit shader for 3d meshes/Scene window is not working properly in any of the 3 unity versions I have installed)

2. import EcoModKit.unitypackage into your new project, https://github.com/StrangeLoopGames/EcoModKit

3. open TemplateScene.unity and save as NameOfYourMod.unity (I put my files directly in the Assets folder, tutorial says create a new sub-folder there, but whats really important here, keep all the folders of the project clean, there especially must not be any backups of .unity files with duplicated Object/Item definitions in them, those likely corrupt the build file later without any error message)

Screenshot_icons_1.png

4. rename SampleItem to WhateverNameYouChooseInTheCodeFileItem

5. get a square image file (I tested .gif: ugly // .png: small file size, a bit buggy sometimes // .psd (Photoshop) larger file size, quality looks equally to .png)

6. move the image into your projects Assets folder and convert it to Texture Type: Sprite (2D and UI)

Screenshot_icons_2.png

7. go to RenamedSampleItem/Icon/Foreground in your Scene and choose your converted Sprite as Source Image, in the red field below you choose the overlay color of your Sprite, usually white (default color in SampleItem is red)

Screenshot_icons_3.png

8. (optional) if your Foreground image has transparency you should also have a look at the Background, same steps for adding an image, the background color set here also determines the text color of your items in-game, one .unity file can contain multible icons (Item/Object definitions)

9. save your Scene, then go ModKit -> Build Current Bundle

10. place the just build .unity3d file together with your code file inside the Eco Server's Mods folder (most often encountered error here again, duplicated definitions in code files or .unity3d files, somewhere inside the Mods folder)
 
Last edited:

Kirthos

Copper
Mod Dev
Messages
78
Likes
38
#4
Just a thing to say, rename your unity scene. Cause if you have 2 mods with the same scene name this will cause problems when loading the mods.
 

Gabeux

Coal
Mod Dev
Messages
23
Likes
17
#5
Awesome! Thanks Lara! And I did bump into the issue Kirthos brought up. What I heard is the best practice is to name your scene as your mod name, to prevent conflicts [if 2 mods have the same scene name, one of them won't have their assets loaded].
Thanks!!
 
Messages
1
Likes
0
#8
It's as simple as I thought... once you have seen the steps for the first time (y)
And now for something completely different: can you do the same for 3D too, please?
 
OP
OP
Lara

Lara

Coal
Mod Dev
Messages
40
Likes
21
#9
3D yes, possibly, but not before the next update of the ModKit, I'm sorry.
I'm getting only along with my previous Unity and 3d knowledge.
Another tutorial I found useful in addition to the ceiling fan tutorial, very slightly outdated.

 
Top Bottom