Yeah, unfortunately it wonât be as easy as attaching some XP values to a box.
For one, you will need to mark the the box as âhostileâ of some sort. Not too hostile, though, otherwise your wipmpier hearthlings will start running away from the sight of it, thinking that itâs an actual enemy. Recall that you already can attack inanimate objects in Stonehearth; your soldiers destroy the camp of the Goblins when you send them all in. It would probably be a good idea to have a look at how Radiant made those attackable objects in their code, and adapt that code to your problem.
Assuming you got this first step to work, now, when the box gets destroyed, it might reward some experience. And at this point, you might say you have a full, complete mod. You can set up a dummy, as soon as itâs up, your soldiers will run up to it, swarm it, and reduce it to splinters, and get some XP. You will have a working, but extremely unrealistic mod.
In order to make an attackable dummy that isnât destructible, you will need to take the following things into account: a) Hearthlings attack an enemy until either it dies, they die, or they take so much damage that theyâre forced to run away. Your engagement time with the dummy must be on some sort of time limit, otherwise your soldiers will always keep hitting the dummy and never backing off, b) with the normal Combat Component, you only get XP when the enemy is killed. So youâll either need to write a custom component for your box that sends out an âOh no Iâm deadâ signal after a few hits, and your footman can relax, get his xp, and not attack the dummy anymore, which, although it sent that signal out, isnât actually dead! Heehee, arenât we such scamps, OR you will have to create your very own new action chain, not the usual attack_enemy
or whatever they have, but train_on_dummy
that will consider this, c) unless you manually break your soldiers apart into parties, all your combat hearthlings will travel and fight in a party. Attacking a dummy shouldnât be a party action, itâs an individual action.
Considering all of these facts, I want to direct you to stonehearth/components/combat_state_component
and stonehearth/components/party_component
. You will almost certainly have to write your own component for the dummy, whether you do it the easy way or the hard way, so you might as well get comfortable with component composition.