Hey, I was looking around and couldn’t find a tutorial to add a new harvestable resource, which would be spawned in with the world like regular berry bushes. I basically want to change the color of the berry bushes to blue (Juniper Berries!) berries. So regulars & Junipers would spawn. Anyone know how?
There’s a thread called something like “how to add an item to r188” that goes into detail over this.
Shameless self-plug: Jelly’s landscaper. In order to achieve such an effect, you need to override the landscaper, which jelly conveniently does for you. All you need to do is mixinto one of Jelly’s data indices.
I love Jelly thank you @RepeatPan
Jelly is definitely a great solution for this… other than it. This would be my solution
Create a custom component. mixin
that component into the existing berry bushes. When that component starts up replace, by some % chance, the regular berry bush with your own.
The main thing that would be different between this and Jelly is that this way you would get great integration of your new berry bush right into the regular berry bush spawns. You’d see regular and Juniper berry bushes side by side.
This also could be extended then easily to include even more types of bushes, once again all spawning together, instead of separate patches.
All things aside…
The base games offers a great way to spawn things throughout the world. While spawning is part of the problem… making the entity actually harvestable is another issue.
I have a sample which covers all of this
Renewable Resource [r188]
Adds harvestable bee hive, basically a berry bush example, which can be harvested to get edible honey.
Adding recipes to carpenter
Adding entities
Renewable resource example
Food example
Download - https://drive.google.com/file/d/0BynmPA83eY4PWGJTMWtDWWR3RVk/view?usp=sharing
Original Post - Question: How do you add objects to r188?
Basically the issue comes down to the type of spawning you are looking for. The base game can easily spawn things using what have been deemed scenarios
. These are used for various things, but in your case, I’d point out the flowers and animals throughout the world are spawned in this way, you could easily adapt a scenario
to spawn in your enities.
The scenario
technique also leaves room to customize the amount to spawn in, chance to spawn, and what “biome” to spawn in.
Good luck with your mod
Thanks! But that bee hive thing… Is it a creating a spawned renewable source tutorial? Or is it a tutorial for getting your carpenter to craft a renewable source?
Renewable resources are not much more than an entity with the renewable-resource component. The berry bush is a prime example of it in terms of what is required, the wild silk weed probably too.
I covered the issues of spawning and being harvestable separately in my post.
-
spawning
- Jelly
- My component idea
- scenarios
-
making the entity actually harvestable
-
Renewable Resource [r188]
-
Take a look at the default berry bush code
Renewable Resource [r188] will show you how to create an entity that is harvestable and returns a “food” that can be eaten.
As for using scenarios to spawn stuff in…
Escaped my mind last time I posted…
@chimeforest uses scenarios
to spawn additional flowers throughout the world. This could be adapted to spawn the bushes.
Personally if it was me I’d go with my component idea for the spawning. In my mind I imagine that all different types of bushes spawn together in the same patch.
But it’s your mod and you’ll need to choose the direction you’d like to go.
I actually have been working on Stonevox like everyday to some degree… I kinda want to look at something else
If you’d like me to I’ll write the lua component to do the spawning.
If you could dude, that would be really great. I’m trying to figure this out but it’s getting kind of confusing so… That’d be a huge help man.
There you go…
I like this type of spawning it looks very natural…
Basically here’s what I did
- implemented my own berry bush,basket,food_serving
- created a custom component that allows for replacing an entity with another by chance
- added my component to the base berry bush
- set it up to have a 50% percent chance to be replaced with a Juniper bush
Here’s how to use the component…
You can either specify it in an entities normal .json
declaration or mixin it.
To modify the game’s berry bush, you’d have to go the mixin route.
Here’s what the mixin looks like…
{
"components" : {
"extra_berry_bushes:entity_replace" : {
"berry_bush" : {
"chance" : "50",
"alias" :
"extra_berry_bushes:plants:juniper_berry_bush"
}
}
}
}
components
: we are adding into the components list
extra_berry_bushes:entity_replace
: specify the component to add
berry_bush
anything can go here, it’s just a name
chance
: replaced with chance 50%
alias
: alias to entity to replace with
Additional candidates to replace the main entity with can be added like so
{
"components" : {
"extra_berry_bushes:entity_replace" : {
"berry_bush" : {
"chance" : "50",
"alias" :
"extra_berry_bushes:plants:juniper_berry_bush"
},
"somethingelse" : {
"chance" : "65",
"alias" : "stonehearth:resources:wood:oak_log"
}
}
}
}
That is all there is too it
Now it’s up to you to adjust things… and maybe add some more bushes
If there is any part of the mod you don’t understand or anything let us know…
P.S this was a bit more hacky then I would have liked but whatever… modding is modding…
I think I got it now, gonna add loads more and create a ‘Berry Mod’ so they don’t complain about eating the same berries anymore. Just curious… the:
}
}
}
Line thingy, is it important to the code or can I just ignore it and add my stuff?
Yes, it is important.
the }
are part of how .json’s are written… if you write a .json
wrong SH will not load it causing all sorts of problems for your mod.
this post here i give a basic rundown how .json’s work and are written
… Question: How do you add objects to r188? - #14 by honestabelink
as a side note…
It is very common to make mistakes when writing .json'
s.
I use http://jsonlint.com/ to help me find the error’s.