Idea for herbalist mod, could this be done (before i start and falter)

Hi all,

I have been snooping about into stonehearth modding, messed a bit with cubicle and made a new-axe for the footman (basicly the same as a sword,…just an axe. choice is cool, yo)

so i have figured out -some- stonhearth modding. but i’d like some feedback from those more experienced than me about if the following would be possible:

id like to change/add new potions to the herbalist, because as it stands: a herbalist just isnt as functional as a cleric.

and with “potion” i really mean “thing that goes into a hearthlings inventory slot” just like tools and armour.
so far, this should be possible, i think. correct me when wrong.

the tricky part comes in letting this “armour that looks like a potion” trigger in certain situations, apply an effect and consume itsself. (after aplying or after its done working, i dont care)

for instance a healing potion that trigggers at 50% health. or a strenght potion when your hearthling is fighting something more dangerous than -x- or something.

bonus question: can enquipped items be layered? as in can i give my armour-that-behaves-as-a-potion the appearance of a potion on a hearthlings belt, so that hearthlings, with actual armour, will additionally have a potion on their belt?

1 Like

Hmm, this is actually kind of ahead in my to-do list, so I haven’t mucked with layering equipped items yet. BUT I think, if you aren’t too shy about writing a bit of code, it should be possible. DIsclaimer: everything that follows this paragraph is the result of personal research. It may be off, it may be outright wrong, Radiant or other modders feel free to correct me.

All items that are currently equippable on a hearthling, items that exist somewhat separately of the hearthling himself (i.e. weapons, armor) are addressed by their “equipment slot”. For example, armor goes into the torso equipment slot, shields go to offhand, weapons go to mainhand, etc. So in theory, making a new type of equippable item is as easy as defining a new slot, and using that.

In practice, I think making a completely new equipment slot would be challenging. To seed your mod, I’d start out by making the potion a hand-held item like a shield, used in place of a shield. It sounds like you already know how to do that. The harder part will definitely be doing all the conditional things – drinking health potions when low on health, strength potions when fighting highly armored enemy, toughness potions when fighting high-hitting enemies… You will need to study the Combat Component closely.

A personal aside: it is better to start and falter than never start at all, especially with modding SH. I’ve written one “mod” in 2015 or 14 or something stupid, it was literally a craftable armor with a buff. After that, I got a big head, and decided to sink my teeth into something far more challenging – I wanted to make a new Engineer turret that you’d manually set a target for, that the Engineer would make special ammo for, run up to it, load it and rotate it towards the target when you gave the order; he’d fire it, and the projectile would travel in an arc towards the target and strike it.

I got as far as having a UI for targeting the cannon, and making an engineer run up to it and it rotate towards the firing spot when I gave the order. Which was pretty impressive IMHO in its own way, I celebrated pretty hard when I got that to work. But once I got to the code which dealt with firing the projectile and drawing a pretty gravity’s rainbow… let’s just say I never took university level math, and I’m really feeling the pain. The mod was never finished. I was greatly discouraged from modding SH, as I started to appreciate the huge array of skills required to do so efficiently.

However, after a while of updates and me getting back in the game and getting annoyed with the difficulty of constructing a megaproject, I had this relatively simple idea for a miner. I coded it up in 2 days and released it. I would never have been able to do so if I didn’t “waste” all that time writing that cannon mod. The cannon mod was freaking difficult, in fact impossible for my skill level, but even though I didn’t hit it, aiming at the moon landed me on a mountaintop. It taught me how to use components, how to create and communicate custom events between the client and the server, what the client and the server even are in the context of SH, the depth of their separation, etc etc. And it still took me 2 days to code just the basics, AND bothering a bunch of people to help me with what I thought would be a simple job. I’m sure that if I didn’t make the cannon mod and started with the Miner, I’d abandon it just like I did with the cannon, but learn that much less about the game.

tl;dr it’s tough but go for it.

2 Likes

Well i was planning to look into it anyway :stuck_out_tongue:
one possible problem i am anticipating is the whole “enquipment items are made for a specific class”
as in a baker doesnt use footman armour, a knight doesnt (i think?) use footman weapons. etc.
and im guessing its not as easy as putting in an asterisk or leaving requirements empty…

(note this is hypothesising, currently at work so cant check myself. note to self: unpack stonehearth and put it on a usb stick for perusing at work during lunch breaks…)

It actually is, though? Except workers have no levels so usually they don’t share their outfits with other classes, unless the outfit is meant for anyone.

It is based on roles. Check the job description (this is from the footman):


Then check the equipment file (this is from the iron_mail):
image

3 Likes

This is probably the easiest part of your mod. @Relyss has a good answer.

Yes. I spent / spend hours just reading the code to discover things I could use later. I highly recommend this for writing mods.

1 Like

ok, this explains a truck, and makes me quite hopefull for the possibility of what i want to do really…

thanks!

this would also make it easy enough to make potions class specific or generic (healing could also be good for villagers, but a “potion of bloody legolas” would be good for archers only.: i dont want my villagers to start throwing chairs at monsters at high speed. :smiley:

1 Like

What are you talking about? That sounds AMAZING.

2 Likes

no one is stopping you from making a “bow” which is invisible and an “arrow” that is totally a chair :stuck_out_tongue: should be surprisingly easy to do too… (well, after you figure out cublicle or simmilar to make a an “arrow” (totally a chair) file.qb

Totally unrelated, anyone ever thought about making a training dummy? some wood, a bit of wheat and maybe a pumpkin, have it count as an enemy that doesnt move, attack, or agro, or for that matter, animate.

upon death drop some of the wood used to make it and give XP, still attackable if you manually task someone to, and in so doing you could train specific fighters? just have it be an HP sponge so it takes them a while?

you could even have advanced ones that take a helmet and a shield to make, but give more xp or something

Training dummies have been suggested many times (I think we even have one in the game files, but it’s not used) :confused:

Still haven’t seen anyone making an interactable one (that’s not just decoration).

hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

2 Likes

presumably because there is no “easy” system to abuse -as far as i can imagine-

well actually. the current potion system has a button right?

make a “potion” that looks like an ACME training dummy box. upon pushing its “use” button, unspawn chest-looking-potion, as an effect, spawn -enemy- the training dummy. that might work, i think?

sidetracked thought: monster-in a box. for all your colloseum needs…

edit : monster spawning code from an item might be hidden in the green goblin fire place thing. start the search there for a training dummy. unless Moai makes one before i ever get there :stuck_out_tongue: (please do!, ill start with my herbalist potion idea)

@Relyss bit of a late response to this but, am i reading you right that as long as i make a “carries a potion” role in the job descriptions, those classes get a potion slot?
so roll=slot?

1 Like

wait wait wait… can you not expand on this @Wouter_Sikkemaand allow all classes (or at least footmen) to auto-carry potions? you know i suck at anything but farming :wink:

this was the plan, Yes, consumable potions for the herbalist. or possible make a druid class or something.

1 Like