Custom Actors (Enemies)

From Heroes of Hammerwatch wiki
Jump to: navigation, search

It's currently only possible to add custom actors easily by using the Enemy SVal Loader mod[1], available on the Steam Workshop. It's still possible to have your custom enemies spawn by editing the EnemyPlacement script manually to include your new enemies but is strongly not recommended, as this makes it impossible to have multiple enemy mods at once. This guide will assume you are using the mod to maintain compatibility with other mods. If you haven't yet, make sure you create the base for the mod first.

Making Actors

Under Construction - Use existing actor .unit and .png as a base until this is written.


Making Actors Spawn

In this example, we'll make ticks from the first act appear in the Battlements. Functionally the same principles can be used to spawn your own enemy wherever you like, I just wanted to show that you can move enemies around (a little bit at least, for now you can't actually stop them from spawning in their original areas completely).


In your mod folder, create a folder called actors. In there, you have to create a new sval file. You can for example call this extra_act6_enemies.sval, or something else fitting. Keep in mind: the assets between base and mods are shared! This means you should use a unique filename here that no other mod is going to use. (You could also put it in a separate (or different) folder if you want to be extra cautious.)

Sval files is the main serializable data structure used throughout the engine, and sval files describe a single SValue object. Sval files however have a special property; you can specify a loader tag to tell the engine which script function to load the sval with. These are called SValue Loaders. Using this loader, we can make the file load actor spawn definitions. For example, we can make an sval file containing this to add ticks to the battlements:

<loader>AddEnemyFile</loader>
<dict>
	<dict name="late_game_tick">
		<string name="loc">actors/tick_1.unit</string>
		<string name="type">act6_common</string>
		<string name="class">regular</string>
		<int name="min-ng">0</int>
		<int name="max-ng">5</int>
		<int name="min-lev">2</int>
	</dict>
</dict>


Here's a breakdown of the information included here:

  • loc: This is the location of the unit file to be used. If you have your file in a folder called "my_super_cool_mod" for example, you would use my_super_cool_mod/tick_1.unit instead.
  • type: This determines where the enemy can spawn. A list of all applicable tags and what they mean is below.
  • class: What kind of enemy it is. Applicable tags are regular, elite, miniboss, and spawner.
  • min-ng: [OPTIONAL] The minimum level of NG+ at which the spawning rule applies. If you set this to 5, your enemy will only spawn on NG+5 and beyond. If you don't add this line, it will default to NG+0 and above.
  • max-ng: [OPTIONAL] The maximum level of NG+ at which the spawning rule applies. If you set this to 5, your enemy will only spawn on NG+5 and below. If you don't add this line it defaults to 0, which tells the generator to not apply a limit. Adding the line and setting it to 0 manually will achieve the same affect.
  • min-lev: [OPTIONAL] The minimum level of an area at which the spawning rule applies. In the example above with the value of 2, the tick will only spawn on Battlements 2, and won't spawn at all on Battlements 1. If you don't add this line it defaults to 0, which allows the enemy to spawn on any level of the area.
  • spawnerAlt: [OPTIONAL] This line isn't included above because it's not a spawner. If you are adding a spawner, you have to include this line (it's a string, so copy the loc line and change loc to spawnerAlt). This is specified in exactly the same way as the loc unit file, and is used to give the location of the destroyed version of the spawner. The destroyed spawner should have its own .unit file.


Type Tags

  • act1_common: Mines, Prisons 1 (Ticks)
  • act1_uncommon: Mines, Prison 1+2 (Bats)
  • act1_rare: Mines, Prison 3 (Maggots)
  • act2_common: Prison, Armory 1 (Melee Skeletons)
  • act2_uncommon: Prison, Armory 1+2 (Ranged Skeletons)
  • act4_common: Archives (Eyes)
  • act4_uncommon: Archives (Wisps)
  • act4_rare: Archives (Ghosts)
  • act5_common: Chambers (Stronger Melee Skeletons)
  • act5_uncommon: Chambers (Stronger Ranged Skeletons)
  • act5_rare: Chambers (Liches, Battlemages)
  • act6_common: Battlements (Ice Troll Warriors)
  • pop_act1_common: Desert (Scorpions)
  • pop_act1_uncommon: Desert (Snakes)
  • pop_act2_common: Lower Pyramid (Melee Mummies)
  • pop_act2_uncommon: Lower Pyramid (Ranged Mummies)
  • pop_act3_common: Upper Pyramid (Stronger Melee Mummies)
  • pop_act3_uncommon: Upper Pyramid (Stronger Ranged Mummies


There's no Act 3 tags currently because Act 3 only reuses Act 2 enemies (the ghosts from statues aren't handled by the same generator). This may be modified in a later version to make Act 3 unique enemies, though the goal is currently to have spawning from the framework be as close to vanilla as possible by default.


That's it! That's really all it takes to add custom enemies (barring of course the effort it takes to make the unit file and the sprite, but still)! If you've done it all right, you should be able to enable the mod in-game and see your new enemy spawning wherever you chose!