Jump to content

Recommended Posts

Hello!

I am working on a character mod that has her own Abigail-like ghost. 
Currently I'm still fighting with how to get the flower to show up on the map and being able to craft the flower if it gets lost. 

What should I check and what do I need to add to the main.lua file and character prefab??
I've been working on this for a week now, but I still can't understand much of the coding...

Any help please?

There is a lua file called abigail_flower.lua in the prefab folder. For it to show up on the map you want to use inst.MiniMapEntity:SetIcon("Example.png").

As far as crafting goes there are a few threads around mentioning how to make a custom item and adding it in as a recipe, if I can find a link to one of the threads I'll update this.

 

Here's the thread for custom recipe's 

 

Edited by RedHairedHero

Thank you for your reply and linking me!

I have the inst. code set in the abigail_flower.lua:

local function common_postinit(inst)
        -- Minimap icon
    inst.MiniMapEntity:SetIcon("abigailflower.png")
end 

but it still doesn't seem to show up..?
Or did I put that under the wrong local function? 

Also what seems to happen when I add a recipe to my modmain.lua is that the game crashes due to an error and tells me to check my log...
But nothing seems to say anything about what caused the error...

Sorry, try adding the below code into the common_postinit function

inst.entity:AddMiniMapEntity()

inst.MiniMapEntity:SetIcon( "example.tex" )

just replace example.tex with the name of your images tex file.

 

As far as the error goes if you can share your error log it would be helpful, you can find it in Documents/Klei/DontStarveTogether and it should say something like log.txt.

I have done this, but it still doesn't show up...
I even tried renaming the map files because I thought it would conflict with the others that were named the same...

7829cd2a77.jpg

This is what I got from the client_log

This is what I added to my modmain.lua
 


local Ingredient = GLOBAL.Ingredient
local customrecipe = AddRecipe("scarlia_ghost_flower", {Ingredient("petals", 6), Ingredient("nightmarefuel", 1)}, GOBAL.RECIPETABS.MAGIC, GLOBAL.TECH.SCIENCE_ONE, "bestfriend_crafter", nil, nil, nil, nil, "images/inventoryimages/abigailflower.xml", "abigailflower.tex")

Do I have to add an extra prefab flower for the recipe?

Edited by scarstalgia
35 minutes ago, scarstalgia said:

I have done this, but it still doesn't show up...
I even tried renaming the map files because I thought it would conflict with the others that were named the same...

7829cd2a77.jpg

This is what I got from the client_log

 

This is what I added to my modmain.lua
 



local Ingredient = GLOBAL.Ingredient
local customrecipe = AddRecipe("scarlia_ghost_flower", {Ingredient("petals", 6), Ingredient("nightmarefuel", 1)}, GOBAL.RECIPETABS.MAGIC, GLOBAL.TECH.SCIENCE_ONE, "bestfriend_crafter", nil, nil, nil, nil, "images/inventoryimages/abigailflower.xml", "abigailflower.tex")

Do I have to add an extra prefab flower for the recipe?

You typed in 

GOBAL.RECIPETABS.MAGIC

This is most likely the reason it crashed. I would also attempt to load the game without any other mods. I'd have to do more research to see about the map icon and get back to you.

Hmm.. What is it I need to type in instead?
Is it not the magic tab for the recipe that needs to be used?
I tried typing in "TOWN" instead and it still crashes. 
I don't really have any other mods running except my own. 
Every time I try to load my local server to test the mod out, it crashes...

But thank you for your continuous help!

1 hour ago, Lumina said:

Nothing idiot about not seeing a typo, it's hard to see because when we read something we autocorrect small mistake like this. It took me some time to see it too.

Heheh.. Yes. It's very confusing. Thank you for understanding. (:

The game has stopped crashing, but I still don't see Abigail's Flower in the magic crafting tab.. 
Continuing to look around what I might have done wrong for trying to have her flower show up

For the recipe under Prestihatator you want to do

GLOBAL.RECIPETABS.MAGIC, GLOBAL.TECH.MAGIC_TWO

for the Shadow Manipulator just change out the word TWO for THREE.

I'm not quite sure about the minimap icon unfortunately.

For minimap icon, in addition to minimap code on the item, i usually need this line in modmain :

        AddMinimapAtlas("minimap/yourprefab.xml")

And the asset in modmain too. But if you use game assets i don't know what you need exactly...

 

Quote

GLOBAL.RECIPETABS.MAGIC, GLOBAL.TECH.MAGIC_TWO

I used this code, but now my crafting tabs are swapped... meaning, the first few craftable items (flower garland, straw hat etc...) in the survival tab have now moved to the magic tab, and in the magic tab the other way around... 
Whoops.. I think it was always like that... ;;;

This is what it looks like now, but I still don't see it being craftable...

local Ingredient = GLOBAL.Ingredient

local customrecipe = AddRecipe("scarlia_ghost_flower", {Ingredient("petals", 6), Ingredient("nightmarefuel", 1)}, 
GLOBAL.RECIPETABS.MAGIC, GLOBAL.TECH.MAGIC_TWO, "bestfriend_crafter", nil, nil, nil, nil, "images/inventoryimages/abigailflower.xml", "abigailflower.tex")

 

8 hours ago, Lumina said:

For minimap icon, in addition to minimap code on the item, i usually need this line in modmain :

        AddMinimapAtlas("minimap/yourprefab.xml")

And the asset in modmain too. But if you use game assets i don't know what you need exactly...

 


I added both the asset and the minimapatlas to my modmain... Still nothing.. ):

Edited by scarstalgia

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...