[MOD] Training Dummies [WIP]

So I started a Hardmode series on my YT channel and while getting my initial supplies and preparing for the future i’d like to get a good miltary defense setup…which to me means getting a knight ASAP! Only downside is footmen only gain experience during battle…which is what i’m trying to setup a good defense from…but I need it…but it’s going to rek me…but…but…but.

So my developer brain got to thinking, "Hmmm…I wonder if I could make a little training dummy…somehow combine a placeable item (lamp) with a mob (goblin or squirrel) that the footman can fight and gain experience with! Here’s a screenie of a model i’m working on (this is about 45 mins of work mostly learning the app). It’s somewhat modeled to resemble the current Goblin

Here’s what i’m thinking of trying to implement!

Dummy Mod

  1. Basic dummy
  • Footman attacks to gain exp
  1. Tiered Dummies
  • I’m thinking have Goblin, then Ogre, then Rock elemental; each level would grant higher exp

Building Materials
The starting dummy is going to be wood and wheat but i’m thinking of implementing harder resources for higher tiers

Interaction
Dummys are placed and are destroyed to “consume” experience. This forces players to think about resource management and allows another way to consume wood, stone, other “easy” to obtain resources.

10 Likes

I’m sure i’ll be thinking of more things as I go through it. Haven’t really had a chance to dive into the .json files as much so any advice you experienced modders have would be GREATLY appreciated! I’m sure TR is going to implement something of their own at some point but I’ve wanted to make a SH mod for some time and figued I would finally take a stab at something. Seems simple enough but we’ll see.

I would guess that it might work if you copy the code of an existing building with health, say, a sarcophagus, change the code so it says training dummy, then add in this…
“exp_reward”: {
“type”: “basic”,
“value”: 0
}
in the attributes section. It seems like it might work.

3 Likes

oh that’s a great idea! I hadn’t thought to mimic that or the goblin camp! Thanks for the idea!

1 Like

Since it is a crafted item it will be friendly to your Hearthlings. So you will have to add something to make it become hostile. Or set it out somewhere for the goblins to steal but then it would still be in iconic form and probable just be lootable not attackable. Making it hostile at creation would mean it would be attacked almost immediately. Not sure how this would work, but hope you are able to figure it out.

edit: I have never tried this but can you manually direct your Hearthlings to attack a friendly structure?

Yeah I was wondering about that. I’ll definately let you know if I find something :wink: I was thinking about how I would be able to have it placed without the “enemy encounter” music playing…that would be annoying :frowning:

Thanks for the advanced warning and tips!

I wonder if there is some form of code that could be used so in the Iconic form it remains friendly

but when you place the item it becomes hostile and attackable

1 Like

An interesting idea. I think it involves more work than you think. But if done right, it will fit seamlessly into the game.
The key thing (I think) is implementing a game entity that is “neutral”. That is, it’s not hostile nor friendly. So you can manually order your soldiers to attack it, but normally they will ignore its existance.
That way you can plan your training - sending footmen to train when you feel like it, call them back to eat/rest/scout/repel an invasion. Also training grounds could be built near your town, as aggro vision ranges will not be a problem.
I don’t know if it is possible to do as I’m not that experienced mod-wise. But that’s how I see it. Just my two cents.

1 Like

Yeah I was kinda hoping (dreaming) to almost have the AI somehow determine it should go train. I was thinking of seeing if I could re-purpose the trapper logic for footman. So the training dummy would become a “trap with a critter” to the footman and they would run over and whack it a few times. That way it’s part of the logical flow and they’ll still patrol. shrugs haven’t had a chance to dive into the code portion yet. Definately loving all the ideas though!

well maybe some good news.
this was from the

http://discourse.stonehearth.net/t/the-goblin-camp-wont-interact-with-me/22638

1 Like

That is good news! Sorry I haven’t been updating the post much. Just had a baby a couple weeks ago and my wife and I are still adjusting to the new sleeping schedule…plus I have a full-time job and a YouTube channel to keep up with :wink:

Man…I gotta stop cramming so much stuff in my life! ;p

2 Likes

Just wanted to provide an update and sort of get an opinion from some of you experienced modders. I’ve been swimming around in the code to see if I might be able to do some (dreaded) copy pasting of existing stuff and found something.

  1. I may try to extract and re purpose some of the trapper (I use that term loosly) LUA and wanted to know how difficult it is to integrate custom Lua to the existing stonehearth code?
  • It would be nice to do something like subclassing (OO terminology); I think mixins accomplishes this?

  • Also is this a BIG step to take? Am I biting off more than I can chew right off the bat?

I have the model and it seems trivial (to me) to just add a recipe and have some crafter make it…i’m already thinking about the interactivity with the SH world and it’s inhabitants; hope that makes sense.

I don’t have any code yet…starting to take my lunch breaks at work to get little short spurts of progress on this guy! Really want to get something out there for myself, for the community, and potentially Radiant :wink:

I think you had a bit of a Lua Uppercase Accident.

Oooooooooooooooooops :sweat_smile:

Alright, I’m gonna try and answer your questions here.

  1. It’s most certainly possible to do it, either by overriding the Lua file (which is not recommended), or to monkey patch it. To do that, I found that the easiest, and smoothest, way is to make a new Lua file that has all the code you want to insert into the existing one. And then from your mod’s server/client init script, you’d “mixin” your code into the old one. My smart crafter mod does exactly this, you could take a peek in it to see an example on this.

  2. Yes.

  3. Well, it is an ambitious mod to tackle; simply because you’d have to modify the AI. As mentioned above, your army dudes has to see the entity as something they can attack, and also make sure that not all of your soldiers attack the same dummy at the same time. So, personally, I’d say that this is the hard part of the mod, and if you don’t understand how the game’s AI work; then you’re more likely to shoot yourself in the foot, with a rocket-launcher.

2 Likes

Shott[quote=“Drotten, post:16, topic:22629”]
shoot yourself in the foot, with a rocket-launcher.
[/quote]

Lolllll! Thats a really Good description xD

would use this mod when it works :slight_smile: hopefully the game will have something of its in own in the future

1 Like

Thanks for the pointers Drotten. Finally got a chance to look at some of your code. Do you know, of hand, if there are streams where some of the Lua stuff is talked about in more developer-y words?

I can definately pick it apart myself and start to understand just looking to see if there might be a stream to help jumpstart my understanding instead of sifting through code trying to piece it all together!

Definately getting pumped to start up the Lua coding!!! <- Wow i’m a developer nerd :stuck_out_tongue:

Specifically about Lua? Not that I can recall, there are plenty of coding streams at least, but none that really focus on teaching about Lua, or about the stuff they are working on. They might explain the part they’re working on, but in small detail and probably not about what you want to know.

Your best bet is to just look at the code yourself and try to understand it as much as possible.

1 Like

That’s what I figured :wink: I’ll probably comb over some the streams when I get some free time. Was just hoping I might be able to head down a slightly narrower road!