Hero Towers

Tutorial By AceHart

The objective:

You want your builder to be able to construct a Hero Tower.
That tower should look, work and generally behave like a normal building.
Including the pathing, so you can't walk over it or build on top of it,
and the usual ground texture under buildings (the grass / stone thingy).

The problem:

Setting a Hero to "stats - is a building: true" doesn't do it.
At least, not all of it.
While setting that option on normal units does indeed enable the pathing options as seen on buildings,
it doesn't work on Hero structures.

The extra detail:

Unit based towers tend not to turn to face the target, unlike, for example, an Ancient Protector.
We'll solve that one as well.

The solution:

- dummy tower that looks like the actual tower you want to build
- a fake base building, with no model, but the correct pathing and ground of a tower
- an actual Hero building

The procedure:

Your worker constructs the dummy tower,
once done, it's replaced by the base tower (can be used on all Hero towers),
the actual Hero is placed on top.

The triggers:

We need two of them, the replacement trigger:
Build Tower Events Unit - A unit Finishes construction Conditions (Unit-type of (Triggering unit)) Equal to Dark Tower (Builder) Actions Unit - Replace (Triggering unit) with a Fake Tower (Base) using The old unit's relative life and mana Set Point = (Position of (Last replaced unit)) Unit - Create 1 Dark Tower (Hero) for (Owner of (Last replaced unit)) at Point facing Default building facing degrees Unit - Set life of (Last created unit) to (Percentage life of (Last replaced unit))% Custom script: call RemoveLocation( udg_Point )

Rather easy, we wait for our dummy tower to finish construction,
then we replace it with the base tower,
put the Hero Tower on top,
and set the life as needed in case the tower was under attack while under construction.

and another trigger that removes the base if the Hero Tower dies:
Tower Dies Events Unit - A unit Dies Conditions (Unit-type of (Triggering unit)) Equal to Dark Tower (Hero) Actions Set Point = (Position of (Triggering unit)) Set UnitGroup = (Units within 1.00 of Point matching ((Unit-type of (Matching unit)) Equal to Fake Tower (Base))) Unit Group - Pick every unit in UnitGroup and do (Actions) Loop - Actions Unit - Explode (Picked unit) Custom script: call DestroyGroup( udg_UnitGroup ) Custom script: call RemoveLocation( udg_Point )

Yes, "1" distance is far enough.

"Dark Tower" refers to the Dark Ranger based Hero Tower I used in the attached demo map.

The worker:

Any worker will do.
All he needs is the dummy towers in "techtree - structures built".
The attached demo map uses an Acolyte, not because it's needed but simply because Undead workers can summon the buildings.
The race of the building is of no importance here.

The dummy tower:

Copy&paste a Human Scout Tower (easiest as it already has no attack).
Fields to adjust:
- Abilities: there shouldn't be any. You may leave "blight dispel" if your map needs it
- Art - Icon - Game interface: set to your Hero's icon
- Art - Model file: set to your Hero's model
- Set Stats - build time, gold cost, lumber cost, repair time, repair gold / lumber and time cost as needed
- Set a decent hotkey
- Set the name and tooltip
- Give it to your worker in "techtree - structures built"

The tower will not show any construction progress... unfortunately, most to all unit models do not have a birth animation...

The fake base tower:

Copy&paste a Human Scout Tower.
Fields to adjust:
- Abilities: same as above
- Art - Model file: none (either by copy&pasting, for example, the "none" from "combat - projectile art", or by entering "_.mdl" as custom path)
- Give it a name so you can find it when needed :P

The Hero Tower:

Now, this one a bit of a pain to get...
Start by copy&pasting the Hero you want to use.
Change the model and art settings if needed.
Along with the usual Hero stats, like Intelligence or Strength, ... food cost, gold cost, built time, ...
The "cost" options should be identical to those on the corresponding dummy tower.

In "stats - Hero" - remove all messages, selections, icons, whatever else you don't want to see.

Make sure the tower adjusts to the ground below:
Art - Elevation - Sample points: 4
Art - Elevation - Sample radius: 50
Art - Orientation interpolation: 0

No unusual shadows:
Set all "art - shadow"s to either "none" or 0.
Set "art - shadow texture" to "Scout tower, ..." (Can't find it? Copy&paste from an existing tower).

You may leave everything as is, just set movement type to "fly".
- AI radius: 15
- Placement: general
- Collision: 72

Stats - Unit classification:
- Mechanical (and Undead should you need it)

Remove all techtree requirements (unless you want some of course).

Finally, set "text - name". And some Hero names (one will do...).

When done, find "stats - is a building" and set it to true.
A couple options will "disappear" but that's nothing to worry about, they still exist and work.
If you need to edit them, set it back to "false" and to "true" again when done.

The finer details:

You do want, of course, your Hero to turn around so it actually faces the enemy it's shooting at, right?
If you don't, set the movement speed to 0...

Assuming you do:
Find the ability "Root (Ancient Protector)", and set it up like this:
- Data - Rooted turning: true
- Data - Rooted Weapons: attack 1 (optionally both)

Find and copy&paste the ability "Spell Book".
Set it up:
- Data - Min spells: 1
- Data - Max spells: 1
- Data - Spell list: the Root ability you edited previously

Give the Spell Book to all towers based on units.
Disable the book for all players:
Events Map initialization Conditions Actions Player Group - Pick every player in (All players) and do (Actions) Loop - Actions Player - Disable Spell Book (Allow Turning) for (Picked player)

The final word:

Too complicated?
Maybe... but you do get a Hero tower that looks and feels like an actual building, it can level up, and it even turns to where it shoots.

On a related note, there's a gameplay constant of interest:
Hero - Building kills grant experience
It greatly helps for kills by buildings to actually give experience to nearby Heroes.

The fake base tower is only needed once, you can use it for all Hero Towers in your map.

As usual, there's a demo map attached here.

Things to note:
- "Restore" works just fine, or "Repair" if your map doesn't unit Undead summoning
- "Unsummon" does not work... unless you set its "targets allowed" to "mechanical, player units"

Things I forgot to mention:

See demo map :P


Click here to comment on this tutorial.
Blizzard Entertainment, Inc.
Silkroad Online Forums
Team Griffonrawl Trains Muay Thai and MMA fighters in Ohio.
Apex Steel Pipe - Buys and sells Steel Pipe.