Mod programming help thread for Azhrak

How do I change the game speed, Like what file do I edit. I want to add some mods and not have to wait like 10-20 minutes to be able to obtain it.

Edit: Time to rename the thread instead of making another. because now my item isn’t being added to the game. I think I may have missed something.

I have all the files in the decorations folder. the icon, the qb files, the text files and the ghost file. I have edited them to have the corresponding names. I have added it to the manifest and create the job recipe for the mason.

I know there is something in the code that does it but not sure where

"simulation" : {
	"game_speed" : 10
}

In your “user_settings.json” can mess with the game speed.

Don’t forget the comma depending on why you add this, :wink:

Though thinking about it, what are you trying to accomplish. If you are testing your own mod and are bothered by crafting items over and over again and again, why not use some scripting to spawn the item in. Pretty much anything in the game can be automated with some work. This is what I do for my testing purposes.

It’s so I can get to the mason, I need the mason to check if all the UI stuff is working, like the picture and text.

I’m fairly certain you can just start with a mason (or at a minimum, have the tool spawned)… im sure @honestabelink can lend some corresponding code… :wink:

1 Like

This is a mod I made for development purposes, it’s perfect for your situation. Here’s a short list of things it supports.

  • main menu skip
  • quick loading time
  • create hearthlings
  • promote hearthlings to class
  • have hearthling place workbench
  • create stockpiles
  • place entity helper

Download - startupscript.zip - Google Drive

Extract to your “mods” folder.

Add this to your user_settings.json,

"mods" : {
	"stonehearth" : {
		"world_generation" : {
			"method" : "tiny"
		}
	}
}

Don’t forget to add a comma, depending on where you insert this :wink:

If you choose to download the file, here’s what to do.

Open up

startupscript/server_init.lua

Add this

self:place_citizen_with_job(pop, Point3(camp_x +16, pt.y, camp_z +12), 
	"stonehearth:jobs:mason", 
	"stonehearth:mason:talisman", 
	"stonehearth:mason:workbench",
	 Point3(camp_x+18, pt.y, camp_z +11))

for i = 0, 6 do
	self:place_item(pop, "stonehearth:resources:stone:hunk_of_stone", camp_x +11, camp_z+9)
end

This will spawn in a Hearthling already promoted to a Mason, and have him/her place their workshop for you. :wink:

As a side note always start new games when doing testing for mods, I’ve encountered many many times where saves maintain certain data, even if you change your .json’s, you will not see some changes in-game.

@Azhrak I’d be glad to assist you if you are having trouble, just post a download link or pm me. :slight_smile:

4 Likes

Can you help me with my mod problem :smile: Its not showing up in game, I think I have missed something.

All the text files are right, I have added it to the manifest and created a mason recipe.

Sorry for assuming that you’d share your mod. I am just a happy to see another modder creating content for the game :slight_smile: .

I’d be glad to work with you just here on discourse too if that’s what you’d prefer.

Have you specified the mixin for the mason’s recipe list in your manifest.

"mixintos": {
    "/stonehearth/jobs/mason/recipes/recipes.json": 
       "file(mixins/mason_recipes.json)"
}

You should have both individual recipe files, and then the mixin file that contains references to all the individual recipes.

Is your item visible in the mason’s crafting menu?

I have another sample here, Renewable Resource [r188]

Which shows off how to add an item to the carpenters crafting menu. The process is almost exactly the same for the mason.


Try checking your "stonehearth.log" file. It’s located in the folder right before the “mods” folder. This could give us clues as to what is going on. :wink:

As a side note, you could try using the “Startup Script” to spawn your item in. This would help clear it up if it’s an issue with the recipe being added or the item in general.

Again Open up

startupscript/server_init.lua

Add this

self:place_item(pop, "your_mod:item_alias", camp_x +11, camp_z+8)
1 Like

I downloaded and looked into the example but I didn’t get it, Like why would I need a new game call handler for something like a decoration. Its seriously confusing me.

Okay, so I tried both ways, I tried creating a seperate folder trying to use mixintos. and I tried just adding it straight to the masons craftables. Neither of them worked.

The new game call handler is an additional thing that is unneeded is your case, and if you brought it into your mod it’s likely the reason why it didn’t work.

The only thing you need to look at from Renewable Resource [r188] is

  • how the manifest is setup, aliases, and mixinto for the classes recipe list.
  • actually recipes file
  • the mixin file for the classes recipe list
  • entitys .json

Can we test just the “Startup Script” creating vanilla items. Remove anything referencing your mod from it and run the game. See if it works, if it does this means it’s likely one your .json’s are invalid.

I use http://jsonlint.com/ to validate my .json’s.

From here’s it’s hard to guess what is going on.

Could you post your “stonehearth.log” file.

All my jsons are valid, and where can I find the log files?

C:\Program Files (x86)\Steam\SteamApps\common\Stonehearth

or

C:\Program Files\Steam\SteamApps\common\Stonehearth

I mean once I’m in the stonehearth folder…

The log file is called "stonehearth.log"

If I upload it, could you take a look at what’s going wrong?

Download Here.

https://drive.google.com/file/d/0BynmPA83eY4PQ0FFZkhyd2tBQzQ/view?usp=sharing

Overall there were a few issues.

  • your manifest.json

  • extra comma with after the stone_armor_statue alias

  • invalid path to stone_armor_statue

  • invalid path to mason mixin file

  • mason_recipes.json

  • invalid path to recipe file

  • stone_armor_statue_recipe.json

  • possibly invalid path to portrait

This you still need to fix

  • i couldn’t full test it because you’ve exported the .qb with compression enabled.
  • Settings for when you export
  • Z-Axis orientation = “Right Handed”
  • Compression = Disabled
  • AlphaMaskEncoding = Enabled

Other than that, looks great :slight_smile:

If you have any other question be sure to ask :wink:

Can you explain how they are invalid file paths? I literally just copied yours. also, how do I override the size? I need the actual model to be 3x the size it is in qubicle.

  1. You have an extra “stone_armor_statue” directive that does not belong (bolded):
    “aliases” : {
    “stone_armor_statue”: “file(entities/stone_armor_statue/stone_armor_statue/stone_armor_statue.json)”,
    },

  2. You are missing the “mason_recipes” directive in the link

“mixintos” : {
"/stonehearth/jobs/mason/recipes/recipes.json" : [
“file(mixins/mason_recipes.json)”
]
}

Should be:

“mixintos” : {
"/stonehearth/jobs/mason/recipes/recipes.json" : [
“file(mixins/mason_recipes/mason_recipes.json)”
]
}

In the item_ghost.json under the “components” section you need to add something like this:

“render_info” : {
“scale” : 0.15
},

Mess around with the scale number. I havn’t touched my code in awhile but I believe 0.15 scales it 150% the size as before. I’m guessing you’d need 0.3 for 300%

1 Like

I fixed the file path and it still isn’t showing up in game. Here is the new version with the fixed file paths.

The file path for the ““mixintos” : {
”/stonehearth/jobs/mason/recipes/recipes.json" : [
“file(mixins/mason_recipes/mason_recipes.json)” part is different, I tried the way thats in the file and the way that was posted here.