Hero Towers

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
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:
Code:
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:
Code:
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"

Note:
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).

Movement:
You may leave everything as is, just set movement type to "fly".
Pathing:
- 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:
Code:
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


Yours,
AceHart
 

Attachments

  • HeroTower_Demo_AceHart.w3x
    30.3 KB · Views: 421
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top